Skip to content

Commit 1aeeffe

Browse files
Merge pull request #7543 from dotty-staging/fix-#6762
Fix #6762: Add regression tests
2 parents 70a6323 + 849fa29 commit 1aeeffe

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

tests/neg/i6762.check

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-- [E007] Type Mismatch Error: tests/neg/i6762.scala:5:72 --------------------------------------------------------------
2+
5 |def f(word: String)(given QuoteContext): Expr[Foo[G[String]]] = '{Foo(${word.toExpr})} // error
3+
| ^^^^
4+
| Found: quoted.Expr[String]
5+
| Required: quoted.Expr[G[String]]

tests/neg/i6762.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import scala.quoted.{_, given}
2+
3+
type G[X]
4+
case class Foo[T](x: T)
5+
def f(word: String)(given QuoteContext): Expr[Foo[G[String]]] = '{Foo(${word.toExpr})} // error

tests/neg/i6762b.check

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-- [E007] Type Mismatch Error: tests/neg/i6762b.scala:4:39 -------------------------------------------------------------
2+
4 |def f(word: String): Expr[G[String]] = word.toExpr // error
3+
| ^^^^
4+
| Found: Expr[String]
5+
| Required: Expr[G[String]]

tests/neg/i6762b.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
type Expr[T]
2+
type G[X]
3+
4+
def f(word: String): Expr[G[String]] = word.toExpr // error
5+
6+
def splice[T](e: Expr[T]): T = ???
7+
8+
type Liftable
9+
given Liftable = ???
10+
11+
implicit object ExprOps {
12+
def (x: T) toExpr[T](given Liftable): Expr[T] = ???
13+
}

0 commit comments

Comments
 (0)