-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
area:pattern-matchingitype:bugitype:soundnessSoundness bug (it lets us compile code that crashes at runtime with a ClassCastException)Soundness bug (it lets us compile code that crashes at runtime with a ClassCastException)
Milestone
Description
Compiler version
3.2.0-RC1
On 3.1.3 it is a compiler error instead (it should not be)
Minimized code
case class Composite[T](v: T)
def m(composite: Composite[_]): Unit =
composite match {
case Composite[Int](v) => println(v)
case _ => println("OTHER")
}
m(Composite("This is String"))
Output
java.lang.ClassCastException: class java.lang.String cannot be cast to class java.lang.Integer
Expectation
Print "OTHER"
Metadata
Metadata
Assignees
Labels
area:pattern-matchingitype:bugitype:soundnessSoundness bug (it lets us compile code that crashes at runtime with a ClassCastException)Soundness bug (it lets us compile code that crashes at runtime with a ClassCastException)