Closed
Description
We are not allowed to splice wildcard types to avoid soundness issues. They are not checked when explicitly spliced:
import scala.quoted._
object Macro {
def impl[A : Type](using qctx: QuoteContext): Unit = {
import qctx.tasty._
val tpe = typeOf[A].seal.asInstanceOf[quoted.Type[_ <: AnyRef]]
'{ (a: ${tpe}) => ???} // should be an error
}
}
import scala.quoted._
object Macro {
def impl[A : Type](using qctx: QuoteContext): Unit = {
import qctx.tasty._
val tpe/*: quoted.Type[? <: AnyKind]*/ = typeOf[A].seal
'{ f[$tpe] } // should be an error
}
def f[T <: AnyKind]: Unit = ()
}