package lvalue_assignment open class B() { var b: Int = 2 val c: Int = 34 } class C() : B() { var x = 4 fun foo(c: C) { this.x = 34 this.b = 123 super.b = 23 this.c = 34 super.c = 3535 //repeat for 'c' getInt() = 12 } fun foo1(c: C) { super.c = 34 } fun bar(c: C) { this = c //should be an error } } fun getInt() = 0 class D() { class B() { fun foo() { this@D = D() } } } fun cannotBe(var i: Int) { z = 30; #() = #(); (i as Int) = 34 (i is Int) = false A() = A() 5 = 34 } fun canBe(var i: Int, val j: Int) { (i: Int) = 36 (@label i) = 34 (j: Int) = 36 (@label j) = 34 //repeat for j val a = A() (@ a.a) = 3894 } fun canBe2(val j: Int) { (@label j) = 34 } class A() { var a: Int = 3 } class Test() { fun testIllegalValues() { 1 += 23 (1 : Int) += 43 (@l 1) += 23 getInt() += 343 (@f getInt()) += 343 (getInt() : Int) += 343 1++ (@r 1)++ (1 : Int)++ getInt()++ (@m getInt())++ (getInt() : Int)++ this++ var s : String = "r" s += "ss" s += this s += (@a 2) } fun testVariables() { var a: Int = 34 val b: Int = 34 a += 34 (@l a) += 34 (a : Int) += 34 b += 34 a++ (@ a)++ (a : Int)++ (a)++ } fun testVariables1() { val b: Int = 34 (@l b) += 34 //repeat for b (b : Int) += 34 (b) += 3 } fun testArrays(a: Array, ab: Ab) { a[3] = 4 a[4]++ a[6] += 43 ab.getArray()[54] = 23 ab.getArray()[54]++ (@f a)[3] = 4 (a : Array)[4]++ (ab.getArray() : Array)[54] += 43 this[54] = 34 } } fun Array.checkThis() { this[45] = 34 this[352]++ this[35] += 234 } abstract class Ab { abstract fun getArray() : Array }