-
Notifications
You must be signed in to change notification settings - Fork 1.1k
DefDef cannot be cast to TypeDef #11089
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
Comments
More info can be found in |
What is the stack trace? |
Stacktrace
Problem exists for accessing parents of parents with generic parameters (because of that error we have to stop evaluation at |
The issue is the following unchecked cast The solution is to pattern match first to make sure it is a |
Will try |
I observed I made a mistake the first time I was traversing supertypes by calling Here is work in progress branch: While traversing supertypes if we encounter Values of
or
or
or
Stacktrace
|
That seems to indicate that you are asking for the trees of some type aliases. type Serializable = java.io.Serializable
type Cloneable = java.lang.Cloneable
type Object = java.lang.Object
type Serializable = java.io.Serializable
The best you can do is to remove all the - tree.asInstanceOf[ClassDef]
+ tree match
+ case tree: ClassDef => tree
+ case tree => throw MatchError(tree.show(using Printer.TreeStructure)) This will crash as soon as the assumption of the type is wrong and will show you the pattern that you need to match it. |
When traversing parents inside ClassLikeSupport, there is some strange bug coming from tasty with casting.
For now, there is workaround to catch errors and ignore them, resulting in heuristically correct graph where it can be
The text was updated successfully, but these errors were encountered: