From fd81127c6255d01237dd98e8296abf6fdfe80741 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 7 Oct 2014 14:23:38 +0200 Subject: New tests --- tests/pending/pos/annot.scala | 5 +++++ tests/pending/pos/t1672.scala | 36 ++++++++++++++++++++++++++++++++++ tests/pending/pos/vararg-pattern.scala | 12 ++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 tests/pending/pos/annot.scala create mode 100644 tests/pending/pos/t1672.scala create mode 100644 tests/pending/pos/vararg-pattern.scala (limited to 'tests/pending/pos') diff --git a/tests/pending/pos/annot.scala b/tests/pending/pos/annot.scala new file mode 100644 index 000000000..8e21803b4 --- /dev/null +++ b/tests/pending/pos/annot.scala @@ -0,0 +1,5 @@ +class Test { + + @SuppressWarnings("hi") def foo() = ??? + +} diff --git a/tests/pending/pos/t1672.scala b/tests/pending/pos/t1672.scala new file mode 100644 index 000000000..77a86db22 --- /dev/null +++ b/tests/pending/pos/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) + } + } +} diff --git a/tests/pending/pos/vararg-pattern.scala b/tests/pending/pos/vararg-pattern.scala new file mode 100644 index 000000000..314d6460f --- /dev/null +++ b/tests/pending/pos/vararg-pattern.scala @@ -0,0 +1,12 @@ +object Test { + + List(1, 2, 3, 4) match { + case List(1, 2, xs: _*) => + val ys: Seq[Int] = xs + println(ys) + } + val List(1, 2, x: _*) = List(1, 2, 3, 4) + +} + + -- cgit v1.2.3