diff options
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/for-comprehension-old.check | 25 | ||||
-rw-r--r-- | test/files/neg/for-comprehension-old.scala | 11 | ||||
-rw-r--r-- | test/files/neg/t4163.check | 4 | ||||
-rw-r--r-- | test/files/neg/t4163.scala | 2 |
4 files changed, 39 insertions, 3 deletions
diff --git a/test/files/neg/for-comprehension-old.check b/test/files/neg/for-comprehension-old.check new file mode 100644 index 0000000000..ec54d619b4 --- /dev/null +++ b/test/files/neg/for-comprehension-old.check @@ -0,0 +1,25 @@ +for-comprehension-old.scala:2: error: assignment in for comprehension must be preceded by `val` + for (x <- 1 to 5 ; y = x) yield x+y // fail + ^ +for-comprehension-old.scala:4: error: val in for comprehension must be followed by assignment + for (val x <- 1 to 5 ; y = x) yield x+y // fail + ^ +for-comprehension-old.scala:4: error: assignment in for comprehension must be preceded by `val` + for (val x <- 1 to 5 ; y = x) yield x+y // fail + ^ +for-comprehension-old.scala:5: error: val in for comprehension must be followed by assignment + for (val x <- 1 to 5 ; val y = x) yield x+y // fail + ^ +for-comprehension-old.scala:7: error: assignment in for comprehension must be preceded by `val` + for (z <- 1 to 2 ; x <- 1 to 5 ; y = x) yield x+y // fail + ^ +for-comprehension-old.scala:9: error: val in for comprehension must be followed by assignment + for (z <- 1 to 2 ; val x <- 1 to 5 ; y = x) yield x+y // fail + ^ +for-comprehension-old.scala:9: error: assignment in for comprehension must be preceded by `val` + for (z <- 1 to 2 ; val x <- 1 to 5 ; y = x) yield x+y // fail + ^ +for-comprehension-old.scala:10: error: val in for comprehension must be followed by assignment + for (z <- 1 to 2 ; val x <- 1 to 5 ; val y = x) yield x+y // fail + ^ +8 errors found diff --git a/test/files/neg/for-comprehension-old.scala b/test/files/neg/for-comprehension-old.scala new file mode 100644 index 0000000000..476e99808e --- /dev/null +++ b/test/files/neg/for-comprehension-old.scala @@ -0,0 +1,11 @@ +class A { + for (x <- 1 to 5 ; y = x) yield x+y // fail + for (x <- 1 to 5 ; val y = x) yield x+y // ok + for (val x <- 1 to 5 ; y = x) yield x+y // fail + for (val x <- 1 to 5 ; val y = x) yield x+y // fail + + for (z <- 1 to 2 ; x <- 1 to 5 ; y = x) yield x+y // fail + for (z <- 1 to 2 ; x <- 1 to 5 ; val y = x) yield x+y // ok + for (z <- 1 to 2 ; val x <- 1 to 5 ; y = x) yield x+y // fail + for (z <- 1 to 2 ; val x <- 1 to 5 ; val y = x) yield x+y // fail +} diff --git a/test/files/neg/t4163.check b/test/files/neg/t4163.check index d275117833..e94c4fae7c 100644 --- a/test/files/neg/t4163.check +++ b/test/files/neg/t4163.check @@ -1,6 +1,6 @@ t4163.scala:4: error: '<-' expected but '=' found. - x = 3 - ^ + val x = 3 + ^ t4163.scala:5: error: illegal start of simple expression y <- 0 to 100 ^ diff --git a/test/files/neg/t4163.scala b/test/files/neg/t4163.scala index 25ce5522a4..bb4c65f18d 100644 --- a/test/files/neg/t4163.scala +++ b/test/files/neg/t4163.scala @@ -1,7 +1,7 @@ class Bug { val z = ( for { - x = 3 + val x = 3 y <- 0 to 100 } yield y ).toArray |