scala3 icon indicating copy to clipboard operation
scala3 copied to clipboard

Reflection: no way to compute LUB or GLB of a TypeRepr

Open neko-kai opened this issue 3 years ago • 0 comments

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

neko-kai avatar Aug 02 '22 17:08 neko-kai