summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-02-10 23:13:28 +0100
committerJason Zaugg <jzaugg@gmail.com>2013-02-10 23:21:49 +0100
commit673cc83f198322b3346be2bddea7ff05bd6f0f5b (patch)
tree13bdc50189bc44d0548a01e9ba07a001dd74b45d /test
parent23b69c1e05474dc6b504d63c074629132264deaf (diff)
downloadscala-673cc83f198322b3346be2bddea7ff05bd6f0f5b.tar.gz
scala-673cc83f198322b3346be2bddea7ff05bd6f0f5b.tar.bz2
scala-673cc83f198322b3346be2bddea7ff05bd6f0f5b.zip
SI-6514 Avoid spurious dead code warnings
`deadCode.expr` stores the method symbol most recently encountered in `handleMonomorphicCall`, and uses this to avoid warnings for arguments to label jumps and `Object#synchronized` (which sneakily acts by-name without advertising the fact in its type.) But this scheme was insufficient if the argument itself contains another method call, such as `matchEnd(throw e(""))`. This commit changes the single slot to a stack, and also grants exemption to `LabelDef` trees. They were incorrectly flagged in the enclosed test case after I made the the first change.
Diffstat (limited to 'test')
-rw-r--r--test/files/pos/t6514.scala11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/files/pos/t6514.scala b/test/files/pos/t6514.scala
new file mode 100644
index 0000000000..7c58605d39
--- /dev/null
+++ b/test/files/pos/t6514.scala
@@ -0,0 +1,11 @@
+object Test {
+ def e(msg: String) = new Exception(msg)
+
+ // this code ain't dead.
+ def a(b: Boolean) = {
+ b match {
+ case true => throw e("true")
+ case false => throw e("false")
+ }
+ }
+}