Skip to content

Typer regression in typelevel/fs2 #24096

@WojciechMazur

Description

@WojciechMazur

Based on the OpenCB failure in typelevel/fs2 - build logs

Compiler version

Last good release: 3.8.0-RC1-bin-20250915-afbb66b-NIGHTLY
First bad release: 3.8.0-RC1-bin-20250916-eb1bb73-NIGHTLY

Minimized code

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
        case _              => ???

Output

[error] ./test.scala:8:32
[error] Found:    (r : Pull[F, O, Unit] & Pull.Terminal[_])
[error] Required: Pull[F2, O2, Unit]
[error] 
[error] where:    F  is a type in class StreamPullOps with bounds <: [_²] =>> Any
[error]           F2 is a type in method flatMapOutput with bounds >: [x] =>> F[x] and <: [x] =>> Any
[error]         case r: Terminal[?] => r
[error]                                ^
Error compiling project (Scala 3.8.0-RC1-bin-20250928-b67fcf2-NIGHTLY, JVM (21))

Expectation

Should compile

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions