-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Try/cycle detection #161
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
Merged
Merged
Try/cycle detection #161
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
These were not handled before.
Added decorators for symbols that can query specific annotations and annotation arguments (for now, -deprecated and -migration are added)
Added method to traverse all parts of a type.
Two improvements to TreeTransform: 1) Added transformOther functionality which handles trees not handled by other parts 2) Passes down Mode.Pattern in the context when in a pattern. TreeTransform no longer normalizes unknown trees but passes them to transformOther. The former Companions phase has been renamed to FirstTransform. It now performs the following optimizations: - adds companion objects (this was done before) - other normalizations that were formally done in TreeTransform, - rewrite native methods to stubs (this was formally done in RefChecks)
Cycles are now detected early, when an info is first completed. Legal, f-bounded cycles are broken by a LazyRef, which will construct its type lazily. This makes checkBounds validation of AppliedTypeTrees work (in FirstTransform). Formerly, this stackoverflowed despite the laziness precautions in findMember. Todo: Do the same for class files coming from Java and Scala 2.x.
Insert LazyRefs to break cycles for F-bounded types that are unpickled or read from Java signatures.
Now that F-bunded types are treated more robustly, we can check bounds for non-emptyness during Typer. This unvealed one wrong test (wonder how that passed scalac?), which got moved to neg.
@review by @DarkDimius and whoever else wants to have a look at it. |
This PR seems to fix the StackOverflowError we got in #91, but here's another example which does not yet work: object infpaths3 {
object a {
trait T { t =>
type M <: t.g.N
type T <: a.T
val f: t.T
trait U { u =>
type N <: t.f.M
type U <: a.x.g.U
val f: u.U
}
val g: t.U
}
val x: a.T = ???
}
} On branch try/cycle-detection (#161) (and also on branch change/treecopying (#164)):
but after outputting this, dotty runs into an infinite loop. With scalac, the cycles are detected, and there's no infinite loop:
|
Closed
WojciechMazur
pushed a commit
to WojciechMazur/dotty
that referenced
this pull request
Mar 19, 2025
Backport "Update asm to patched 9.7.1" to 3.3 LTS
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some initial steps to take over former RefChecks functionality. Includes some cleanups in transforms.
The biggest change has to do F-bounded polymorphism. We now do cycle detection early and break
all legal cycles with a LazyRef type. Without this precaution lots of code would blow up with a stack overflow - checkbounds being one example.