KT-2633 Support multiple assignment in JVM Back-end

#KT-2633 Fixed
This commit is contained in:
Svetlana Isakova
2012-08-21 16:12:30 +04:00
parent 239c5fd94b
commit 47362bf2ac
16 changed files with 355 additions and 2 deletions
@@ -0,0 +1,13 @@
class A {
fun component1() = 1
fun component2() = 2
}
fun A.getA() = this
fun box() : String {
val (a, b) = A().getA().getA()
return if (a == 1 && b == 2) "OK" else "fail"
}
@@ -0,0 +1,9 @@
class A {
fun component1() = 1
fun component2() = 2
}
fun box() : String {
val (a, b) = A()
return if (a == 1 && b == 2) "OK" else "fail"
}
@@ -0,0 +1,10 @@
class A {
}
fun A.component1() = 1
fun A.component2() = 2
fun box() : String {
val (a, b) = A()
return if (a == 1 && b == 2) "OK" else "fail"
}
@@ -0,0 +1,10 @@
class A {
fun component1() = 1
fun component2() = 2
}
fun box() : String {
var (a, b) = A()
a = b
return if (a == 2 && b == 2) "OK" else "fail"
}
@@ -0,0 +1,13 @@
class A {
fun component1() = 1
fun component2() = 2
}
fun box() : String {
val (a, b) = A()
val run = {
a
}
return if (run() == 1 && b == 2) "OK" else "fail"
}
@@ -0,0 +1,13 @@
class A {
fun component1() = 1
fun component2() = 2
}
fun box() : String {
val (a, b) = A()
fun run(): Int {
return a
}
return if (run() == 1 && b == 2) "OK" else "fail"
}
@@ -0,0 +1,16 @@
class A {
fun component1() = 1
fun component2() = 2
}
fun box() : String {
val (a, b) = A()
val local = object {
public fun run() : Int {
return a
}
}
return if (local.run() == 1 && b == 2) "OK" else "fail"
}
@@ -0,0 +1,15 @@
class A {
fun component1() = 1
fun component2() = 2
}
fun box() : String {
var (a, b) = A()
val local = {
a = 3
}
local()
return if (a == 3 && b == 2) "OK" else "fail"
}
@@ -0,0 +1,15 @@
class A {
}
fun A.component1() = 1
fun A.component2() = 2
fun box() : String {
var (a, b) = A()
fun local() {
a = 3
}
local()
return if (a == 3 && b == 2) "OK" else "fail"
}
@@ -0,0 +1,17 @@
class A {
fun component1() = 1
fun component2() = 2
}
fun box() : String {
var (a, b) = A()
val local = object {
public fun run() {
a = 3
}
}
local.run()
return if (a == 3 && b == 2) "OK" else "fail"
}