diff --git a/tests/neg/i6762.check b/tests/neg/i6762.check new file mode 100644 index 000000000000..315acb67198a --- /dev/null +++ b/tests/neg/i6762.check @@ -0,0 +1,5 @@ +-- [E007] Type Mismatch Error: tests/neg/i6762.scala:5:72 -------------------------------------------------------------- +5 |def f(word: String)(given QuoteContext): Expr[Foo[G[String]]] = '{Foo(${word.toExpr})} // error + | ^^^^ + | Found: quoted.Expr[String] + | Required: quoted.Expr[G[String]] diff --git a/tests/neg/i6762.scala b/tests/neg/i6762.scala new file mode 100644 index 000000000000..3ef78e4d8d11 --- /dev/null +++ b/tests/neg/i6762.scala @@ -0,0 +1,5 @@ +import scala.quoted.{_, given} + +type G[X] +case class Foo[T](x: T) +def f(word: String)(given QuoteContext): Expr[Foo[G[String]]] = '{Foo(${word.toExpr})} // error diff --git a/tests/neg/i6762b.check b/tests/neg/i6762b.check new file mode 100644 index 000000000000..54d75a793056 --- /dev/null +++ b/tests/neg/i6762b.check @@ -0,0 +1,5 @@ +-- [E007] Type Mismatch Error: tests/neg/i6762b.scala:4:39 ------------------------------------------------------------- +4 |def f(word: String): Expr[G[String]] = word.toExpr // error + | ^^^^ + | Found: Expr[String] + | Required: Expr[G[String]] diff --git a/tests/neg/i6762b.scala b/tests/neg/i6762b.scala new file mode 100644 index 000000000000..9a12fffd6dbe --- /dev/null +++ b/tests/neg/i6762b.scala @@ -0,0 +1,13 @@ +type Expr[T] +type G[X] + +def f(word: String): Expr[G[String]] = word.toExpr // error + +def splice[T](e: Expr[T]): T = ??? + +type Liftable +given Liftable = ??? + +implicit object ExprOps { + def (x: T) toExpr[T](given Liftable): Expr[T] = ??? +}