Open
Description
Compiler version
3.3.0-RC6 and 3.2.2
Minimized code
// file:exampleMacro.scala
package example
import scala.quoted.*
case class X[T](x: String)
object X {
inline given exampleMacro[T]: X[T] = ${ exampleMacroImpl[T] }
def exampleMacroImpl[T: Type](using qctx: Quotes): Expr[X[T]] = {
'{ X[T](${ Expr(Type.show[T]) }) }
}
}
// file:example.scala
package example
trait TraitSuper
trait TraitSub extends TraitSuper
@main def main: Unit = {
println(X.exampleMacro[TraitSuper & TraitSub].x) // outputs: verbatim type tree
println(implicitly[X[TraitSuper & TraitSub]].x) // output: modified type tree
}
Output
example.TraitSuper & example.TraitSub
example.TraitSub
Expectation
The type received on the macro side differs when the macro is invoked implicitly versus when the macro is invoked explicitly – expected to receive the same type tree in both cases.