Skip to content

Commit d5e1b46

Browse files
committed
Fix scala#6765: Add regression test
1 parent e2f4070 commit d5e1b46

File tree

7 files changed

+54
-1
lines changed

7 files changed

+54
-1
lines changed

library/src/scala/quoted/Toolbox.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package scala.quoted
22

33
import scala.annotation.implicitNotFound
44

5-
@implicitNotFound("Could not find implicit quoted.Toolbox.\n\nDefault toolbox can be instantiated with:\n `implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader)`\n\n")
5+
@implicitNotFound("Could not find implicit quoted.Toolbox.\n\nDefault toolbox can be instantiated with:\n `delegate for scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader)`\n\n")
66
trait Toolbox {
77
def run[T](expr: QuoteContext => Expr[T]): T
88
}

tests/run-macros/i6765-b.check

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
val x$1: java.lang.String = "One"
3+
scala.Nil.::[java.lang.String](x$1)
4+
}
5+
{
6+
val x$1: java.lang.String = "One"
7+
scala.Nil.::[java.lang.String](x$1)
8+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import scala.quoted._
2+
import delegate scala.quoted._
3+
4+
inline def foo = ${fooImpl}
5+
6+
def fooImpl given (qctx: QuoteContext) = {
7+
val res = List('{"One"}).toExprOfList
8+
res.show.toExpr
9+
}

tests/run-macros/i6765-b/Test_2.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
object Test {
2+
def main(args: Array[String]): Unit = {
3+
val res = foo
4+
println(res)
5+
6+
println(foo)
7+
}
8+
}

tests/run-macros/i6765.check

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
val x$1: java.lang.String = "One"
3+
scala.Nil.::[java.lang.String](x$1)
4+
}
5+
{
6+
val x$1: java.lang.String = "One"
7+
scala.Nil.::[java.lang.String](x$1)
8+
}

tests/run-macros/i6765/Macro_1.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import scala.quoted._
2+
import delegate scala.quoted._
3+
4+
delegate for Toolbox = Toolbox.make(getClass.getClassLoader)
5+
6+
inline def foo = ${fooImpl}
7+
8+
def fooImpl given (qctx: QuoteContext) = {
9+
import qctx.tasty._
10+
val res = List('{"One"}).toExprOfList
11+
res.show.toExpr
12+
}

tests/run-macros/i6765/Test_2.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
object Test {
2+
def main(args: Array[String]): Unit = {
3+
val res = foo
4+
println(res)
5+
6+
println(foo)
7+
}
8+
}

0 commit comments

Comments
 (0)