summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2013-01-15 16:13:14 -0800
committerAdriaan Moors <adriaan.moors@typesafe.com>2013-01-15 16:13:14 -0800
commitce563164a3e64d8a7a5ca1f49dd62377d603b5d9 (patch)
tree5ea1b704fd287067fdff2eeb7db30c6bf79dd709
parenta6b34b60feaea763fd5a056eb55f25aa1f57988a (diff)
downloadscala-ce563164a3e64d8a7a5ca1f49dd62377d603b5d9.tar.gz
scala-ce563164a3e64d8a7a5ca1f49dd62377d603b5d9.tar.bz2
scala-ce563164a3e64d8a7a5ca1f49dd62377d603b5d9.zip
use Constant::isIntRange even if it's NIH
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala b/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala
index 454d9210ff..f1c70f46d8 100644
--- a/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala
@@ -3497,7 +3497,7 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL
// Constant folding sets the type of a constant tree to `ConstantType(Constant(folded))`
// The tree itself can be a literal, an ident, a selection, ...
object SwitchablePattern { def unapply(pat: Tree): Option[Tree] = pat.tpe match {
- case ConstantType(const@Constant((_: Byte ) | (_: Short) | (_: Int ) | (_: Char ))) =>
+ case ConstantType(const) if const.isIntRange =>
Some(Literal(Constant(const.intValue))) // TODO: Java 7 allows strings in switches
case _ => None
}}