From 39aefb8d176b4a2d9e224f86b91068fe56189739 Mon Sep 17 00:00:00 2001 From: Tamas Vajk Date: Tue, 19 Nov 2024 18:06:35 +0100 Subject: [PATCH] Fix code review finding --- .../src/main/kotlin/entities/Expression.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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)