aboutsummaryrefslogtreecommitdiff
path: root/tests/pos
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-03-16 18:39:36 +0100
committerTobias Schlatter <tobias@meisch.ch>2014-03-21 11:24:03 +0100
commit6436fa67e561442ef2e2d9b99852a50f323ccacc (patch)
tree9063ea5a0df1f01fb69ef64dcf0ef638e63f54e2 /tests/pos
parent6f1ef32d728320c31cc59daad0f4849c9cd0a87c (diff)
downloaddotty-6436fa67e561442ef2e2d9b99852a50f323ccacc.tar.gz
dotty-6436fa67e561442ef2e2d9b99852a50f323ccacc.tar.bz2
dotty-6436fa67e561442ef2e2d9b99852a50f323ccacc.zip
More tests
Added more tests which all pass, except for tests in disabled and pending. t0694 went from pos to neg, because the kind of alias type used in t0695 is no longer supported.
Diffstat (limited to 'tests/pos')
-rw-r--r--tests/pos/ostermann.scala3
-rw-r--r--tests/pos/t0301.scala12
-rw-r--r--tests/pos/t0304.scala5
-rw-r--r--tests/pos/t0305.scala7
-rw-r--r--tests/pos/t0453.scala6
-rw-r--r--tests/pos/t0586.scala9
-rw-r--r--tests/pos/t0599.scala18
-rw-r--r--tests/pos/t0644.scala12
-rw-r--r--tests/pos/t0674.scala48
9 files changed, 120 insertions, 0 deletions
diff --git a/tests/pos/ostermann.scala b/tests/pos/ostermann.scala
new file mode 100644
index 000000000..f3acafc72
--- /dev/null
+++ b/tests/pos/ostermann.scala
@@ -0,0 +1,3 @@
+trait A { def foo(a: A) : Unit }
+
+trait C extends A { override def foo(a: A with Any) : Unit }
diff --git a/tests/pos/t0301.scala b/tests/pos/t0301.scala
new file mode 100644
index 000000000..24b477601
--- /dev/null
+++ b/tests/pos/t0301.scala
@@ -0,0 +1,12 @@
+package fos
+
+abstract class Expr
+case class Var() extends Expr
+
+object Analyzer {
+ def substitution(expr: Expr, cls: (Var,Var)): Expr =
+ expr match {
+ case cls._2 => cls._1 // source of the error
+ case _ => expr
+ }
+}
diff --git a/tests/pos/t0304.scala b/tests/pos/t0304.scala
new file mode 100644
index 000000000..607a115db
--- /dev/null
+++ b/tests/pos/t0304.scala
@@ -0,0 +1,5 @@
+object O {
+ def f1 = -1;
+ def f2 = 0-1;
+ def f3 = f1 + f2;
+}
diff --git a/tests/pos/t0305.scala b/tests/pos/t0305.scala
new file mode 100644
index 000000000..4838b1fcf
--- /dev/null
+++ b/tests/pos/t0305.scala
@@ -0,0 +1,7 @@
+object Test extends App {
+
+ def foo(is:Int*) = 1;
+ def foo(i:Int) = 2;
+
+ assert(foo( List(3):_* ) == 1)
+}
diff --git a/tests/pos/t0453.scala b/tests/pos/t0453.scala
new file mode 100644
index 000000000..dfacc5eed
--- /dev/null
+++ b/tests/pos/t0453.scala
@@ -0,0 +1,6 @@
+object Test {
+ val foo = new {
+ trait Bar
+ def l () : Bar = { new Bar {} }
+ }
+}
diff --git a/tests/pos/t0586.scala b/tests/pos/t0586.scala
new file mode 100644
index 000000000..540e225a1
--- /dev/null
+++ b/tests/pos/t0586.scala
@@ -0,0 +1,9 @@
+object RClose {
+ type ReflectCloseable = { def close(): Unit }
+ def withReflectCloseable[T <: ReflectCloseable, R](s: T)(action: T => R): R =
+ try {
+ action(s)
+ } finally {
+ s.close()
+ }
+}
diff --git a/tests/pos/t0599.scala b/tests/pos/t0599.scala
new file mode 100644
index 000000000..885159af6
--- /dev/null
+++ b/tests/pos/t0599.scala
@@ -0,0 +1,18 @@
+abstract class FooA {
+ type A <: Ax;
+ abstract class Ax;
+ abstract class InnerA {
+ type B <: A;
+ def doB : B;
+ }
+ }
+ trait FooB extends FooA {
+ type A <: Ax;
+ trait Ax extends super.Ax { def xxx : Int; }
+ abstract class InnerB extends InnerA {
+ // type B <: A;
+ val a : A = doB;
+ a.xxx;
+ doB.xxx;
+ }
+ }
diff --git a/tests/pos/t0644.scala b/tests/pos/t0644.scala
new file mode 100644
index 000000000..e51ec7df5
--- /dev/null
+++ b/tests/pos/t0644.scala
@@ -0,0 +1,12 @@
+class A {
+ def apply(): Int = 0
+ def update(n: Int): Unit = {}
+}
+
+class B extends A {
+ this()
+ this()=1
+ // 644 is wontfix so this is what should work.
+ super.apply()
+ super.update(1)
+}
diff --git a/tests/pos/t0674.scala b/tests/pos/t0674.scala
new file mode 100644
index 000000000..589eeec9f
--- /dev/null
+++ b/tests/pos/t0674.scala
@@ -0,0 +1,48 @@
+object Test extends App {
+println(
+for(a <- Some(1);
+ b <- Some(2);
+ c <- Some(3);
+ d <- Some(4);
+ e <- Some(5);
+ f <- Some(6);
+ g <- Some(7);
+ h <- Some(8);
+ i <- Some(9);
+ j <- Some(10);
+ k <- Some(11);
+ l <- Some(12);
+ m <- Some(13);
+ n <- Some(14);
+ o <- Some(15);
+ p <- Some(16);
+ q <- Some(17);
+ r <- Some(18);
+ s <- Some(19);
+ d <- Some(4);
+ e <- Some(5);
+ f <- Some(6);
+ g <- Some(7);
+ h <- Some(8);
+ i <- Some(9);
+ j <- Some(10);
+ k <- Some(11);
+ l <- Some(12);
+ m <- Some(13);
+ n <- Some(14);
+ o <- Some(15);
+ p <- Some(16);
+ q <- Some(17);
+ r <- Some(18);
+ s <- Some(19);
+ k <- Some(11);
+ l <- Some(12);
+ m <- Some(13);
+ n <- Some(14);
+ o <- Some(15)
+// p <- Some(16);
+// q <- Some(17)
+// r <- Some(18);
+// s <- Some(19)
+ ) yield a)
+}