diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/RefChecks.scala | 3 | ||||
-rw-r--r-- | test/files/pos/t5897.flags | 1 | ||||
-rw-r--r-- | test/files/pos/t5897.scala | 6 |
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 () => } +} |