-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
area:metaprogramming:reflectionIssues related to the quotes reflection APIIssues related to the quotes reflection APIarea:opaque-typesitype:bug
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.ParamAccessorExpectation
When inspecting opaque type field members, members of the underlying type should not be revealed.
Metadata
Metadata
Assignees
Labels
area:metaprogramming:reflectionIssues related to the quotes reflection APIIssues related to the quotes reflection APIarea:opaque-typesitype:bug