Skip to content

Commit 0ba8e23

Browse files
committed
Remove isSwitchableType any use previous solution
1 parent 00dc76d commit 0ba8e23

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -791,12 +791,6 @@ object PatternMatcher {
791791
* plan and following onSuccess plans.
792792
*/
793793
private def collectSwitchCases(plan: TestPlan): List[Plan] = {
794-
def isSwitchableType(tpe: Type): Boolean =
795-
(tpe isRef defn.IntClass) ||
796-
(tpe isRef defn.ByteClass) ||
797-
(tpe isRef defn.ShortClass) ||
798-
(tpe isRef defn.CharClass)
799-
800794
val scrutinee = plan.scrutinee
801795

802796
def isIntConst(tree: Tree) = tree match {
@@ -811,7 +805,7 @@ object PatternMatcher {
811805
case _ =>
812806
plan :: Nil
813807
}
814-
if (isSwitchableType(scrutinee.tpe)) recur(plan)
808+
if (scrutinee.tpe.widen.classSymbol ne defn.AnyClass) recur(plan)
815809
else Nil
816810
}
817811

0 commit comments

Comments
 (0)