diff options
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/neg/quasiquotes-syntax-error-position.check | 32 | ||||
-rw-r--r-- | test/files/neg/quasiquotes-syntax-error-position.scala | 15 | ||||
-rw-r--r-- | test/files/run/t7331a.check | 2 | ||||
-rw-r--r-- | test/files/run/t7331a.scala | 10 | ||||
-rw-r--r-- | test/files/run/t7331b.check | 3 | ||||
-rw-r--r-- | test/files/run/t7331b.scala | 11 | ||||
-rw-r--r-- | test/files/run/t7331c.check | 3 | ||||
-rw-r--r-- | test/files/run/t7331c.scala | 11 | ||||
-rw-r--r-- | test/files/scalacheck/quasiquotes/ErrorProps.scala | 6 |
9 files changed, 87 insertions, 6 deletions
diff --git a/test/files/neg/quasiquotes-syntax-error-position.check b/test/files/neg/quasiquotes-syntax-error-position.check new file mode 100644 index 0000000000..3bd813b1bb --- /dev/null +++ b/test/files/neg/quasiquotes-syntax-error-position.check @@ -0,0 +1,32 @@ +quasiquotes-syntax-error-position.scala:5: error: '=' expected but identifier found. + q"def $a f" + ^ +quasiquotes-syntax-error-position.scala:6: error: illegal start of simple expression + q"$a(" + ^ +quasiquotes-syntax-error-position.scala:7: error: '}' expected but end of quote found. + q"class $t { def foo = $a" + ^ +quasiquotes-syntax-error-position.scala:8: error: '.' expected but splicee found. + q"import $t $t" + ^ +quasiquotes-syntax-error-position.scala:9: error: illegal start of definition + q"package p" + ^ +quasiquotes-syntax-error-position.scala:10: error: ';' expected but '@' found. + q"foo@$a" + ^ +quasiquotes-syntax-error-position.scala:11: error: case classes without a parameter list are not allowed; +use either case objects or case classes with an explicit `()' as a parameter list. + q"case class A" + ^ +quasiquotes-syntax-error-position.scala:12: error: identifier expected but ']' found. + tq"$t => $t $t]" + ^ +quasiquotes-syntax-error-position.scala:13: error: end of quote expected but 'case' found. + cq"pattern => body ; case pattern2 =>" + ^ +quasiquotes-syntax-error-position.scala:14: error: ')' expected but end of quote found. + pq"$a(bar" + ^ +10 errors found diff --git a/test/files/neg/quasiquotes-syntax-error-position.scala b/test/files/neg/quasiquotes-syntax-error-position.scala new file mode 100644 index 0000000000..b97af52cfc --- /dev/null +++ b/test/files/neg/quasiquotes-syntax-error-position.scala @@ -0,0 +1,15 @@ +import scala.reflect.runtime.universe._ +object test extends App { + val a = TermName("a") + val t = TypeName("t") + q"def $a f" + q"$a(" + q"class $t { def foo = $a" + q"import $t $t" + q"package p" + q"foo@$a" + q"case class A" + tq"$t => $t $t]" + cq"pattern => body ; case pattern2 =>" + pq"$a(bar" +}
\ No newline at end of file diff --git a/test/files/run/t7331a.check b/test/files/run/t7331a.check new file mode 100644 index 0000000000..a59b400344 --- /dev/null +++ b/test/files/run/t7331a.check @@ -0,0 +1,2 @@ +source-<toolbox>,line-1,offset=0 +2
\ No newline at end of file diff --git a/test/files/run/t7331a.scala b/test/files/run/t7331a.scala new file mode 100644 index 0000000000..1851945e63 --- /dev/null +++ b/test/files/run/t7331a.scala @@ -0,0 +1,10 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends App { + val tb = cm.mkToolBox() + val tree = tb.parse("x") + println(tree.pos) + println(tree.pos.source.content.length) +}
\ No newline at end of file diff --git a/test/files/run/t7331b.check b/test/files/run/t7331b.check new file mode 100644 index 0000000000..7034a95a3f --- /dev/null +++ b/test/files/run/t7331b.check @@ -0,0 +1,3 @@ +reflective compilation has failed: + +')' expected but eof found. diff --git a/test/files/run/t7331b.scala b/test/files/run/t7331b.scala new file mode 100644 index 0000000000..052656d11b --- /dev/null +++ b/test/files/run/t7331b.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.{ToolBox, ToolBoxError} + +object Test extends App { + val tb = cm.mkToolBox() + try tb.parse("f(x") + catch { + case ToolBoxError(msg, _) => println(msg) + } +}
\ No newline at end of file diff --git a/test/files/run/t7331c.check b/test/files/run/t7331c.check new file mode 100644 index 0000000000..fd3ac1d9ef --- /dev/null +++ b/test/files/run/t7331c.check @@ -0,0 +1,3 @@ +ClassDef(Modifiers(), TypeName("C"), List(), Template(List(Select(Ident(scala), TypeName("AnyRef"))), emptyValDef, List(DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(pendingSuperCall), Literal(Constant(()))))))) +source-<toolbox>,line-1,offset=6 +NoPosition diff --git a/test/files/run/t7331c.scala b/test/files/run/t7331c.scala new file mode 100644 index 0000000000..75873afcd0 --- /dev/null +++ b/test/files/run/t7331c.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends App { + val tb = cm.mkToolBox() + val tree = tb.parse("class C").asInstanceOf[ClassDef] + println(showRaw(tree)) + println(tree.pos) + println(tree.impl.self.pos) +}
\ No newline at end of file diff --git a/test/files/scalacheck/quasiquotes/ErrorProps.scala b/test/files/scalacheck/quasiquotes/ErrorProps.scala index 044a332a04..b9e69e0e88 100644 --- a/test/files/scalacheck/quasiquotes/ErrorProps.scala +++ b/test/files/scalacheck/quasiquotes/ErrorProps.scala @@ -188,12 +188,6 @@ object ErrorProps extends QuasiquoteProperties("errors") { val q"$m1 $m2 def foo" = EmptyTree """) - property("can't parse more than one casedef") = fails( - "Can't parse more than one casedef, consider generating a match tree instead", - """ - cq"1 => 2 case 3 => 5" - """) - // // Make sure a nice error is reported in this case // { import Flag._; val mods = NoMods; q"lazy $mods val x: Int" } }
\ No newline at end of file |