aboutsummaryrefslogtreecommitdiff
path: root/tests/pos/desugar.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-12-08 19:20:23 +0100
committerMartin Odersky <odersky@gmail.com>2013-12-08 19:20:23 +0100
commit6212e472f892a78ab98e7978ad043acbe942d7f2 (patch)
tree8cfe0950fb4c19b69dae723bd6bbfeb22006dae8 /tests/pos/desugar.scala
parent2edbc4f04325cb248b34d0b82b9c09dd591f553d (diff)
downloaddotty-6212e472f892a78ab98e7978ad043acbe942d7f2.tar.gz
dotty-6212e472f892a78ab98e7978ad043acbe942d7f2.tar.bz2
dotty-6212e472f892a78ab98e7978ad043acbe942d7f2.zip
Last fixes to desugar.
Diffstat (limited to 'tests/pos/desugar.scala')
-rw-r--r--tests/pos/desugar.scala28
1 files changed, 27 insertions, 1 deletions
diff --git a/tests/pos/desugar.scala b/tests/pos/desugar.scala
index 69e8c8651..cfd695af6 100644
--- a/tests/pos/desugar.scala
+++ b/tests/pos/desugar.scala
@@ -1,8 +1,9 @@
object desugar {
-
+
// variables
var x: Int = 2
var y = x * x
+ val list = List(1, 2, 3)
{ var z: Int = y }
@@ -44,6 +45,8 @@ object desugar {
x :: y :: Nil
+ val x :: y :: Nil = list
+
}
object fors {
@@ -54,6 +57,29 @@ object desugar {
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
+
+ for (x <- List(1, 2, 3)) println(x)
+ for (x <- List(1, 2, 3) if x % 2 == 0) println(x * x)
+ for (x <- List(1, 2, 3); y <- 0 to x) println(x * y)
+ for (x <- List(1, 2, 3); y <- 0 to x; if x + y % 2 == 0) println(x * y)
+ for (x <- List(1, 2, 3); y = x * x; if x + y % 2 == 0) println(x * y)
+ for (x <- List(1, 2, 3); y = x * x; z = x * y; u <- 0 to y) println(x * y * z * u)
+ }
+
+ object misc {
+ 'hello
+ s"this is a $x + ${x + y} string"
+ type ~ = Tuple2
+ val pair: Int ~ String = 1 -> "abc"
+ def foo(xs: Int*) = xs.length
+ foo(list: _*)
+ println(list: _*)
+ (list length)
+ - desugar.x
+ def bar(x: => Int) = x
+ (x + y) + 1
+ while (x < 10) x += 1
+ do x -= 1 while (x > 0)
}
} \ No newline at end of file