Skip to content

Regression in match exhaustivity of higher-kinded types #17230

Closed
@WojciechMazur

Description

@WojciechMazur

Compiler version

3.3.1-RC1-bin-20230407-bcaa1ca-NIGHTLY

Minimized code

Based on Open CB failure https://github.com/VirtusLab/community-build3/actions/runs/4650721329/jobs/8230332752 for rescala-lang/rescala

import scala.util.* 

trait Transaction {
  type State[_]
}
object Transaction {
  type of[S[_]] = Transaction { type State[A] = S[A] }
}
trait DynamicScope[State[_]]

case class ScopeSearch[State[_]](self: Either[Transaction.of[State], DynamicScope[State]]) {

  def embedTransaction[T](f: Transaction.of[State] => T): T =
    self match {
      case Left(integrated) => ??? 
      case Right(ds)        => ???
    }
}

Output

Compiling project (Scala 3.3.1-RC1-bin-20230407-bcaa1ca-NIGHTLY, JVM)
[warn] ./test.scala:13:5
[warn] match may not be exhaustive.
[warn] 
[warn] It would fail on pattern case: Left(_)
[warn]     self match {
[warn]     ^^^^
Compiled project (Scala 3.3.1-RC1-bin-20230407-bcaa1ca-NIGHTLY, JVM)

Expectation

Should not give warning

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions