Fix "No error on increment or augmented assignment when 'get' is an operator but 'set' is not" #KT-11300

This commit is contained in:
Yan Zhulanow
2016-03-15 02:21:37 +03:00
parent 371e80bcba
commit 9b1402d804
5 changed files with 52 additions and 7 deletions
@@ -0,0 +1,11 @@
class A {
operator fun get(x: Int): Int = x
fun set(<!UNUSED_PARAMETER!>x<!>: Int, <!UNUSED_PARAMETER!>y<!>: Int) {} // no `operator` modifier
}
fun main(args: Array<String>) {
val a = A()
<!OPERATOR_MODIFIER_REQUIRED!>a[1]<!>++
<!OPERATOR_MODIFIER_REQUIRED!>a[1]<!> += 3
<!OPERATOR_MODIFIER_REQUIRED!>a[1]<!> = a[1] + 3
}
@@ -0,0 +1,12 @@
package
public fun main(/*0*/ args: kotlin.Array<kotlin.String>): kotlin.Unit
public final class A {
public constructor A()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final operator fun get(/*0*/ x: kotlin.Int): kotlin.Int
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final fun set(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}