Skip to content

Commit acc2b6c

Browse files
committed
Address review: code refactoring
1 parent 3eb509b commit acc2b6c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,11 @@ object TypeTestsCasts {
238238
constant(expr, Literal(Constant(false)))
239239
}
240240
else if (testCls.isPrimitiveValueClass)
241-
if (foundClsSyms.size == 1 && foundClsSyms.head.isPrimitiveValueClass)
242-
constant(expr, Literal(Constant(foundClsSyms.head == testCls)))
243-
else
244-
transformIsInstanceOf(expr, defn.boxedType(testCls.typeRef), flagUnrelated)
241+
foundClsSyms match
242+
case List(cls) if cls.isPrimitiveValueClass =>
243+
constant(expr, Literal(Constant(foundClsSyms.head == testCls)))
244+
case _ =>
245+
transformIsInstanceOf(expr, defn.boxedType(testCls.typeRef), flagUnrelated)
245246
else
246247
derivedTree(expr, defn.Any_isInstanceOf, testType)
247248
}

0 commit comments

Comments
 (0)