diff options
Diffstat (limited to 'tests/pos')
-rw-r--r-- | tests/pos/ostermann.scala | 3 | ||||
-rw-r--r-- | tests/pos/t0301.scala | 12 | ||||
-rw-r--r-- | tests/pos/t0304.scala | 5 | ||||
-rw-r--r-- | tests/pos/t0305.scala | 7 | ||||
-rw-r--r-- | tests/pos/t0453.scala | 6 | ||||
-rw-r--r-- | tests/pos/t0586.scala | 9 | ||||
-rw-r--r-- | tests/pos/t0599.scala | 18 | ||||
-rw-r--r-- | tests/pos/t0644.scala | 12 | ||||
-rw-r--r-- | tests/pos/t0674.scala | 48 |
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) +} |