summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/t6931.check10
-rw-r--r--test/files/neg/t6931/Macros_1.scala15
-rw-r--r--test/files/neg/t6931/Test_2.scala4
-rw-r--r--test/files/pos/t8013/inpervolator_1.scala2
4 files changed, 30 insertions, 1 deletions
diff --git a/test/files/neg/t6931.check b/test/files/neg/t6931.check
new file mode 100644
index 0000000000..7cf804a936
--- /dev/null
+++ b/test/files/neg/t6931.check
@@ -0,0 +1,10 @@
+Test_2.scala:3: error: 1
+ err"123"
+ ^
+Test_2.scala:3: error: 2
+ err"123"
+ ^
+Test_2.scala:3: error: 3
+ err"123"
+ ^
+three errors found
diff --git a/test/files/neg/t6931/Macros_1.scala b/test/files/neg/t6931/Macros_1.scala
new file mode 100644
index 0000000000..56da075d1f
--- /dev/null
+++ b/test/files/neg/t6931/Macros_1.scala
@@ -0,0 +1,15 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+object Macros {
+ implicit class Error(ctx: StringContext) {
+ def err(args: Any*): Unit = macro impl
+ }
+
+ def impl(c: Context)(args: c.Tree*): c.Tree = {
+ import c.universe._
+ val q"Macros.Error(scala.StringContext.apply($arg)).err()" = c.macroApplication
+ for (i <- 1 to 3) c.error(arg.pos.withPoint(arg.pos.point + i - 1), i.toString)
+ q"()"
+ }
+} \ No newline at end of file
diff --git a/test/files/neg/t6931/Test_2.scala b/test/files/neg/t6931/Test_2.scala
new file mode 100644
index 0000000000..6a6f645904
--- /dev/null
+++ b/test/files/neg/t6931/Test_2.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ import Macros._
+ err"123"
+} \ No newline at end of file
diff --git a/test/files/pos/t8013/inpervolator_1.scala b/test/files/pos/t8013/inpervolator_1.scala
index 89b7c22709..612e1d727d 100644
--- a/test/files/pos/t8013/inpervolator_1.scala
+++ b/test/files/pos/t8013/inpervolator_1.scala
@@ -18,7 +18,7 @@ object Perverse {
def pImpl(c: Context)(args: c.Expr[Any]*): c.Expr[String] = {
import c.universe._
val macroPos = c.macroApplication.pos
- val text = macroPos.lineContent substring macroPos.column
+ val text = macroPos.source.lineToString(macroPos.line - 1) substring macroPos.column
val tt = Literal(Constant(text))
val tree = q"t8013.Perverse.pervert($tt)"
c.Expr[String](tree)