-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #6460: less forcing in checkNonCyclic #6493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
41f5bbd
to
07ed256
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Great detective work!
07ed256
to
d406860
Compare
final def moduleClass(implicit ctx: Context): Symbol = { | ||
def notFound = { | ||
if (Config.showCompletions) println(s"missing module class for $name: $myInfo") | ||
NoSymbol | ||
} | ||
if (this is ModuleVal) | ||
if (this is ModuleClass) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For speed I'd move the operations that return the same symbol towards the end, i.e. where otherwise NoSymbol
would be returned.
* otherwise NoSymbol | ||
*/ | ||
final def sourceModule(implicit ctx: Context): Symbol = | ||
if (this is ModuleVal) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
3357727
to
d86fcb6
Compare
d86fcb6
to
1cbec0b
Compare
This is more intuitive in my opinion. As a side-effect, this makes the logic for creating stub package symbols in `staticRef` more robust which broke the `missingDottyLib` test. This is fixed by moving the `isPackageFromCoreLibMissing` check earlier.
checkNonCyclic was forcing too many infos because it didn't account for the case where the prefix is a ModuleVal and not a ModuleClass. Fixing this solves the incremental compilation issue in the Dotty build reported in scala#6460 were the root cause was a completion cycle when jointly compiling SymbolLoaders and Types that looked like this: Complete `object tpd` Complete its parent `Trees.Instance` Complete its type parameter `T >: Untyped <: Type` run `checkNonCyclic` on the the type parameter definition Complete `Type` Complete `import ast.tpd._` in `Types.scala` Eventually this requires unpickling the selection `Trees.Instance#T` which gets a `NoDenotation` since `T` hasn't been entered yet. As a side-effect this also means that the neg/toplevel-cyclic test no longer leads to an "illegal cyclic reference" error, instead it now causes "recursion limit exceeded" errors, which are less nice but still acceptable.
1cbec0b
to
a11de49
Compare
checkNonCyclic was forcing too many infos because it didn't account for
the case where the prefix is a ModuleVal and not a ModuleClass. Fixing
this solves the incremental compilation issue in the Dotty build
reported in #6460 were the root cause was a completion cycle when
jointly compiling SymbolLoaders and Types that looked like this:
Complete
object tpd
Complete its parent
Trees.Instance
Complete its type parameter
T >: Untyped <: Type
run
checkNonCyclic
on the the type parameter definitionComplete
Type
Complete
import ast.tpd._
inTypes.scala
Eventually this requires unpickling the selection
Trees.Instance#T
whichgets a
NoDenotation
sinceT
hasn't been entered yet.As a side-effect this also means that the neg/toplevel-cyclic
test no longer leads to an "illegal cyclic reference" error, instead it
now causes "recursion limit exceeded" errors, which are less nice but
still acceptable.