summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2012-05-24 11:00:28 +0200
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-05-25 12:11:00 +0200
commitaee338da477bbe6e059f8ed3ae231e5e51128d93 (patch)
treef68a566d6e7ac411e8609a84debf1258ee04daad
parent032e8ae857f84322d90c90479d989bee2cf6a53d (diff)
downloadscala-aee338da477bbe6e059f8ed3ae231e5e51128d93.tar.gz
scala-aee338da477bbe6e059f8ed3ae231e5e51128d93.tar.bz2
scala-aee338da477bbe6e059f8ed3ae231e5e51128d93.zip
don't error when not emitting required switch
we don't handle switches with guards, whereas the old patmat did to ease the transition, let's not error out and see how we can resolve this
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala2
-rw-r--r--test/files/neg/switch.flags1
2 files changed, 2 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala b/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala
index 80d40011ad..4d66fb5617 100644
--- a/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala
@@ -1105,7 +1105,7 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL
}
emitSwitch(scrut, scrutSym, casesNoSubstOnly, pt, matchFailGenOverride).getOrElse{
- if (requireSwitch) typer.context.unit.error(scrut.pos, "could not emit switch for @switch annotated match")
+ if (requireSwitch) typer.context.unit.warning(scrut.pos, "could not emit switch for @switch annotated match")
if (casesNoSubstOnly nonEmpty) {
// before optimizing, check casesNoSubstOnly for presence of a default case,
diff --git a/test/files/neg/switch.flags b/test/files/neg/switch.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/neg/switch.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file