diff --git a/tests/neg/i24096.check b/tests/neg/i24096.check new file mode 100644 index 000000000000..d46e1224a5df --- /dev/null +++ b/tests/neg/i24096.check @@ -0,0 +1,10 @@ +-- [E007] Type Mismatch Error: tests/neg/i24096.scala:8:31 ------------------------------------------------------------- +8 | case r: Terminal[?] => r // error + | ^ + | Found: (r : Pull[F, O, Unit] & Pull.Terminal[_]) + | Required: Pull[F2, O2, Unit] + | + | where: F is a type in class StreamPullOps with bounds <: [_²] =>> Any + | F2 is a type in method flatMapOutput with bounds >: [x] =>> F[x] and <: [x] =>> Any + | + | longer explanation available when compiling with `-explain` diff --git a/tests/neg/i24096.scala b/tests/neg/i24096.scala new file mode 100644 index 000000000000..e7ae73d9f170 --- /dev/null +++ b/tests/neg/i24096.scala @@ -0,0 +1,9 @@ +abstract class Pull[+F[_], +O, +R] +object Pull: + abstract class Terminal[+R] extends Pull[Nothing, Nothing, R] + + class StreamPullOps[F[_], O](self: Pull[F, O, Unit]): + def flatMapOutput[F2[x] >: F[x], O2](): Pull[F2, O2, Unit] = + self match + case r: Terminal[?] => r // error + case _ => ???