diff --git a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirExpressionBuilder.kt b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirExpressionBuilder.kt index f62c31a7110..608616ffe01 100644 --- a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirExpressionBuilder.kt +++ b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirExpressionBuilder.kt @@ -1339,7 +1339,7 @@ class LightTreeRawFirExpressionBuilder( with(components) { val trueBranch = convertLoopBody(thenBlock) branches += buildWhenBranch { - source = thenBlock?.toFirSourceElement() + source = firCondition?.source condition = firCondition ?: buildErrorExpression( null, ConeSyntaxDiagnostic("If statement should have condition") diff --git a/compiler/testData/ir/sourceRanges/this.fir.txt b/compiler/testData/ir/sourceRanges/this.fir.txt index 3d0d06fed35..1147e5e9abc 100644 --- a/compiler/testData/ir/sourceRanges/this.fir.txt +++ b/compiler/testData/ir/sourceRanges/this.fir.txt @@ -8,7 +8,7 @@ @3:4..46 FIELD PROPERTY_BACKING_FIELD name:maybeThis type:.Klass? visibility:private [final] @3:20..46 EXPRESSION_BODY @3:20..46 WHEN type=.Klass? origin=IF - @3:32..36 BRANCH + @3:24..30 BRANCH @3:24..30 CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ @3:24..25 CONST Int type=kotlin.Int value=1 @3:29..30 CONST Int type=kotlin.Int value=1