summaryrefslogtreecommitdiff
path: root/test/files/neg
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-09-18 07:48:57 -0700
committerPaul Phillips <paulp@improving.org>2013-09-18 12:11:05 -0700
commit1c8bbd7ec5b8859f75abfbc4e70482dede2b7007 (patch)
treebc0daf08322afb83c9e55c0e7b31c758625fb8cc /test/files/neg
parent7f3a7a4e39642f03f3fc32467c14ea718036cf6c (diff)
downloadscala-1c8bbd7ec5b8859f75abfbc4e70482dede2b7007.tar.gz
scala-1c8bbd7ec5b8859f75abfbc4e70482dede2b7007.tar.bz2
scala-1c8bbd7ec5b8859f75abfbc4e70482dede2b7007.zip
Position#show prints the point.
Can't ensure range position points are meaningful when we never see them. To limit noise, only print the point when it != start. [x:y] // point=x, start=x, end=y [p/x:y] // point=p, start=x, end=y I'm open to a different syntax. Also prints NoPosition as [X] rather than [NoPosition] because noise is for construction workers and attenders of rock concerts. Some range position and parser tests are included so we can see the checkfile change when the forthcoming fix happens (either an error message improvement or a positional one.)
Diffstat (limited to 'test/files/neg')
-rw-r--r--test/files/neg/parser-errors.check16
-rw-r--r--test/files/neg/parser-errors.scala5
-rw-r--r--test/files/neg/t7473.check12
-rw-r--r--test/files/neg/t7473.scala4
4 files changed, 33 insertions, 4 deletions
diff --git a/test/files/neg/parser-errors.check b/test/files/neg/parser-errors.check
new file mode 100644
index 0000000000..ab13ee0921
--- /dev/null
+++ b/test/files/neg/parser-errors.check
@@ -0,0 +1,16 @@
+parser-errors.scala:1: error: lazy values may not be abstract
+abstract class A1 { lazy val foo: Int }
+ ^
+parser-errors.scala:2: error: '=' expected but '}' found.
+abstract class A2 { val Some(x) }
+ ^
+parser-errors.scala:3: error: unbound placeholder parameter
+abstract class A3 { var x = _ }
+ ^
+parser-errors.scala:4: error: unbound placeholder parameter
+abstract class A4 { val x: Int = _ }
+ ^
+parser-errors.scala:5: error: unbound placeholder parameter
+abstract class A5 { var Some(x) = _ }
+ ^
+5 errors found
diff --git a/test/files/neg/parser-errors.scala b/test/files/neg/parser-errors.scala
new file mode 100644
index 0000000000..1bf121f68f
--- /dev/null
+++ b/test/files/neg/parser-errors.scala
@@ -0,0 +1,5 @@
+abstract class A1 { lazy val foo: Int }
+abstract class A2 { val Some(x) }
+abstract class A3 { var x = _ }
+abstract class A4 { val x: Int = _ }
+abstract class A5 { var Some(x) = _ } \ No newline at end of file
diff --git a/test/files/neg/t7473.check b/test/files/neg/t7473.check
index bc8c29d463..488baef94e 100644
--- a/test/files/neg/t7473.check
+++ b/test/files/neg/t7473.check
@@ -1,7 +1,13 @@
-t7473.scala:6: error: '<-' expected but '=' found.
+t7473.scala:5: error: '<-' expected but '=' found.
+ for (x = Option(i); if x == j) yield 42 //t7473.scala:4: error: '<-' expected but '=' found.
+ ^
+t7473.scala:5: error: illegal start of simple expression
+ for (x = Option(i); if x == j) yield 42 //t7473.scala:4: error: '<-' expected but '=' found.
+ ^
+t7473.scala:8: error: '<-' expected but '=' found.
(for (x = Option(i); if x == j) yield 42) toList
^
-t7473.scala:6: error: illegal start of simple expression
+t7473.scala:8: error: illegal start of simple expression
(for (x = Option(i); if x == j) yield 42) toList
^
-two errors found
+four errors found
diff --git a/test/files/neg/t7473.scala b/test/files/neg/t7473.scala
index 593231d5f2..1eb9e6cb7a 100644
--- a/test/files/neg/t7473.scala
+++ b/test/files/neg/t7473.scala
@@ -1,7 +1,9 @@
object Foo {
val i,j = 3
- //for (x = Option(i); if x == j) yield 42 //t7473.scala:4: error: '<-' expected but '=' found.
+
+ for (x = Option(i); if x == j) yield 42 //t7473.scala:4: error: '<-' expected but '=' found.
+
// evil postfix!
(for (x = Option(i); if x == j) yield 42) toList
}