-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix synthetic type bounds in Tasty reflect #4601
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
Fix synthetic type bounds in Tasty reflect #4601
Conversation
bd4254b
to
19a069c
Compare
03403b4
to
3d3dbb6
Compare
To represent dotty TypeTrees containing type bounds
8b5f22d
to
a83f019
Compare
In dotty bootstapped the assert is inlined
a83f019
to
420e4c5
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.
Otherwise, LGTM
@@ -538,7 +538,7 @@ object TastyImpl extends scala.tasty.Tasty { | |||
|
|||
object Synthetic extends SyntheticExtractor { | |||
def unapply(x: TypeTree)(implicit ctx: Context): Boolean = x match { | |||
case Trees.TypeTree() => true | |||
case x @ Trees.TypeTree() => !x.tpe.isInstanceOf[Types.TypeBounds] | |||
case _ => false | |||
} | |||
} |
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.
Given the name synthetic
, I cannot justify the change. Maybe a doc for Synthetic
, I naively assume synthetic bounds are also synthetic.
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 will add some documentation.
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.
Added
@@ -188,7 +190,8 @@ class ShowExtractors[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty | |||
case Type.PolyType(argNames, argBounds, resType) => | |||
this += "Type.PolyType(" ++= argNames += ", " ++= argBounds += ", " += resType += ")" | |||
case Type.TypeLambda(argNames, argBounds, resType) => | |||
this += "Type.TypeLambda(" ++= argNames += ", " ++= argBounds += ", " += resType += ")" | |||
// resType is not printed to avoid cycles |
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'm curious what kind of cycles can happen here?
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 definitions, we use the tree of the definition. Somewhere in the body of the type lambda there was a reference to itself and then tried to reprint itself in a loop.
…ounds Fix synthetic type bounds in Tasty reflect
No description provided.