summaryrefslogtreecommitdiff
path: root/test/files/neg
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2012-02-21 12:01:27 -0800
committerSom Snytt <som.snytt@gmail.com>2012-02-21 12:01:27 -0800
commitf26a47c4e8bda2f6c689b4e9b0bb5c64ccf4c699 (patch)
tree1b2bfc54bb5afed46813021fc00cb5b911215fbb /test/files/neg
parentfbb7865e137e83660257fdc79d19d29ff39c775b (diff)
downloadscala-f26a47c4e8bda2f6c689b4e9b0bb5c64ccf4c699.tar.gz
scala-f26a47c4e8bda2f6c689b4e9b0bb5c64ccf4c699.tar.bz2
scala-f26a47c4e8bda2f6c689b4e9b0bb5c64ccf4c699.zip
Disallow eliding when Nothing is expected
Diffstat (limited to 'test/files/neg')
-rw-r--r--test/files/neg/elide-to-nothing.check4
-rw-r--r--test/files/neg/elide-to-nothing.flags1
-rw-r--r--test/files/neg/elide-to-nothing.scala31
3 files changed, 36 insertions, 0 deletions
diff --git a/test/files/neg/elide-to-nothing.check b/test/files/neg/elide-to-nothing.check
new file mode 100644
index 0000000000..3ef05aac9a
--- /dev/null
+++ b/test/files/neg/elide-to-nothing.check
@@ -0,0 +1,4 @@
+elide-to-nothing.scala:14: error: Cannot elide where Nothing is required.
+ val b: Nothing = unimplemented()
+ ^
+one error found
diff --git a/test/files/neg/elide-to-nothing.flags b/test/files/neg/elide-to-nothing.flags
new file mode 100644
index 0000000000..59a512e547
--- /dev/null
+++ b/test/files/neg/elide-to-nothing.flags
@@ -0,0 +1 @@
+-Xelide-below 500
diff --git a/test/files/neg/elide-to-nothing.scala b/test/files/neg/elide-to-nothing.scala
new file mode 100644
index 0000000000..5008e8bc1d
--- /dev/null
+++ b/test/files/neg/elide-to-nothing.scala
@@ -0,0 +1,31 @@
+
+/** Test which should fail compilation */
+class ElysianFailed {
+
+ import ElysianField._
+
+ // fine
+ val a: Int = myInt
+
+ // fine
+ unimplemented()
+
+ // not fine
+ val b: Nothing = unimplemented()
+
+}
+
+object ElysianField {
+
+ import annotation.elidable
+
+ @elidable(100) def unimplemented(): Nothing = throw new UnsupportedOperationException
+
+ @elidable(100) def myInt: Int = 17
+
+}
+
+
+
+
+