Open
Description
Compiler version
3.1.2-RC1-bin-20211222-c94b333-NIGHTLY
Minimized code
🤚 With
-Ysafe-init
inscalacOptions
import scala.deriving.Mirror
import scala.quoted.*
import scala.reflect.ClassTag
inline def test[A]: Unit = ${ testImpl[A] }
private def testImpl[A](
using
q: Quotes,
t: Type[A]
): Expr[Unit] = {
import q.reflect.*
val tpr = TypeRepr.of[A]
tpr.classSymbol.foreach {
_.tree match {
case cd: ClassDef =>
val tpe = cd.constructor.returnTpt.tpe
println(s"classTpe = ${tpe.show}")
case _ =>
}
}
'{ () }
}
// Execute test below:
final class Foo(val name: String)
test[Foo]
Output
classTpe = scala.Unit
Expectation
classTpe = Foo
-Ysafe-init