-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add recheck phase #12971
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
Add recheck phase #12971
Conversation
@@ -1161,6 +1160,37 @@ class Typer extends Namer | |||
} | |||
} | |||
|
|||
/** The parameter type for a parameter in a lambda that does | |||
* not have an explicit type given, and where the type is not known from the context. | |||
* In this case the paranmeter type needs to be inferred the "target type" T known |
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.
Spelling
* In this case the paranmeter type needs to be inferred the "target type" T known | |
* In this case the parameter type needs to be inferred from the "target type" T known |
#12938 now merged |
Squashed to one commit and rebased to master |
… program. This is useful for two reasons: = It gives us additional explanation and validation what constitutes a well-typed Scala 3 program. Recheck has less than 300 lines of code, which is a lot less than Typer and associated files. - It can be used as a basis for phases that refine the original types with new kinds of types and new rules.
@olhotak Wpuld you be interested in reviewing this? I think it is ready to merge. |
|
||
def run(using Context): Unit = | ||
val unit = ctx.compilationUnit | ||
//println(i"recheck types of $unit") |
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.
stray (commented) println
def recheckBind(tree: Bind, pt: Type)(using Context): Type = tree match | ||
case Bind(name, body) => | ||
enterDef(tree) | ||
val bodyType = recheck(body, pt) |
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.
Is it intentional that bodyType
is unused?
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.
Yes. But I am not completely sure how to handle that. Generally, Binds will be gone by the time the rechecker is run, except for type binds.
This is necessary since not all constant folded terms are converted to literals. The conversion does not happen if one of the operands is impure. A test case is run/final-field.scala
Detected when fixing the conforms check
- rename `exludes` --> `excludes` - fix comments
Treat a SolemType(T) as a supertype (as well as a subtype) of T.
* - being able to compile dotty bootstrapped, | ||
* - making sure that TASTY can link against a compiled version of Dotty, | ||
* - compiling the compiler using the SemanticDB generation | ||
* - compiling the compiler under -Yrecheck mode. |
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.
Can -Yrecheck be thought of as a more extensive -Ycheck or do they end up checking different things?
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.
Quite different things. -Yrecheck is only for testing special recheck phases. Right now there is only one such phase planned, and that is the capture checker. But others might follow.
LGTM now. |
Revert "Merge pull request #12971 from dotty-staging/add-rechecker"
Add recheck phase
Add recheck phase
Add recheck phase
Add recheck phase
Add recheck phase
Add a phase for recomputing and rechecking all types in a typed Scala program. This is useful for two reasons:
Based on #12938