Open
Description
Compiler version
3.4.1 (note I am using -Ykind-projector:underscores
, if that's relevant)
Minimized code
The example from https://docs.scala-lang.org/scala3/reference/metaprogramming/macros.html#type-patterns-1
import scala.quoted.*
def empty[T: Type](using Quotes): Expr[T] =
Type.of[T] match
case '[String] => '{ "" }
case '[List[t]] => '{ List.empty[t] }
case '[type t <: Option[Int]; List[t]] => '{ List.empty[t] }
Output
Each of the '{}
produces a type error for "expected T, got {String, List[t]}" but the example in the docs seems to suggest that T
is known to be String/List[t] in those paths!
Expectation
This should compile fine. Note that adding an asExprOf[T]
makes it work, but is far from ideal.