[FIR2IR] Propagate NOT_IN statement origin when converting to IR

^KT-65636 Fixed
This commit is contained in:
Brian Norman
2024-02-14 11:18:39 -06:00
committed by Space Team
parent 6d634ac87f
commit 78bb0be7aa
4 changed files with 6 additions and 6 deletions
@@ -535,6 +535,9 @@ internal fun FirReference.statementOrigin(): IrStatementOrigin? = when (this) {
source?.kind == KtFakeSourceElementKind.DesugaredForLoop && symbol.callableId.isIterator() ->
IrStatementOrigin.FOR_LOOP_ITERATOR
source?.kind == KtFakeSourceElementKind.DesugaredInvertedContains ->
IrStatementOrigin.NOT_IN
source?.kind is KtFakeSourceElementKind.DesugaredIncrementOrDecrement ->
incOrDeclSourceKindToIrStatementOrigin[source?.kind]
+2 -2
View File
@@ -12,7 +12,7 @@ FILE fqName:<root> fileName:/in.kt
VALUE_PARAMETER name:x index:1 type:kotlin.collections.Collection<kotlin.Any>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test2 (a: kotlin.Any, x: kotlin.collections.Collection<kotlin.Any>): kotlin.Boolean declared in <root>'
CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=null
CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=NOT_IN
$this: CALL 'public abstract fun contains (element: E of kotlin.collections.Collection): kotlin.Boolean declared in kotlin.collections.Collection' type=kotlin.Boolean origin=IN
$this: GET_VAR 'x: kotlin.collections.Collection<kotlin.Any> declared in <root>.test2' type=kotlin.collections.Collection<kotlin.Any> origin=null
element: GET_VAR 'a: kotlin.Any declared in <root>.test2' type=kotlin.Any origin=null
@@ -31,7 +31,7 @@ FILE fqName:<root> fileName:/in.kt
VALUE_PARAMETER name:x index:1 type:kotlin.collections.Collection<T of <root>.test4>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun test4 <T> (a: T of <root>.test4, x: kotlin.collections.Collection<T of <root>.test4>): kotlin.Boolean declared in <root>'
CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=null
CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=NOT_IN
$this: CALL 'public abstract fun contains (element: E of kotlin.collections.Collection): kotlin.Boolean declared in kotlin.collections.Collection' type=kotlin.Boolean origin=IN
$this: GET_VAR 'x: kotlin.collections.Collection<T of <root>.test4> declared in <root>.test4' type=kotlin.collections.Collection<T of <root>.test4> origin=null
element: GET_VAR 'a: T of <root>.test4 declared in <root>.test4' type=T of <root>.test4 origin=null
@@ -34,7 +34,7 @@ FILE fqName:<root> fileName:/whenWithSubjectVariable.kt
GET_VAR 'val y: kotlin.Any declared in <root>.test' type=kotlin.Any origin=null
then: CONST Int type=kotlin.Int value=3
BRANCH
if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=null
if: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=NOT_IN
$this: CALL 'public open fun contains (value: kotlin.Int): kotlin.Boolean declared in kotlin.ranges.IntRange' type=kotlin.Boolean origin=IN
$this: CALL 'public final fun rangeTo (other: kotlin.Int): kotlin.ranges.IntRange declared in kotlin.Int' type=kotlin.ranges.IntRange origin=RANGE
$this: CONST Int type=kotlin.Int value=10
@@ -1,6 +1,3 @@
// IGNORE_BACKEND_K2: JVM_IR
// K2 disabled because of KT-65636
fun box() = expectThrowableMessage {
assert("Hello" !in listOf("Hello", "World"))
}