From ce563164a3e64d8a7a5ca1f49dd62377d603b5d9 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Tue, 15 Jan 2013 16:13:14 -0800 Subject: use Constant::isIntRange even if it's NIH --- src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 }} -- cgit v1.2.3