@@ -814,11 +814,11 @@ object PatternMatcher {
814
814
*/
815
815
private def collectSwitchCases (scrutinee : Tree , plan : SeqPlan ): List [(List [Tree ], Plan )] = {
816
816
def isSwitchableType (tpe : Type ): Boolean =
817
- (tpe isRef defn.IntClass ) ||
818
- (tpe isRef defn.ByteClass ) ||
819
- (tpe isRef defn.ShortClass ) ||
820
- (tpe isRef defn.CharClass ) ||
821
- (tpe isRef defn.StringClass )
817
+ (tpe <:< defn.IntType ) ||
818
+ (tpe <:< defn.ByteType ) ||
819
+ (tpe <:< defn.ShortType ) ||
820
+ (tpe <:< defn.CharType ) ||
821
+ (tpe <:< defn.StringType )
822
822
823
823
val seen = mutable.Set [Any ]()
824
824
@@ -868,7 +868,7 @@ object PatternMatcher {
868
868
(Nil , plan) :: Nil
869
869
}
870
870
871
- if (isSwitchableType(scrutinee.tpe.widen.widenSingletons() )) recur(plan)
871
+ if (isSwitchableType(scrutinee.tpe)) recur(plan)
872
872
else Nil
873
873
}
874
874
@@ -889,9 +889,8 @@ object PatternMatcher {
889
889
*/
890
890
891
891
val (primScrutinee, scrutineeTpe) =
892
- val tpe = scrutinee.tpe.widen.widenSingletons()
893
- if (tpe.isRef(defn.IntClass )) (scrutinee, defn.IntType )
894
- else if (tpe.isRef(defn.StringClass )) (scrutinee, defn.StringType )
892
+ if (scrutinee.tpe <:< defn.IntType ) (scrutinee, defn.IntType )
893
+ else if (scrutinee.tpe <:< defn.StringType ) (scrutinee, defn.StringType )
895
894
else (scrutinee.select(nme.toInt), defn.IntType )
896
895
897
896
def primLiteral (lit : Tree ): Tree =
0 commit comments