-
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
-Yretain-trees (and flags which imply it like -Ysafe-init) changes the types of trees returned by the reflection API #14195
Comments
The usage of the compiler flag Note that the usage of The following code is a better way to achieve the goal without using tpr.classSymbol.foreach { sym =>
tpr.memberType(sym.primaryConstructor) match {
case MethodType(_, _, resTp) =>
println(s"classTpe = ${resTp.show}")
case _ =>
}
} |
There are some (many) cases where you need to go through the tree, so the issue remains. |
If you need to go through the tree this is likely due to something missing in the reflection API and should be reported as a bug, but regardless we should ensure that the behavior of tree.tpe does not change based on whether -Yretain-trees is enabled or not |
e.g. There is no way to find the known subtypes from a
Yes |
I believe this is tracked by #13553 |
I expect you would do tp.symbol.children.map(_.info) to get back the types. |
Compiler version
3.1.2-RC1-bin-20211222-c94b333-NIGHTLY
Minimized code
Output
Expectation
-Ysafe-init
The text was updated successfully, but these errors were encountered: