Open
Description
Compiler version
3.5.2, 3.6.2-RC3
Minimized code
import scala.quoted.*
inline def debug[A]: String = ${ debugImpl[A] }
def debugImpl[A: Type](using quotes: Quotes): Expr[String] = {
import quotes.reflect.*
val a = TypeRepr.of[A]
val sym = a.typeSymbol
val xMem = sym.fieldMember("x")
if (xMem != Symbol.noSymbol)
Expr(s"${sym.name}.${xMem.name}, flags ${xMem.flags.show}")
else
Expr("No symbol")
}
object T {
case class V(x: Double)
opaque type Vec = V
}
import T.*
object Main {
def main(args: Array[String]): Unit = {
println(debug[Vec])
println(debug[V])
}
}
Output
Vec.x, flags Flags.CaseAccessor | Flags.ParamAccessor
V.x, flags Flags.CaseAccessor | Flags.ParamAccessor
Expectation
When inspecting opaque type field members, members of the underlying type should not be revealed.