Skip to content

Don't unsoundly maximise types to Any/Nothing #15509

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

Closed
wants to merge 2 commits into from

Conversation

dwijnand
Copy link
Member

@dwijnand dwijnand commented Jun 23, 2022

Also fix the span of the new pattern bound symbol,
which was failing pickling tests.

[test_non_bootstrapped]

@dwijnand dwijnand linked an issue Jun 23, 2022 that may be closed by this pull request
@dwijnand dwijnand force-pushed the gadt/unsound-cast branch from b6252b1 to 5b34415 Compare June 23, 2022 11:10
Also fix the span of the new pattern bound symbol,
which was failing pickling tests.
@dwijnand dwijnand force-pushed the gadt/unsound-cast branch from 5b34415 to d055a8d Compare June 23, 2022 11:44
@dwijnand dwijnand force-pushed the gadt/unsound-cast branch from 0cb299b to b7b2689 Compare June 23, 2022 13:06
@@ -0,0 +1,13 @@
sealed trait Tree[+A]
final case class Leaf[+B](v: B) extends Tree[B]
final case class Node[+C](xs: List[C]) extends Tree[List[C]]
Copy link
Member Author

Choose a reason for hiding this comment

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

Change this to

Suggested change
final case class Node[+C](xs: List[C]) extends Tree[List[C]]
final case class Node[+C <: AnyRef](xs: List[C]) extends Tree[List[C]]

and use Integer instead of Int, and it's goes back to breaking

@dwijnand dwijnand closed this Jun 23, 2022
@dwijnand dwijnand deleted the gadt/unsound-cast branch June 23, 2022 17:37
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.

Unsoundness in GADT casting when using a variant type constructor
1 participant