@@ -805,11 +805,11 @@ object PatternMatcher {
805805 */
806806 private def collectSwitchCases (scrutinee : Tree , plan : SeqPlan ): List [(List [Tree ], Plan )] = {
807807 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 )
813813
814814 val seen = mutable.Set [Any ]()
815815
@@ -859,7 +859,7 @@ object PatternMatcher {
859859 (Nil , plan) :: Nil
860860 }
861861
862- if (isSwitchableType(scrutinee.tpe.widen.widenSingletons() )) recur(plan)
862+ if (isSwitchableType(scrutinee.tpe)) recur(plan)
863863 else Nil
864864 }
865865
@@ -880,9 +880,8 @@ object PatternMatcher {
880880 */
881881
882882 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 )
886885 else (scrutinee.select(nme.toInt), defn.IntType )
887886
888887 def primLiteral (lit : Tree ): Tree =
0 commit comments