Resolve array access RHS always as the last argument of the call
Also do not attempt to match any of the arguments in the brackets with the last parameter of the 'set' method #KT-10633 Fixed
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
object A {
|
||||
operator fun set(x: Int, y: String = "y", z: Double) {
|
||||
}
|
||||
}
|
||||
|
||||
object B {
|
||||
operator fun set(x: Int, y: String = "y", z: Double = 3.14, w: Char = 'w', v: Boolean) {
|
||||
}
|
||||
}
|
||||
|
||||
object D {
|
||||
operator fun set(x: Int, vararg y: String, z: Double) {
|
||||
}
|
||||
}
|
||||
|
||||
object Z {
|
||||
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun set() {
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A[0] = <!TYPE_MISMATCH!>""<!>
|
||||
A[0] = 2.72
|
||||
|
||||
B[0] = <!TYPE_MISMATCH!>""<!>
|
||||
B[0] = <!CONSTANT_EXPECTED_TYPE_MISMATCH!>2.72<!>
|
||||
B[0] = true
|
||||
|
||||
D[0] = <!TYPE_MISMATCH!>""<!>
|
||||
D[0] = 2.72
|
||||
|
||||
Z[<!TOO_MANY_ARGUMENTS!>0<!>] = <!TOO_MANY_ARGUMENTS!>""<!>
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package
|
||||
|
||||
public fun test(): kotlin.Unit
|
||||
|
||||
public object A {
|
||||
private constructor A()
|
||||
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.Int, /*1*/ y: kotlin.String = ..., /*2*/ z: kotlin.Double): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public object B {
|
||||
private constructor B()
|
||||
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.Int, /*1*/ y: kotlin.String = ..., /*2*/ z: kotlin.Double = ..., /*3*/ w: kotlin.Char = ..., /*4*/ v: kotlin.Boolean): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public object D {
|
||||
private constructor D()
|
||||
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.Int, /*1*/ vararg y: kotlin.String /*kotlin.Array<out kotlin.String>*/, /*2*/ z: kotlin.Double): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public object Z {
|
||||
private constructor Z()
|
||||
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(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+10
@@ -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
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
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 final operator fun get(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final operator fun set(/*0*/ x: kotlin.String, /*1*/ value: kotlin.Int): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Reference in New Issue
Block a user