Skip to content

Inline match on opaque type with type variable fails to reduce #24699

@eejbyfeldt

Description

@eejbyfeldt

Compiler version

3.7.4, 3.8.1-RC1-bin-20251208-0bb0433-NIGHTLY

Minimized code

object test {
object O {
  opaque type R[X] = X
}

inline def f =
  inline scala.compiletime.erasedValue[O.R[Int]] match {
    case x: O.R[t] => ???
  }

f
}

Output

[error] /home/ejbyfeldt/dev/scala_playground/named_tuple_inline_match.scala:11:3
[error] cannot reduce inline match with
[error]  scrutinee:  scala.compiletime.package$package.erasedValue[test.O.R[Int]] : test.O.R[Int]
[error]  patterns :  case x @ _:test.O.R[t @ _]
[error]   f
[error]   ^

Expectation

Either the code should compile without warnings. Or if this is not suppose to work we should probably issue a helpful warning.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions