Codegen for "componentN" functions for data classes

This commit is contained in:
Alexander Udalov
2012-08-28 21:53:01 +04:00
parent b93db69a24
commit 2c84389a45
13 changed files with 268 additions and 0 deletions
@@ -0,0 +1,9 @@
data class A(var x: Int, var y: String)
fun box(): String {
val a = A(21, "K")
if (a.component1() != 21 || a.component2() != "K") return "Fail"
a.x *= 2
a.y = "O" + a.component2()
return if (a.component1() == 42) a.component2() else a.component1().toString()
}