Fix isNegated psi method in KtWhenConditionInRange
^KT-34395 Fixed
This commit is contained in:
committed by
Victor Petukhov
parent
a10f37dd50
commit
fc7b836151
+2
-2
@@ -611,8 +611,8 @@ class ExpressionsConverter(
|
|||||||
var isNegate = false
|
var isNegate = false
|
||||||
var firExpression: FirExpression = FirErrorExpressionImpl(null, FirSimpleDiagnostic("No range in condition with range", DiagnosticKind.Syntax))
|
var firExpression: FirExpression = FirErrorExpressionImpl(null, FirSimpleDiagnostic("No range in condition with range", DiagnosticKind.Syntax))
|
||||||
whenCondition.forEachChildren {
|
whenCondition.forEachChildren {
|
||||||
when (it.tokenType) {
|
when {
|
||||||
NOT_IN -> isNegate = true
|
it.tokenType == OPERATION_REFERENCE && it.asText == NOT_IN.value -> isNegate = true
|
||||||
else -> if (it.isExpression()) firExpression = getAsFirExpression(it)
|
else -> if (it.isExpression()) firExpression = getAsFirExpression(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class KtWhenConditionInRange extends KtWhenCondition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNegated() {
|
public boolean isNegated() {
|
||||||
return getNode().findChildByType(KtTokens.NOT_IN) != null;
|
return getOperationReference().getNode().findChildByType(KtTokens.NOT_IN) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable @IfNotParsed
|
@Nullable @IfNotParsed
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val shouldBeTrue = 555555555555555555L in 123456789123456789L..987654321987654321L
|
val shouldBeTrue = 555555555555555555L in 123456789123456789L..987654321987654321L
|
||||||
if (!shouldBeTrue) return "Fail 1"
|
if (!shouldBeTrue) return "Fail 1"
|
||||||
|
|||||||
@@ -29,8 +29,7 @@ FILE fqName:<root> fileName:/whenWithSubjectVariable.kt
|
|||||||
GET_VAR 'val y: kotlin.Any [val] declared in <root>.test' type=kotlin.Any origin=null
|
GET_VAR 'val y: kotlin.Any [val] declared in <root>.test' type=kotlin.Any origin=null
|
||||||
then: CONST Int type=kotlin.Int value=3
|
then: CONST Int type=kotlin.Int value=3
|
||||||
BRANCH
|
BRANCH
|
||||||
if: ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [kotlin/ranges/IntRange.contains]>#' type=IrErrorType
|
if: ERROR_CALL 'Unresolved reference: <Unresolved name: not>#' type=IrErrorType
|
||||||
GET_VAR 'val y: kotlin.Any [val] declared in <root>.test' type=kotlin.Any origin=null
|
|
||||||
then: CONST Int type=kotlin.Int value=4
|
then: CONST Int type=kotlin.Int value=4
|
||||||
BRANCH
|
BRANCH
|
||||||
if: CONST Boolean type=kotlin.Boolean value=true
|
if: CONST Boolean type=kotlin.Boolean value=true
|
||||||
|
|||||||
+2
-2
@@ -11,7 +11,7 @@ Crumbs:
|
|||||||
when (xxx)
|
when (xxx)
|
||||||
…num.SomeLongValue ->
|
…num.SomeLongValue ->
|
||||||
when (yyy)
|
when (yyy)
|
||||||
in Int.MIN_VALUE..… ->
|
!in Int.MIN_VALUE..… ->
|
||||||
when (zzz)
|
when (zzz)
|
||||||
is A,… ->
|
is A,… ->
|
||||||
when (x1)
|
when (x1)
|
||||||
@@ -31,7 +31,7 @@ Tooltips:
|
|||||||
when (xxx)
|
when (xxx)
|
||||||
SomeEnum.SomeLongValue ->
|
SomeEnum.SomeLongValue ->
|
||||||
when (yyy)
|
when (yyy)
|
||||||
in Int.MIN_VALUE..Int.MAX_VALUE ->
|
!in Int.MIN_VALUE..Int.MAX_VALUE ->
|
||||||
when (zzz)
|
when (zzz)
|
||||||
is A,… ->
|
is A,… ->
|
||||||
when (x1)
|
when (x1)
|
||||||
|
|||||||
Reference in New Issue
Block a user