Open
Description
Compiler version
any, main
Minimized code
import scala.quoted._
inline def test() = ${testImpl}
def testImpl(using Quotes) = {
import quotes.reflect._
val fooSymbol = TypeRepr.of[Foo[Int]].typeSymbol
val nestedSymbol = fooSymbol.typeMember("Nested")
println(TypeRepr.of[Foo[Int]].memberType(nestedSymbol))
'{()}
}
trait Foo[X]:
sealed abstract class Nested extends Foo[Int]
@main def Test = test()
Output
ClassInfo(AppliedType(TypeRef(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,module class <root>)),module class <empty>)),Foo),List(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),object scala),Int))), class Nested, List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class Object), AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class <empty>)),trait Foo),List(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),object scala),class Int)))))
Expectation
ClassInfo should not be exposed in the Quotes reflect API, instead we should get a TypeRef, like. in other similar situations:
TypeRef(AppliedType(TypeRef(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,module class <root>)),module class <empty>)),Foo),List(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),object scala),Int))),class Nested)
Found by @Florian3k, fix needed for Scaladoc