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:
Alexander Udalov
2016-01-14 02:36:57 +03:00
parent ccef1ad49e
commit 8fe964f269
9 changed files with 199 additions and 32 deletions
@@ -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!>""<!>
}