summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2012-07-24 10:13:22 +0200
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-07-24 15:28:15 +0200
commit115eede127ad96f65b5aa3943e7a2334d75c7d6b (patch)
treef019102655d8a5ce309e65fccb3455c10dcfaae0
parent0391436aa1bfd1b9fabaf9d93e8c077dbea53a38 (diff)
downloadscala-115eede127ad96f65b5aa3943e7a2334d75c7d6b.tar.gz
scala-115eede127ad96f65b5aa3943e7a2334d75c7d6b.tar.bz2
scala-115eede127ad96f65b5aa3943e7a2334d75c7d6b.zip
SI-5897 don't check sensicality in match
the pattern matching analysis should be more precise anyway (don't warn twice)
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala3
-rw-r--r--test/files/pos/t5897.flags1
-rw-r--r--test/files/pos/t5897.scala6
3 files changed, 9 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index 6912e5354f..254a2f2376 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -1541,7 +1541,8 @@ abstract class RefChecks extends InfoTransform with reflect.internal.transform.R
transform(qual)
case Apply(fn, args) =>
- checkSensible(tree.pos, fn, args)
+ // sensicality should be subsumed by the unreachability/exhaustivity/irrefutability analyses in the pattern matcher
+ if (!inPattern) checkSensible(tree.pos, fn, args)
currentApplication = tree
tree
}
diff --git a/test/files/pos/t5897.flags b/test/files/pos/t5897.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/pos/t5897.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/pos/t5897.scala b/test/files/pos/t5897.scala
new file mode 100644
index 0000000000..2e9751afe0
--- /dev/null
+++ b/test/files/pos/t5897.scala
@@ -0,0 +1,6 @@
+// no warning here
+// (strangely, if there's an unreachable code warning *anywhere in this compilation unit*,
+// the non-sensical warning goes away under -Xfatal-warnings)
+class Test {
+ () match { case () => }
+}