diff options
author | Paul Phillips <paulp@improving.org> | 2012-10-31 07:09:01 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-10-31 07:09:01 -0700 |
commit | 8aec78470637f42f50981f8034215a709602dbad (patch) | |
tree | c27ce7457fdda7514a1bf05cb27551a72b0ec1d4 /test/files/neg | |
parent | 34d021ad2021d3dbedc8b6fe20f7f0f6d1569757 (diff) | |
parent | ae0171321b94c42a36d0987503450ce2657fd516 (diff) | |
download | scala-8aec78470637f42f50981f8034215a709602dbad.tar.gz scala-8aec78470637f42f50981f8034215a709602dbad.tar.bz2 scala-8aec78470637f42f50981f8034215a709602dbad.zip |
Merge remote-tracking branch 'origin/2.10.0-wip' into merge-2.10.0-wip
# By Jason Zaugg (5) and others
# Via Josh Suereth (5) and others
* origin/2.10.0-wip:
Use Typed rather than .setType
Wider use and a new variant of typedPos.
SI-6575 Plug inference leak of AbstractPartialFun
Disabled generation of _1, _2, etc. methods.
SI-6526 Additional test case.
Fix SI-6552, regression with self types.
avoid single-art assert where harmful in duration-tck
Fix for SI-6537, inaccurate unchecked warning.
SI-6526 Tail call elimination should descend deeper.
Changes Tree and Type members from vals to defs.
Fixes SI-6170: issue with dragging scaladoc splitter over central iframe
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/t6526.check | 16 | ||||
-rw-r--r-- | test/files/neg/t6526.scala | 41 | ||||
-rw-r--r-- | test/files/neg/unchecked-knowable.check | 7 | ||||
-rw-r--r-- | test/files/neg/unchecked-knowable.scala | 4 |
4 files changed, 65 insertions, 3 deletions
diff --git a/test/files/neg/t6526.check b/test/files/neg/t6526.check new file mode 100644 index 0000000000..606c18c301 --- /dev/null +++ b/test/files/neg/t6526.check @@ -0,0 +1,16 @@ +t6526.scala:8: error: could not optimize @tailrec annotated method inner: it contains a recursive call not in tail position + @tailrec def inner(i: Int): Int = 1 + inner(i) + ^ +t6526.scala:14: error: could not optimize @tailrec annotated method inner: it contains a recursive call not in tail position + @tailrec def inner(i: Int): Int = 1 + inner(i) + ^ +t6526.scala:20: error: could not optimize @tailrec annotated method inner: it contains a recursive call not in tail position + @tailrec def inner(i: Int): Int = 1 + inner(i) + ^ +t6526.scala:30: error: could not optimize @tailrec annotated method inner: it contains a recursive call not in tail position + @tailrec def inner(i: Int): Int = 1 + inner(i) + ^ +t6526.scala:39: error: could not optimize @tailrec annotated method inner: it contains a recursive call not in tail position + def inner(i: Int): Int = 1 + inner(i) + ^ +5 errors found diff --git a/test/files/neg/t6526.scala b/test/files/neg/t6526.scala new file mode 100644 index 0000000000..0bc249aa98 --- /dev/null +++ b/test/files/neg/t6526.scala @@ -0,0 +1,41 @@ +import scala.annotation.tailrec + +class TailRec { + def bar(f: => Any) = "" + + // transform the qualifier of a Select + bar { + @tailrec def inner(i: Int): Int = 1 + inner(i) + inner(0) + }.length + + // transform the body of a function + () => { + @tailrec def inner(i: Int): Int = 1 + inner(i) + inner(0) + } + + // transform the qualifier of a Select + { + @tailrec def inner(i: Int): Int = 1 + inner(i) + inner(0) + "" + }.length + + // The receiver of a tail recursive call must itself be transformed + object X { + @tailrec // okay, all other annotated methods should fail. + def foo: Any = { + { + @tailrec def inner(i: Int): Int = 1 + inner(i) + inner(0) + this + }.foo + } + } + + Some(new AnyRef) map { phooie => + @tailrec + def inner(i: Int): Int = 1 + inner(i) + } getOrElse 42 +} diff --git a/test/files/neg/unchecked-knowable.check b/test/files/neg/unchecked-knowable.check index 3a6ef994b5..d279427327 100644 --- a/test/files/neg/unchecked-knowable.check +++ b/test/files/neg/unchecked-knowable.check @@ -1,4 +1,7 @@ -unchecked-knowable.scala:17: error: fruitless type test: a value of type Bippy cannot also be a A1 +unchecked-knowable.scala:18: error: fruitless type test: a value of type Bippy cannot also be a A1 /* warn */ (new Bippy).isInstanceOf[A1] ^ -one error found +unchecked-knowable.scala:19: error: fruitless type test: a value of type Bippy cannot also be a B1 + /* warn */ (new Bippy).isInstanceOf[B1] + ^ +two errors found diff --git a/test/files/neg/unchecked-knowable.scala b/test/files/neg/unchecked-knowable.scala index 667b47f504..21624c4fb4 100644 --- a/test/files/neg/unchecked-knowable.scala +++ b/test/files/neg/unchecked-knowable.scala @@ -7,6 +7,7 @@ final class A4 extends A2 /** Unknowable */ sealed abstract class B1 sealed abstract class B2 extends B1 +sealed trait B2B extends B1 final class B3 extends B1 trait B4 extends B2 @@ -15,6 +16,7 @@ trait Dingus class A { /* warn */ (new Bippy).isInstanceOf[A1] - /* nowarn */ (new Bippy).isInstanceOf[B1] + /* warn */ (new Bippy).isInstanceOf[B1] + /* nowarn */ (null: Dingus).isInstanceOf[B1] /* nowarn */ ((new Bippy): Any).isInstanceOf[A1] } |