summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon Ochsenreither <simon@ochsenreither.de>2013-06-23 13:19:03 +0200
committerSimon Ochsenreither <simon@ochsenreither.de>2013-06-26 10:20:53 +0200
commit57a644786197dd4fbf8721796ff40d744b99f1f5 (patch)
tree8784a16b7ee9330b41fc283dd9471d0ae6f77b14 /test
parentb6bc53479984f9fc0528a8ce3f6f0b582cb4147f (diff)
downloadscala-57a644786197dd4fbf8721796ff40d744b99f1f5.tar.gz
scala-57a644786197dd4fbf8721796ff40d744b99f1f5.tar.bz2
scala-57a644786197dd4fbf8721796ff40d744b99f1f5.zip
SI-7599 [Avian] Prevent TCO in test to inspect stack
This commit modifies methods in the test to be non-tail-callable to prevent Avian from eliding the stack frames we want to inspect.
Diffstat (limited to 'test')
-rw-r--r--test/files/run/t6308.scala20
1 files changed, 12 insertions, 8 deletions
diff --git a/test/files/run/t6308.scala b/test/files/run/t6308.scala
index bcd89359b0..d23cd6e13e 100644
--- a/test/files/run/t6308.scala
+++ b/test/files/run/t6308.scala
@@ -1,21 +1,25 @@
import scala.{specialized => sp}
+// NOTE: `{ val c = caller; print(""); c }` is used instead of a simple `caller`,
+// because we want to prevent tail-call optimization from eliding the stack-
+// frames we want to inspect.
+
object Test {
def caller = new Exception().getStackTrace()(1).getMethodName
- def f1[@sp(Int) A](a: A, b: Any) = caller
- def f2[@sp(Int) A, B](a: A, b: String) = caller
- def f3[B, @sp(Int) A](a: A, b: List[B]) = caller
- def f4[B, @sp(Int) A](a: A, b: List[(A, B)]) = caller
+ def f1[@sp(Int) A](a: A, b: Any) = { val c = caller; print(""); c }
+ def f2[@sp(Int) A, B](a: A, b: String) = { val c = caller; print(""); c }
+ def f3[B, @sp(Int) A](a: A, b: List[B]) = { val c = caller; print(""); c }
+ def f4[B, @sp(Int) A](a: A, b: List[(A, B)]) = { val c = caller; print(""); c }
- def f5[@sp(Int) A, B <: Object](a: A, b: B) = caller
+ def f5[@sp(Int) A, B <: Object](a: A, b: B) = { val c = caller; print(""); c }
// `uncurryTreeType` calls a TypeMap on the call to this method and we end up with new
// type parameter symbols, which are not found in `TypeEnv.includes(typeEnv(member), env)`
// in `specSym`. (One of `uncurry`'s tasks is to expand type aliases in signatures.)
type T = Object
- def todo1[@sp(Int) A, B <: T](a: A, b: String) = caller
- def todo2[@sp(Int) A, B <: AnyRef](a: A, b: String) = caller
- def todo3[B <: List[A], @specialized(Int) A](a: A, b: B) = caller
+ def todo1[@sp(Int) A, B <: T](a: A, b: String) = { val c = caller; print(""); c }
+ def todo2[@sp(Int) A, B <: AnyRef](a: A, b: String) = { val c = caller; print(""); c }
+ def todo3[B <: List[A], @specialized(Int) A](a: A, b: B) = { val c = caller; print(""); c }
def main(args: Array[String]) {
val s = ""