Skip to content

Commit 84bd8f1

Browse files
authored
Merge pull request #10403 from tamasvajk/kotlin-rework-cast
Kotlin: Code quality improvements: refactor a cast
2 parents 2e95e25 + 2c757c7 commit 84bd8f1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3105,13 +3105,14 @@ open class KotlinFileExtractor(
31053105
extractTypeOperatorCall(e, callable, exprParent.parent, exprParent.idx, exprParent.enclosingStmt)
31063106
}
31073107
is IrVararg -> {
3108-
if (e.elements.size != 1 || e.elements[0] !is IrSpreadElement) {
3108+
var spread = e.elements.getOrNull(0) as? IrSpreadElement
3109+
if (spread == null || e.elements.size != 1) {
31093110
logger.errorElement("Unexpected IrVararg", e)
31103111
return
31113112
}
31123113
// There are lowered IR cases when the vararg expression is not within a call, such as
31133114
// val temp0 = [*expr]
3114-
extractExpression((e.elements[0] as IrSpreadElement).expression, callable, parent)
3115+
extractExpression(spread.expression, callable, parent)
31153116
}
31163117
is IrGetObjectValue -> {
31173118
// For `object MyObject { ... }`, the .class has an

0 commit comments

Comments
 (0)