diff options
author | Paul Phillips <paulp@improving.org> | 2011-10-13 20:50:58 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-10-13 20:50:58 +0000 |
commit | e3b58d0c993aa4be16214ce52aea5952a9e5f877 (patch) | |
tree | aa33db4d4e14ce05867f7654eca0ca5d77cb12d7 /src/compiler | |
parent | 4f5159f0ed90598d1e5553afcce7ef2d1ff59d51 (diff) | |
download | scala-e3b58d0c993aa4be16214ce52aea5952a9e5f877.tar.gz scala-e3b58d0c993aa4be16214ce52aea5952a9e5f877.tar.bz2 scala-e3b58d0c993aa4be16214ce52aea5952a9e5f877.zip |
Adjustment to @switch.
Don't require a tableswitch if the matcher elected not to emit one
because there were so few cases. No review.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala index 809dbe7695..c25f33393a 100644 --- a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala +++ b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala @@ -407,7 +407,9 @@ abstract class ExplicitOuter extends InfoTransform if (unchecked) nselector = nselector1 - (!unchecked, isSwitchAnnotation(tpt.tpe)) + // Don't require a tableswitch if there are 1-2 casedefs + // since the matcher intentionally emits an if-then-else. + (!unchecked, isSwitchAnnotation(tpt.tpe) && ncases.size > 2) case _ => (true, false) } |