-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #3847: Handle correctly splicing of (possibly) nested type parameters #4116
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
c8affb6
to
f7b179c
Compare
You probably can uncomment this https://github.com/lampepfl/dotty/blob/master/tests/run-with-compiler/quote-lib.scala#L123 |
val splicedType = tree.tpe.asInstanceOf[TypeRef].prefix.termSymbol | ||
splice(ref(splicedType).select(tpnme.UNARY_~)) | ||
case tree: TypeApply => | ||
super.transform(tree) |
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 think we do not need this branch
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.
True! Not anymore!
if (map.contains(tp)) | ||
map.apply(tp) | ||
else | ||
mapOver(tp) |
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.
Shorter and more efficient:
override def apply(tp: Type): Type = map.getOrElse(tp, mapOver(tp))
} | ||
} | ||
|
||
Block(typeDefs ++ tagsExplicitTypeDefsPairs.map(_._2), |
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.
Isn't this just Block(typeDefs ++ explicitTypeDefs,
?
Updated! Thanks for the review! |
Based on #4081
The proposed fix handle the case when a type splice e.g.,
~t
appears in possibly nested positions as a type parameter, e.g.,List[~t]
andList[Array[~t]]
. If the code included justList[T]
andList[Array[T]]
the types are extracted and added as tags using implicit search in the phase oftryHeal
. This commit collects and handles spliced types as well, using the same mechanism as before.