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
}