diff --git a/compiler/fir/lightTree/src/org/jetbrains/kotlin/fir/lightTree/converter/ExpressionsConverter.kt b/compiler/fir/lightTree/src/org/jetbrains/kotlin/fir/lightTree/converter/ExpressionsConverter.kt index d6ae927a30c..60885e50fd5 100644 --- a/compiler/fir/lightTree/src/org/jetbrains/kotlin/fir/lightTree/converter/ExpressionsConverter.kt +++ b/compiler/fir/lightTree/src/org/jetbrains/kotlin/fir/lightTree/converter/ExpressionsConverter.kt @@ -611,8 +611,8 @@ class ExpressionsConverter( var isNegate = false var firExpression: FirExpression = FirErrorExpressionImpl(null, FirSimpleDiagnostic("No range in condition with range", DiagnosticKind.Syntax)) whenCondition.forEachChildren { - when (it.tokenType) { - NOT_IN -> isNegate = true + when { + it.tokenType == OPERATION_REFERENCE && it.asText == NOT_IN.value -> isNegate = true else -> if (it.isExpression()) firExpression = getAsFirExpression(it) } } diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtWhenConditionInRange.java b/compiler/psi/src/org/jetbrains/kotlin/psi/KtWhenConditionInRange.java index 5294bd2648a..330fa6250a9 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtWhenConditionInRange.java +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/KtWhenConditionInRange.java @@ -29,7 +29,7 @@ public class KtWhenConditionInRange extends KtWhenCondition { } public boolean isNegated() { - return getNode().findChildByType(KtTokens.NOT_IN) != null; + return getOperationReference().getNode().findChildByType(KtTokens.NOT_IN) != null; } @Nullable @IfNotParsed diff --git a/compiler/testData/codegen/box/primitiveTypes/kt4097.kt b/compiler/testData/codegen/box/primitiveTypes/kt4097.kt index 97a2a1cf423..04cc01c3f3a 100644 --- a/compiler/testData/codegen/box/primitiveTypes/kt4097.kt +++ b/compiler/testData/codegen/box/primitiveTypes/kt4097.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR fun box(): String { val shouldBeTrue = 555555555555555555L in 123456789123456789L..987654321987654321L if (!shouldBeTrue) return "Fail 1" diff --git a/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.fir.txt b/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.fir.txt index 16d994dde11..8df16ea7445 100644 --- a/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.fir.txt +++ b/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.fir.txt @@ -29,8 +29,7 @@ FILE fqName: fileName:/whenWithSubjectVariable.kt GET_VAR 'val y: kotlin.Any [val] declared in .test' type=kotlin.Any origin=null then: CONST Int type=kotlin.Int value=3 BRANCH - if: ERROR_CALL 'Unresolved reference: #' type=IrErrorType - GET_VAR 'val y: kotlin.Any [val] declared in .test' type=kotlin.Any origin=null + if: ERROR_CALL 'Unresolved reference: #' type=IrErrorType then: CONST Int type=kotlin.Int value=4 BRANCH if: CONST Boolean type=kotlin.Boolean value=true diff --git a/idea/testData/codeInsight/breadcrumbs/When.txt b/idea/testData/codeInsight/breadcrumbs/When.txt index 0015ae3d4e2..e44bcde942f 100644 --- a/idea/testData/codeInsight/breadcrumbs/When.txt +++ b/idea/testData/codeInsight/breadcrumbs/When.txt @@ -11,7 +11,7 @@ Crumbs: when (xxx) …num.SomeLongValue -> when (yyy) - in Int.MIN_VALUE..… -> + !in Int.MIN_VALUE..… -> when (zzz) is A,… -> when (x1) @@ -31,7 +31,7 @@ Tooltips: when (xxx) SomeEnum.SomeLongValue -> when (yyy) - in Int.MIN_VALUE..Int.MAX_VALUE -> + !in Int.MIN_VALUE..Int.MAX_VALUE -> when (zzz) is A,… -> when (x1)