diff options
Diffstat (limited to 'tests/pos')
-rw-r--r-- | tests/pos/t2795-new.scala | 19 | ||||
-rw-r--r-- | tests/pos/t2795-old.scala | 17 | ||||
-rw-r--r-- | tests/pos/t2945.scala | 12 | ||||
-rw-r--r-- | tests/pos/tailcall/t1672.scala | 36 |
4 files changed, 84 insertions, 0 deletions
diff --git a/tests/pos/t2795-new.scala b/tests/pos/t2795-new.scala new file mode 100644 index 000000000..e307133e0 --- /dev/null +++ b/tests/pos/t2795-new.scala @@ -0,0 +1,19 @@ +package t1 + +import scala.reflect.{ClassTag, classTag} + +trait Element[T] { +} + +trait Config { + type T <: Element[T] + implicit val m: ClassTag[T] + // XXX Following works fine: + // type T <: Element[_] +} + +trait Transform { self: Config => + def processBlock(block: Array[T]): Unit = { + var X = new Array[T](1) + } +} diff --git a/tests/pos/t2795-old.scala b/tests/pos/t2795-old.scala new file mode 100644 index 000000000..935cb1f44 --- /dev/null +++ b/tests/pos/t2795-old.scala @@ -0,0 +1,17 @@ +package t1 + +trait Element[T] { +} + +trait Config { + type T <: Element[T] + implicit val m: ClassManifest[T] + // XXX Following works fine: + // type T <: Element[_] +} + +trait Transform { self: Config => + def processBlock(block: Array[T]): Unit = { + var X = new Array[T](1) + } +} diff --git a/tests/pos/t2945.scala b/tests/pos/t2945.scala new file mode 100644 index 000000000..54f0a7724 --- /dev/null +++ b/tests/pos/t2945.scala @@ -0,0 +1,12 @@ +object Foo { + def test(s: String) = { + (s: Seq[Char]) match { + case Seq('f', 'o', 'o', ' ', rest1: _*) => + rest1 + case Seq('b', 'a', 'r', ' ', ' ', rest2: _*) => + rest2 + case _ => + s + } + } +} diff --git a/tests/pos/tailcall/t1672.scala b/tests/pos/tailcall/t1672.scala new file mode 100644 index 000000000..77a86db22 --- /dev/null +++ b/tests/pos/tailcall/t1672.scala @@ -0,0 +1,36 @@ +// moved to pending. +/* Tail calls translates this program to: + +final lazy object Test1672: Test1672$ = new Test1672$() + final class Test1672$() extends Object() { this: Test1672$.type => + @tailrec def bar: (x: Int)(y: Int)Nothing = { + def tailLabel2: ($this: Test1672$.type)(x: Int)(y: Int)Nothing = { + try { + throw new scala.package.RuntimeException() + } catch { + def $anonfun: (x$1: Throwable)Nothing = + x$1 match { + case _: scala.package.Throwable => + tailLabel2($this)(x)(y) + } + closure($anonfun) + } + } + tailLabel2(Test1672$.this)(x)(y) + } + } + +Note the tail call to taillabel2 from the local method $anonfun. +LambdaLift doe snot know how to deal wioth this. +*/ + +object Test1672 { + @annotation.tailrec + def bar(x: Int)(y: Int) : Nothing = { + try { + throw new RuntimeException + } catch { + case _: Throwable => bar(x)(y) + } + } +} |