Skip to content

Fix #6762: Add regression tests #7543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions tests/neg/i6762.check
Original file line number Diff line number Diff line change
@@ -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]]
5 changes: 5 additions & 0 deletions tests/neg/i6762.scala
Original file line number Diff line number Diff line change
@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is given QuoteContext needed here? The original issue did not have this implicit parameter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there is a quote. the original issue is outdated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without it there is an extra error about the missing QuoteContext

5 changes: 5 additions & 0 deletions tests/neg/i6762b.check
Original file line number Diff line number Diff line change
@@ -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]]
13 changes: 13 additions & 0 deletions tests/neg/i6762b.scala
Original file line number Diff line number Diff line change
@@ -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] = ???
}