-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed as not planned
Labels
area:metaprogramming:reflectionIssues related to the quotes reflection APIIssues related to the quotes reflection APIitype:bug
Description
Compiler version
main (10bb2e6)
Minimized code
Macro_1.scala
import scala.quoted.*
object Macros {
def testImpl(using Quotes): Expr[Unit] = {
import quotes.reflect.*
val barSymbol = TypeRepr.of[domain.Bar].typeSymbol
val typeMemberClassInfo = TypeRepr.of[domain.Foo].memberType(barSymbol)
println(typeMemberClassInfo)
'{()}
}
inline def test: Unit = ${ testImpl }
}
object domain {
sealed trait Foo
case class Bar() extends Foo
}Test_2.scala:
@main def main = Macros.testOutput
ClassInfo(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,module class <empty>)),module class domain$)), class Bar, List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class Object), TypeRef(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,module class <empty>)),module class domain$)),trait Foo), TypeRef(TermRef(TermRef(NoPrefix,object _root_),object scala),trait Product), TypeRef(ThisType(TypeRef(NoPrefix,module class io)),trait Serializable)))Expectation
ClassInfo should never be exposed in the quotes reflection API. directly calling TypeRepr.of[domain.Bar], we get TypeRef(TermRef(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,module class <root>)),module class <empty>)),domain),Bar), which is a result I would expect there instead of ClassInfo.
Metadata
Metadata
Assignees
Labels
area:metaprogramming:reflectionIssues related to the quotes reflection APIIssues related to the quotes reflection APIitype:bug