Closed
Description
Compiler version
3.3.0-RC3 and 3.2.2
Minimized code
import scala.compiletime.constValue
type IsInt[A] = A match
case Int => true
case _ => false
constValue[IsInt[Int]] // val res2: Boolean = true; works as expected
constValue[IsInt[String]] // val res3: Boolean = false; works as expected
object Foo:
opaque type Foo = Int
constValue[IsInt[Foo.Foo]] // compile-time error
Output
1 |constValue[IsInt[Foo.Foo]]
|^^^^^^^^^^^^^^^^^^^^^^^^^^
|not a constant type: IsInt[rs$line$2#Foo.Foo]; cannot take constValue
Expectation
I don't know if it should have been true
or false
(probably false
), but compilation error certainly wasn't expected. My expectation was that an opaque type T
is treated as any other T >: Nothing <: Any
.