Open
Description
Compiler version
3.1.2
Minimized code
import scala.quoted.*
def test(using Quotes) =
def foo[T](e: Expr[T]): T = e match { case '{ 2 + 2 } => 4 }
Output
[error] -- [E007] Type Mismatch Error:
[error] 21 | def foo[T](e: Expr[T]): T = e match { case '{ 2 + 2 } => 4 }
[error] | ^
[error] | Found: (4 : Int)
[error] | Required: T
Expectation
Should work because we know that Int <: T
from this pattern. It's analogous to:
abstract class Expr[+E]
case class Add() extends Expr[Int]
def foo[T](e: Expr[T]): T = e match { case D() => 4 }
which does currently work.