aboutsummaryrefslogtreecommitdiff
path: root/tests/neg/tailcall
diff options
context:
space:
mode:
authorvsalvis <salvisbergvera@gmail.com>2015-07-10 17:01:35 +0200
committerVladimirNik <vladimir.nikolaev9@gmail.com>2016-02-18 17:54:45 +0100
commit1ed38673d4c88d573363459d316fdfe275d05025 (patch)
tree6ae87391dab765853b97c81dfa4f05bbba2e527b /tests/neg/tailcall
parent4be70a5a8469c1355c84bef70936a81f899a9678 (diff)
downloaddotty-1ed38673d4c88d573363459d316fdfe275d05025.tar.gz
dotty-1ed38673d4c88d573363459d316fdfe275d05025.tar.bz2
dotty-1ed38673d4c88d573363459d316fdfe275d05025.zip
Negtests with // error comments
Diffstat (limited to 'tests/neg/tailcall')
-rw-r--r--tests/neg/tailcall/t1672b.scala12
-rw-r--r--tests/neg/tailcall/t3275.scala2
-rw-r--r--tests/neg/tailcall/t6574.scala4
-rw-r--r--tests/neg/tailcall/tailrec-2.scala2
-rw-r--r--tests/neg/tailcall/tailrec-3.scala4
-rw-r--r--tests/neg/tailcall/tailrec.scala12
6 files changed, 18 insertions, 18 deletions
diff --git a/tests/neg/tailcall/t1672b.scala b/tests/neg/tailcall/t1672b.scala
index f05d05c34..2c2ec9b41 100644
--- a/tests/neg/tailcall/t1672b.scala
+++ b/tests/neg/tailcall/t1672b.scala
@@ -1,6 +1,6 @@
object Test1772B {
@annotation.tailrec
- def bar : Nothing = {
+ def bar : Nothing = { // error
try {
throw new RuntimeException
} catch {
@@ -11,7 +11,7 @@ object Test1772B {
}
@annotation.tailrec
- def baz : Nothing = {
+ def baz : Nothing = { // error
try {
throw new RuntimeException
} catch {
@@ -22,7 +22,7 @@ object Test1772B {
}
@annotation.tailrec
- def boz : Nothing = {
+ def boz : Nothing = { // error
try {
throw new RuntimeException
} catch {
@@ -31,7 +31,7 @@ object Test1772B {
}
@annotation.tailrec
- def bez : Nothing = {
+ def bez : Nothing = { // error
try {
bez
} finally {
@@ -41,12 +41,12 @@ object Test1772B {
// the `liftedTree` local method will prevent a tail call here.
@annotation.tailrec
- def bar(i : Int) : Int = {
+ def bar(i : Int) : Int = { // error
if (i == 0) 0
else 1 + (try {
throw new RuntimeException
} catch {
- case _: Throwable => bar(i - 1)
+ case _: Throwable => bar(i - 1) // error
})
}
}
diff --git a/tests/neg/tailcall/t3275.scala b/tests/neg/tailcall/t3275.scala
index 18e38a1a9..df6155035 100644
--- a/tests/neg/tailcall/t3275.scala
+++ b/tests/neg/tailcall/t3275.scala
@@ -1,3 +1,3 @@
object Test {
- @annotation.tailrec def foo() = 5
+ @annotation.tailrec def foo() = 5 // error
}
diff --git a/tests/neg/tailcall/t6574.scala b/tests/neg/tailcall/t6574.scala
index e81c8cd07..7030b3b4a 100644
--- a/tests/neg/tailcall/t6574.scala
+++ b/tests/neg/tailcall/t6574.scala
@@ -1,6 +1,6 @@
class Bad[X, Y](val v: Int) extends AnyVal {
- @annotation.tailrec final def notTailPos[Z](a: Int)(b: String): Unit = {
- this.notTailPos[Z](a)(b)
+ @annotation.tailrec final def notTailPos[Z](a: Int)(b: String): Unit = { // error
+ this.notTailPos[Z](a)(b) // error
println("tail")
}
diff --git a/tests/neg/tailcall/tailrec-2.scala b/tests/neg/tailcall/tailrec-2.scala
index bc594293d..b5edab4c7 100644
--- a/tests/neg/tailcall/tailrec-2.scala
+++ b/tests/neg/tailcall/tailrec-2.scala
@@ -13,7 +13,7 @@ class Bop2[+A](val element: A) extends Super[A] {
@annotation.tailrec final def f[B >: A](mem: List[B]): List[B] = (null: Bop2[A]).f(mem)
}
object Bop3 extends Super[Nothing] {
- @annotation.tailrec final def f[B](mem: List[B]): List[B] = (???: Bop3.type).f(mem)
+ @annotation.tailrec final def f[B](mem: List[B]): List[B] = (???: Bop3.type).f(mem) // error // error
}
class Bop4[+A](val element: A) extends Super[A] {
@annotation.tailrec final def f[B >: A](mem: List[B]): List[B] = Other.f[A].f(mem)
diff --git a/tests/neg/tailcall/tailrec-3.scala b/tests/neg/tailcall/tailrec-3.scala
index 20361658e..b0c560615 100644
--- a/tests/neg/tailcall/tailrec-3.scala
+++ b/tests/neg/tailcall/tailrec-3.scala
@@ -1,9 +1,9 @@
import annotation.tailrec
object Test {
- @tailrec private def quux(xs: List[String]): List[String] = quux(quux(xs))
+ @tailrec private def quux(xs: List[String]): List[String] = quux(quux(xs)) // error
@tailrec private def quux2(xs: List[String]): List[String] = xs match {
- case x1 :: x2 :: rest => quux2(x1 :: quux2(rest))
+ case x1 :: x2 :: rest => quux2(x1 :: quux2(rest)) // error
case _ => Nil
}
@tailrec private def quux3(xs: List[String]): Boolean = xs match {
diff --git a/tests/neg/tailcall/tailrec.scala b/tests/neg/tailcall/tailrec.scala
index 83a0c1a9e..49d71ce13 100644
--- a/tests/neg/tailcall/tailrec.scala
+++ b/tests/neg/tailcall/tailrec.scala
@@ -40,19 +40,19 @@ class Winners {
object Failures {
@tailrec
- def facfail(n: Int): Int =
+ def facfail(n: Int): Int = // error
if (n == 0) 1
- else n * facfail(n - 1)
+ else n * facfail(n - 1) // error
}
class Failures {
// not private, not final
- @tailrec def fail1(x: Int): Int = fail1(x)
+ @tailrec def fail1(x: Int): Int = fail1(x) // error
// a typical between-chair-and-keyboard error
- @tailrec final def fail2[T](xs: List[T]): List[T] = xs match {
+ @tailrec final def fail2[T](xs: List[T]): List[T] = xs match { // error
case Nil => Nil
- case x :: xs => x :: fail2[T](xs)
+ case x :: xs => x :: fail2[T](xs) // error
}
// unsafe
@@ -60,6 +60,6 @@ class Failures {
// unsafe
class Tom[T](x: Int) {
- @tailrec final def fail4[U](other: Tom[U], x: Int): Int = other.fail4[U](other, x - 1)
+ @tailrec final def fail4[U](other: Tom[U], x: Int): Int = other.fail4[U](other, x - 1) // error // error
}
}