@@ -814,11 +814,11 @@ object PatternMatcher {
814814 */
815815 private def collectSwitchCases (scrutinee : Tree , plan : SeqPlan ): List [(List [Tree ], Plan )] = {
816816 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 )
822822
823823 val seen = mutable.Set [Any ]()
824824
@@ -868,7 +868,7 @@ object PatternMatcher {
868868 (Nil , plan) :: Nil
869869 }
870870
871- if (isSwitchableType(scrutinee.tpe.widen.widenSingletons() )) recur(plan)
871+ if (isSwitchableType(scrutinee.tpe)) recur(plan)
872872 else Nil
873873 }
874874
@@ -889,9 +889,8 @@ object PatternMatcher {
889889 */
890890
891891 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 )
895894 else (scrutinee.select(nme.toInt), defn.IntType )
896895
897896 def primLiteral (lit : Tree ): Tree =
0 commit comments