[FIR-TEST] Move analysis tests to separate module
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
// ISSUE: KT-37516
|
||||
|
||||
class A<T> {
|
||||
operator fun get(index: Int): T = null!!
|
||||
operator fun set(index: Int, value: T) {}
|
||||
}
|
||||
|
||||
class B {
|
||||
operator fun plusAssign(other: B) {}
|
||||
}
|
||||
|
||||
class C {
|
||||
operator fun plus(other: C): C = this
|
||||
}
|
||||
|
||||
class D {
|
||||
operator fun plusAssign(other: D) {}
|
||||
operator fun plus(other: D): D = this
|
||||
}
|
||||
|
||||
fun test_1(a: A<B>) {
|
||||
a[0] = B() // set
|
||||
}
|
||||
|
||||
fun test_2(a: A<C>) {
|
||||
a[0] = C() // set
|
||||
}
|
||||
|
||||
fun test_3(a: A<D>) {
|
||||
a[0] = D() // set
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
FILE: arraySet.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|FakeOverride</A.set: R|kotlin/Unit|>|(Int(0), R|/B.B|())
|
||||
}
|
||||
public final fun test_2(a: R|A<C>|): R|kotlin/Unit| {
|
||||
R|<local>/a|.R|FakeOverride</A.set: R|kotlin/Unit|>|(Int(0), R|/C.C|())
|
||||
}
|
||||
public final fun test_3(a: R|A<D>|): R|kotlin/Unit| {
|
||||
R|<local>/a|.R|FakeOverride</A.set: R|kotlin/Unit|>|(Int(0), R|/D.D|())
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
// ISSUE: KT-37516
|
||||
|
||||
class A<T> {
|
||||
operator fun get(index: Int): T = null!!
|
||||
operator fun set(index: Int, value: T) {}
|
||||
}
|
||||
|
||||
class B {
|
||||
operator fun plusAssign(other: B) {}
|
||||
}
|
||||
|
||||
class C {
|
||||
operator fun plus(other: C): C = this
|
||||
}
|
||||
|
||||
class D {
|
||||
operator fun plusAssign(other: D) {}
|
||||
operator fun plus(other: D): D = this
|
||||
}
|
||||
|
||||
fun test_1(a: A<B>) {
|
||||
// foo().bar()[0] += x
|
||||
a[0] += B() // get, plusAssign
|
||||
}
|
||||
|
||||
fun test_2(a: A<C>) {
|
||||
a[0] += C() // get, set, plus
|
||||
}
|
||||
|
||||
fun test_3(a: A<D>) {
|
||||
<!AMBIGUITY!>a[0] += D()<!> // ambiguity
|
||||
}
|
||||
|
||||
fun test_4(b: B) {
|
||||
<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>b[0]<!> += B()<!> // unresolved
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
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|FakeOverride</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|FakeOverride</A.set: R|kotlin/Unit|>|(R|<local>/<<index_0>>|, R|<local>/<<array>>|.R|FakeOverride</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|FakeOverride</A.get: R|D|>|(Int(0)).R|/D.plusAssign|(R|/D.D|())]
|
||||
}
|
||||
public final fun test_4(b: R|B|): R|kotlin/Unit| {
|
||||
ArraySet:[R|<local>/b|.<Unresolved name: get>#(Int(0)).<Unresolved name: plusAssign>#(R|/B.B|())]
|
||||
}
|
||||
Reference in New Issue
Block a user