Open
Description
Compiler version
3.5.0
(3.4.0
+)
3.3.3
works correctly
Minimized code
enum Foo:
case Bar(i: Int)
case class Container(foo: Foo)
@main def main = Container(Foo.Bar(1)) match {
case Container(Foo.Bar) => println("yes")
case _ => println("no")
}
Output
Using Scala 3.5.0
no
Using Scala 3.3.3
[error] ./main.scala:8:18
[error] Found: Foo.Bar.type
[error] Required: Foo
[error] pattern type is incompatible with expected type
[error] case Container(Foo.Bar) => println("yes")
[error] ^^^^^^^
Error compiling project (Scala 3.3.3, JVM (11))
Compilation failed
Expectation
It should fail to compile since Container
takes a Foo
and I expect Foo.Bar
to be of type Foo.Bar.type
but not of type Foo
.
Scala 3.3.3
does the right thing, but 3.5.0
doesn't.