Files
kotlin/compiler/testData/diagnostics/tests/checkArguments/arrayAccessSet.kt
Alexander Udalov 8fe964f269 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
2016-01-21 00:36:35 +03:00

36 lines
676 B
Kotlin
Vendored

// !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!>""<!>
}