Skip to content

Fix cast exception while traversing supertypes in Scala3doc #11123

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

Merged
merged 1 commit into from
Jan 15, 2021

Conversation

BarkingBad
Copy link
Contributor

No description provided.

@BarkingBad BarkingBad linked an issue Jan 14, 2021 that may be closed by this pull request
@BarkingBad BarkingBad force-pushed the scala3doc/typedef-defdef-issues branch from 5b80a73 to 3b94638 Compare January 14, 2021 15:00
@BarkingBad BarkingBad marked this pull request as ready for review January 14, 2021 15:00
Seq(link -> superLink) ++ getSupertypesGraph(tree.asInstanceOf[ClassDef], superLink)
}
)
val parents = unpackTreeToClassDef(classDef).asInstanceOf[ClassDef].parents
Copy link
Contributor

@nicolasstucki nicolasstucki Jan 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would make unpackTreeToClassDef return a ClassDef instead of the unchecked cast.

In unpackTreeToClassDef you can do

-       case c: Apply => c.symbol.owner.tree.symbol.tree
+      case c: Apply =>
+        c.symbol.owner.tree.symbol.tree match 
+          case tree: ClassDef => tree

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, will change

@BarkingBad BarkingBad force-pushed the scala3doc/typedef-defdef-issues branch from 3b94638 to 88c1548 Compare January 14, 2021 15:18
@BarkingBad BarkingBad merged commit f5e84f4 into scala:master Jan 15, 2021
@BarkingBad BarkingBad deleted the scala3doc/typedef-defdef-issues branch January 15, 2021 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DefDef cannot be cast to TypeDef
3 participants