Open
Description
Equalities between types established by the cases of inline matches aren't known on the RHS,
object Test {
import scala.compiletime._
inline def foo[T](t: T): T =
inline erasedValue[T] match {
case _: Int => 23
case _ => t
}
}
-- [E007] Type Mismatch Error: tests/run/typeclass-derivation3.scala:5:21 ----
5 | case _: Int => 23
| ^^
| found: Int(23)
| required: T
one error found
Adding a cast allows this to compile,
object Test {
import scala.compiletime._
inline def foo[T](t: T): T =
inline erasedValue[T] match {
case _: Int => 23.asInstanceOf[T]
case _ => t
}
}