FIR: Ensure that the array set argument (on RHS of =) is always mapped

to the last parameter of the set operator function, even if there are
missing or too many index arguments.
This commit is contained in:
Mark Punzalan
2021-08-31 07:31:50 +00:00
committed by teamcityserver
parent 2bb3e94ef7
commit 34e6459014
26 changed files with 205 additions and 21 deletions
@@ -0,0 +1,10 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A {
operator fun set(x: String, y: Boolean, value: Int) {}
fun d(x: Int) {
<!NO_VALUE_FOR_PARAMETER("y")!>this[""]<!> = 1
}
}
@@ -0,0 +1,10 @@
package
public final class A {
public constructor A()
public final fun d(/*0*/ x: kotlin.Int): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final operator fun set(/*0*/ x: kotlin.String, /*1*/ y: kotlin.Boolean, /*2*/ value: kotlin.Int): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,10 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A {
operator fun get(x: Int) {}
operator fun set(x: String, value: Int) {}
fun d(x: Int) {
this["", <!TOO_MANY_ARGUMENTS!>1<!>] = 1
}
}
@@ -1,4 +1,3 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A {