summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2015-05-05 13:52:22 -0700
committerSom Snytt <som.snytt@gmail.com>2015-05-05 13:52:22 -0700
commit92f69d253ee6e941263aaf0a09936b4e4ce21dc7 (patch)
tree391dcd89001d0a8d7eb1d862c8e558487483f828 /test
parent8200009ea5dafcdf79488f19175c53e7b571aa75 (diff)
downloadscala-92f69d253ee6e941263aaf0a09936b4e4ce21dc7.tar.gz
scala-92f69d253ee6e941263aaf0a09936b4e4ce21dc7.tar.bz2
scala-92f69d253ee6e941263aaf0a09936b4e4ce21dc7.zip
SI-9302 -Xdisable-assertions raises elide level
Previously, the flag caused any elidable to be elided. This commit simply sets -Xelide-below to ASSERTION + 1. The flag is useful because there's no mnemonic for specifying the magic constant as an option argument. `-Xelide-below ASSERTION` means asserts are enabled.
Diffstat (limited to 'test')
-rw-r--r--test/files/run/disable-assertions.flags1
-rw-r--r--test/files/run/disable-assertions.scala14
2 files changed, 15 insertions, 0 deletions
diff --git a/test/files/run/disable-assertions.flags b/test/files/run/disable-assertions.flags
new file mode 100644
index 0000000000..afaa521a12
--- /dev/null
+++ b/test/files/run/disable-assertions.flags
@@ -0,0 +1 @@
+-Xdisable-assertions
diff --git a/test/files/run/disable-assertions.scala b/test/files/run/disable-assertions.scala
new file mode 100644
index 0000000000..7ec4cfb495
--- /dev/null
+++ b/test/files/run/disable-assertions.scala
@@ -0,0 +1,14 @@
+
+object Elided {
+ import annotation._, elidable._
+ @elidable(INFO) def info(): Boolean = true
+ @elidable(10000) def f(): Boolean = true
+ def g(): Boolean = { assert(false); true }
+}
+
+object Test extends App {
+ import Elided._
+ if (info()) println("Bad info.")
+ if (!f()) println("Elided f.")
+ if (!g()) println("Elided g?") // assert should be off
+}