-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
Description
Compiler version
3.8.4-RC1-bin-20260222-dd3cd80-NIGHTLY
Minimized code
sealed trait AbstractBox[A]
case class Box[A](x: A) extends AbstractBox[A]
def leak[A](x: AbstractBox[A^]): A = {
x match {
case Box(y) => y
}
}It is also possible to compile code with a leaky non-polymorphic capability without a GADT.
case class Foo()
case class Box[A](x: A)
def fooLeak(x: Box[Foo^]): Box[Foo] = {
x match {
case Box(y) => Box(y)
}
}Output
Both examples compile.
Expectation
Should not compile.
Reactions are currently unavailable