scala3
scala3 copied to clipboard
Reflection: no way to compute LUB or GLB of a TypeRepr
Compiler version
3.1.2
Minimized code
inline def lubOf[T <: AnyKind]: String = ${ lubOfImpl[T] }
def lubOfImpl[T <: AnyKind: Type](using qctx: Quotes): Expr[String] = {
import qctx.reflect.*
'{ ${ TypeRepr.lub(List(TypeRepr.of[T])) } }
}
Output
value lub is not a member of qctx.reflect.TypeReprModule
'{ ${ TypeRepr.lub(List(TypeRepr.of[T])) } }
Expectation
We need a way to compute the LUB of a set of types to port features of izumi-reflect to Scala 3
Original issue: https://github.com/zio/izumi-reflect/issues/133