-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Compile quote patterns directly into QuotePattern AST #18133
Conversation
cb2bdff
to
55b53ca
Compare
55b53ca
to
62d64b7
Compare
a587838
to
49fd70c
Compare
77386e0
to
edf30ad
Compare
Fixes scala#14708 Fixes scala#16522 Fixes scala#18125 Fixes scala#18250
edf30ad
to
10b1a74
Compare
val allTypeBindings = List.newBuilder[Bind] | ||
for tpVar <- typeTypeVariables do | ||
val sym = tpVar.symbol | ||
sym.setFlag(Case) |
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.
Could this flag be set when creating the symbol?
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.
I could not figure out how to do it cleanly in Namer. But I found that I could add the case modifier while desugaring.
} | ||
|
||
override def transform(tree: Tree)(using Context) = tree match | ||
case tree @ AppliedTypeTree(tpt, args) => |
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.
Maybe that doesn't matter for the transform you're doing, but this isn't complete, it's at least missing TypeBoundsTree, LambdaTypeTree as well as method parameters in DefTrees.
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.
It might be a problem, but we must change this behavior in a minor release. This will not affect soundness of the pattern match, but it will change the behavior of existing programs. This is only used to decide which bound of the type we should return.
This is related to the type inference of type variable bounds and shares some of the same problems and limitations. At some point, we will need a way to allow users to state explicitly if they want to solve for a lower or upper bound. This inference would become redundant or a warning like the one we have for the type bounds.
Fixes #14708
Fixes #16522
Fixes #18125
Fixes #18250