diff --git a/java/kotlin-extractor2/src/main/kotlin/entities/Expression.kt b/java/kotlin-extractor2/src/main/kotlin/entities/Expression.kt index fcd845e3440..5d353f86dd5 100644 --- a/java/kotlin-extractor2/src/main/kotlin/entities/Expression.kt +++ b/java/kotlin-extractor2/src/main/kotlin/entities/Expression.kt @@ -1741,9 +1741,7 @@ private fun KotlinFileExtractor.extractIf( stmtExprParent: StmtExprParent, callable: Label ): Label? { - val expressionType = ifStmt.expressionType - - if (expressionType?.isNothingType == true) { + if (!ifStmt.isUsedAsExpression) { // We're extracting this `if` as a statement val stmtParent = stmtExprParent.stmt(ifStmt, callable) val id = tw.getFreshIdLabel() @@ -1764,7 +1762,7 @@ private fun KotlinFileExtractor.extractIf( // We're extracting this `if` as a conditional expression val exprParent = stmtExprParent.expr(ifStmt, callable) val id = tw.getFreshIdLabel() - val type = useType(expressionType) + val type = useType(ifStmt.expressionType) tw.writeExprs_conditionalexpr(id, type.javaResult.id, exprParent.parent, exprParent.idx) tw.writeExprsKotlinType(id, type.kotlinResult.id)