-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
area:metaprogramming:quotesIssues related to quotes and splicesIssues related to quotes and splicesarea:pattern-matchingitype:bug
Description
Compiler version
3.3.6 and 3.7.3
Minimized code
// In Test.scala
//> using scala 3.7.3
class Foo[A]
object Test:
def traverse[F[_], A](x: F[A]): F[Any] = ???
Macro.test(traverse[Foo, Int](Foo[Int]))
// In Macro.scala
import scala.quoted.*
object Macro:
inline def test(inline x: Any): Unit = ${ test('x) }
private def test(x: Expr[Any])(using Quotes): Expr[Unit] =
x match
case '{
type f[X]
Test.traverse[f, a]($_)
} =>
quotes.reflect.report.errorAndAbort("do not use traverse", x)
case _ => '{}
Output
It compiles.
Expectation
It should fail with do not use traverse
error on traverse[Foo, Int](Foo[Int])
.
Notes
It works as expected if Foo
is covariant: class Foo[+A]
.
Metadata
Metadata
Assignees
Labels
area:metaprogramming:quotesIssues related to quotes and splicesIssues related to quotes and splicesarea:pattern-matchingitype:bug