aboutsummaryrefslogtreecommitdiff
path: root/tests/pos/desugar.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-08-13 11:31:39 +0200
committerMartin Odersky <odersky@gmail.com>2014-08-13 12:05:05 +0200
commit34f73ded3519a1df7d278685f3f33facd00f1c58 (patch)
tree3cf71a8baea0de46c9ca126a1ea2dbd6ea55c731 /tests/pos/desugar.scala
parent3558e07b8f3a604bfd67c721cdec3eb9db29e7eb (diff)
downloaddotty-34f73ded3519a1df7d278685f3f33facd00f1c58.tar.gz
dotty-34f73ded3519a1df7d278685f3f33facd00f1c58.tar.bz2
dotty-34f73ded3519a1df7d278685f3f33facd00f1c58.zip
Fix and enable RefChecks
RefChecks is now enabled. Some of the tests had to be fixed to be refchecks-correct.
Diffstat (limited to 'tests/pos/desugar.scala')
-rw-r--r--tests/pos/desugar.scala37
1 files changed, 20 insertions, 17 deletions
diff --git a/tests/pos/desugar.scala b/tests/pos/desugar.scala
index f0d8645b7..0d3b6d8ca 100644
--- a/tests/pos/desugar.scala
+++ b/tests/pos/desugar.scala
@@ -6,11 +6,11 @@ object desugar {
val list = List(1, 2, 3)
{ var z: Int = y }
-
+
def foo0(first: Int, second: Int = 2, third: Int = 3) = first + second
def foo1(first: Int, second: Int = 2)(third: Int = 3) = first + second
def foo2(first: Int)(second: Int = 2)(third: Int = 3) = first + second
-
+
object caseClasses { self =>
trait List[+T] {
def head: T
@@ -23,34 +23,37 @@ object desugar {
def apply[T](head: T): Cons[T] = apply(head, Nil)
}
- case object Nil extends List[Nothing]
+ case object Nil extends List[Nothing] {
+ def head = throw new Error()
+ def tail = throw new Error()
+ }
}
-
+
object patDefs {
-
+
import caseClasses._
val xs: List[Int] = Cons(1, Cons(2, Nil))
-
- val Cons(y, ys) = xs
+
+ val Cons(y, ys) = xs
val Cons(z, _) = xs
val Cons(_, _) = xs
-
+
val (cons: Cons[Int]) = xs
-
+
val x1, y1, z1: Int = 1
}
-
+
object Binops {
-
+
x :: y :: Nil
-
+
val x :: y :: Nil = list
-
+
}
-
+
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
@@ -65,7 +68,7 @@ object desugar {
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"
@@ -82,4 +85,4 @@ object desugar {
do x -= 1 while (x > 0)
}
-} \ No newline at end of file
+}