summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSzabolcs Berecz <szabolcs.berecz@gmail.com>2012-02-19 20:50:22 +0100
committerSzabolcs Berecz <szabolcs.berecz@gmail.com>2012-02-19 21:37:46 +0100
commit5e52ce9a13f12ef159e25ac80c6be2803ec48950 (patch)
treeb32e8887c21dc3760695eb9e7f1a728f5c95f62c /test
parentcf0ae72aae43dae1e47489fceb684e5448080736 (diff)
downloadscala-5e52ce9a13f12ef159e25ac80c6be2803ec48950.tar.gz
scala-5e52ce9a13f12ef159e25ac80c6be2803ec48950.tar.bz2
scala-5e52ce9a13f12ef159e25ac80c6be2803ec48950.zip
Fix for SI-5215: scalac crash when @elidable used in trait
The elision is now done by not emitting method calls (it was done by removing the elidable methods).
Diffstat (limited to 'test')
-rw-r--r--test/files/run/elidable.check5
-rw-r--r--test/files/run/elidable.scala43
2 files changed, 46 insertions, 2 deletions
diff --git a/test/files/run/elidable.check b/test/files/run/elidable.check
index 4ce04f0040..9ce2f8c18a 100644
--- a/test/files/run/elidable.check
+++ b/test/files/run/elidable.check
@@ -1 +1,4 @@
-Good for me, I was not elided.
+Good for me, I was not elided. Test.f3
+Good for me, I was not elided. O.f3
+Good for me, I was not elided. C.f1
+Good for me, I was not elided. C.f2 \ No newline at end of file
diff --git a/test/files/run/elidable.scala b/test/files/run/elidable.scala
index 264efbad59..5015b1470b 100644
--- a/test/files/run/elidable.scala
+++ b/test/files/run/elidable.scala
@@ -1,10 +1,30 @@
import annotation._
import elidable._
+trait T {
+ @elidable(FINEST) def f1()
+ @elidable(SEVERE) def f2()
+ @elidable(FINEST) def f3() = assert(false, "Should have been elided.")
+ def f4()
+}
+
+class C extends T {
+ def f1() = println("Good for me, I was not elided. C.f1")
+ def f2() = println("Good for me, I was not elided. C.f2")
+ @elidable(FINEST) def f4() = assert(false, "Should have been elided.")
+}
+
+object O {
+ @elidable(FINEST) def f1() = assert(false, "Should have been elided.")
+ @elidable(INFO) def f2() = assert(false, "Should have been elided.")
+ @elidable(SEVERE) def f3() = println("Good for me, I was not elided. O.f3")
+ @elidable(INFO) def f4 = assert(false, "Should have been elided (no parens).")
+}
+
object Test {
@elidable(FINEST) def f1() = assert(false, "Should have been elided.")
@elidable(INFO) def f2() = assert(false, "Should have been elided.")
- @elidable(SEVERE) def f3() = println("Good for me, I was not elided.")
+ @elidable(SEVERE) def f3() = println("Good for me, I was not elided. Test.f3")
@elidable(INFO) def f4 = assert(false, "Should have been elided (no parens).")
def main(args: Array[String]): Unit = {
@@ -12,5 +32,26 @@ object Test {
f2()
f3()
f4
+ O.f1()
+ O.f2()
+ O.f3()
+ O.f4
+
+ val c = new C
+ c.f1()
+ c.f2()
+ c.f3()
+ c.f4()
+
+ // this one won't show up in the output because a call to f1 is elidable when accessed through T
+ (c:T).f1()
+
+ // Test whether the method definitions are still available.
+ List("Test", "Test$", "O", "O$", "C", "T") foreach { className =>
+ List("f1", "f2", "f3", "f4") foreach { methodName =>
+ Class.forName(className).getMethod(methodName)
+ }
+ }
+ Class.forName("T$class").getMethod("f3", classOf[T])
}
}