@@ -805,11 +805,11 @@ object PatternMatcher {
805
805
*/
806
806
private def collectSwitchCases (scrutinee : Tree , plan : SeqPlan ): List [(List [Tree ], Plan )] = {
807
807
def isSwitchableType (tpe : Type ): Boolean =
808
- (tpe isRef defn.IntClass ) ||
809
- (tpe isRef defn.ByteClass ) ||
810
- (tpe isRef defn.ShortClass ) ||
811
- (tpe isRef defn.CharClass ) ||
812
- (tpe isRef defn.StringClass )
808
+ (tpe <:< defn.IntType ) ||
809
+ (tpe <:< defn.ByteType ) ||
810
+ (tpe <:< defn.ShortType ) ||
811
+ (tpe <:< defn.CharType ) ||
812
+ (tpe <:< defn.StringType )
813
813
814
814
val seen = mutable.Set [Any ]()
815
815
@@ -859,7 +859,7 @@ object PatternMatcher {
859
859
(Nil , plan) :: Nil
860
860
}
861
861
862
- if (isSwitchableType(scrutinee.tpe.widen.widenSingletons() )) recur(plan)
862
+ if (isSwitchableType(scrutinee.tpe)) recur(plan)
863
863
else Nil
864
864
}
865
865
@@ -880,9 +880,8 @@ object PatternMatcher {
880
880
*/
881
881
882
882
val (primScrutinee, scrutineeTpe) =
883
- val tpe = scrutinee.tpe.widen.widenSingletons()
884
- if (tpe.isRef(defn.IntClass )) (scrutinee, defn.IntType )
885
- else if (tpe.isRef(defn.StringClass )) (scrutinee, defn.StringType )
883
+ if (scrutinee.tpe <:< defn.IntType ) (scrutinee, defn.IntType )
884
+ else if (scrutinee.tpe <:< defn.StringType ) (scrutinee, defn.StringType )
886
885
else (scrutinee.select(nme.toInt), defn.IntType )
887
886
888
887
def primLiteral (lit : Tree ): Tree =
0 commit comments