Files
kotlin-fork/compiler/fir/analysis-tests/testData/resolve/arrays/arraySetWithOperation.fir.txt
T
Denis.Zharkov adb9dfb256 FIR: Rework processing AugmentedArraySetCall
Previously (few commits earlier), it contained two versions
of receiver (lhs) generated separately for each desugaring version
that looked a bit redundant.

Now, at FIR building stage we just don't create desugaring sub-trees,
instead they are being built during bodies transformation and that seems
to be much convenient there, since we don't need to reverse-engineer
get-set-operator version to check if containing calls are successful
(as we just built those calls and retain them)

Semantically, this changes may only change how data flow works
for such statements (see changed compatibilityResolveWithVarargAndOperatorCall.kt)

^KT-50861 Relates
2022-02-01 13:12:49 +03:00

64 lines
2.0 KiB
Plaintext
Vendored

FILE: arraySetWithOperation.kt
public final class A<T> : R|kotlin/Any| {
public constructor<T>(): R|A<T>| {
super<R|kotlin/Any|>()
}
public final operator fun get(index: R|kotlin/Int|): R|T| {
^get Null(null)!!
}
public final operator fun set(index: R|kotlin/Int|, value: R|T|): R|kotlin/Unit| {
}
}
public final class B : R|kotlin/Any| {
public constructor(): R|B| {
super<R|kotlin/Any|>()
}
public final operator fun plusAssign(other: R|B|): R|kotlin/Unit| {
}
}
public final class C : R|kotlin/Any| {
public constructor(): R|C| {
super<R|kotlin/Any|>()
}
public final operator fun plus(other: R|C|): R|C| {
^plus this@R|/C|
}
}
public final class D : R|kotlin/Any| {
public constructor(): R|D| {
super<R|kotlin/Any|>()
}
public final operator fun plusAssign(other: R|D|): R|kotlin/Unit| {
}
public final operator fun plus(other: R|D|): R|D| {
^plus this@R|/D|
}
}
public final fun test_1(a: R|A<B>|): R|kotlin/Unit| {
R|<local>/a|.R|SubstitutionOverride</A.get: R|B|>|(Int(0)).R|/B.plusAssign|(R|/B.B|())
}
public final fun test_2(a: R|A<C>|): R|kotlin/Unit| {
{
lval <<array>>: R|A<C>| = R|<local>/a|
lval <<index_0>>: R|kotlin/Int| = Int(0)
R|<local>/<<array>>|.R|SubstitutionOverride</A.set: R|kotlin/Unit|>|(R|<local>/<<index_0>>|, R|<local>/<<array>>|.R|SubstitutionOverride</A.get: R|C|>|(R|<local>/<<index_0>>|).R|/C.plus|(R|/C.C|()))
}
}
public final fun test_3(a: R|A<D>|): R|kotlin/Unit| {
ArraySet:[R|<local>/a|.R|SubstitutionOverride</A.get: R|D|>|(Int(0)) += R|/D.D|()]
}
public final fun test_4(b: R|B|): R|kotlin/Unit| {
ArraySet:[R|<local>/b|.<Unresolved name: get>#(Int(0)) += R|/B.B|()]
}