diff --git a/compiler/testData/codegen/regressions/kt633.kt b/compiler/testData/codegen/regressions/kt633.kt new file mode 100644 index 00000000000..13a8caceb03 --- /dev/null +++ b/compiler/testData/codegen/regressions/kt633.kt @@ -0,0 +1,26 @@ +class mInt(val i : Int) { + fun toString() : String = "mint: $i" + fun plus(i : Int) = mInt(this.i + i) + fun inc() = mInt(i + 1) +} + +class MyArray() { + val a = Array(10, {mInt(0)}) + fun get(i : mInt) : mInt = a[i.i] + fun set(i : mInt, v : mInt) { + a[i.i] = v + } +} + +fun box() : String { + val a = MyArray() + var i = mInt(0) + System.out?.println(i) + a[i++]// = mInt(1) + System.out?.println(i) + a[i++] = mInt(1) + System.out?.println(i) + for (i in 0..9) + System.out?.println("ar: ${a[mInt(i)]}") + return "OK" +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java index d81a94199c0..25f6c0d4985 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java +++ b/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java @@ -293,4 +293,9 @@ public class ClassGenTest extends CodegenTestCase { public void testKt725() throws Exception { blackBoxFile("regressions/kt725.kt"); } + + public void testKt633() throws Exception { + blackBoxFile("regressions/kt633.kt"); + } + }