aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-12-08 16:06:38 +0100
committerMartin Odersky <odersky@gmail.com>2013-12-08 16:06:38 +0100
commit519a99ab7f5d6a20d985fa0b515567d43c4c802a (patch)
treed19f78285bfc023f8aae942d9017384a25b7b548 /tests
parentb5be3e97d5e2455966f170b7cd0baba82c8fae12 (diff)
downloaddotty-519a99ab7f5d6a20d985fa0b515567d43c4c802a.tar.gz
dotty-519a99ab7f5d6a20d985fa0b515567d43c4c802a.tar.bz2
dotty-519a99ab7f5d6a20d985fa0b515567d43c4c802a.zip
Fixes to desugaring of for-expressions with embedded aliases.
Diffstat (limited to 'tests')
-rw-r--r--tests/pos/collections.scala3
-rw-r--r--tests/pos/desugar.scala27
2 files changed, 25 insertions, 5 deletions
diff --git a/tests/pos/collections.scala b/tests/pos/collections.scala
index 71848c14d..910940e77 100644
--- a/tests/pos/collections.scala
+++ b/tests/pos/collections.scala
@@ -2,6 +2,8 @@ import scala.collection.generic.CanBuildFrom
object collections {
+ List(1, 2, 3) map (x => 2)
+
val s = Set(1, 2, 3)
val ss = s map (_ + 1)
@@ -16,4 +18,5 @@ object collections {
val ys = ints3 map (x => x + 1)
val zs = ys filter (y => y != 0)
+
} \ No newline at end of file
diff --git a/tests/pos/desugar.scala b/tests/pos/desugar.scala
index 7a12de373..69e8c8651 100644
--- a/tests/pos/desugar.scala
+++ b/tests/pos/desugar.scala
@@ -1,9 +1,9 @@
object desugar {
-
+
// variables
var x: Int = 2
var y = x * x
-
+
{ var z: Int = y }
def foo0(first: Int, second: Int = 2, third: Int = 3) = first + second
@@ -24,11 +24,11 @@ object desugar {
case object Nil extends List[Nothing]
}
-
- import caseClasses._
-
+
object patDefs {
+ import caseClasses._
+
val xs: List[Int] = Cons(1, Cons(2, Nil))
val Cons(y, ys) = xs
@@ -39,4 +39,21 @@ object desugar {
val x, y, z: Int = 1
}
+
+ object Binops {
+
+ x :: y :: Nil
+
+ }
+
+ object fors {
+
+ for (x <- List(1, 2, 3)) yield 2
+ for (x <- List(1, 2, 3) if x % 2 == 0) yield x * x
+ for (x <- List(1, 2, 3); y <- 0 to x) yield x * y
+ for (x <- List(1, 2, 3); y <- 0 to x; if x + y % 2 == 0) yield x * y
+ for (x <- List(1, 2, 3); y = x * x; if x + y % 2 == 0) yield x * y
+ for (x <- List(1, 2, 3); y = x * x; z = x * y; u <- 0 to y) yield x * y * z * u
+ }
+
} \ No newline at end of file