A new kind of synthetic accessors for backing fields, if accessed inside lambda / object literal / local class #KT-9657 Fixed

A set of tests provided
Also #KT-4867 Fixed
Also #KT-8750 Fixed
Slight codegen refactoring
This commit is contained in:
Mikhail Glukhikh
2015-10-21 12:06:21 +03:00
parent ccad435850
commit 4b6cb3ebce
18 changed files with 298 additions and 73 deletions
@@ -9,6 +9,12 @@ class A {
fun `access$getFoo$cp`(): Int = 1
fun `access$setFoo$cp`(d: Int) {}
val bar = 0
get() = { field }()
//synthetic field convention accessor
fun `access$getBar$lp`(a: A): Int = 7
companion object {
private var foo = 1;
@@ -26,7 +32,7 @@ class A {
fun test() {
{
foo = 2;
foo
foo + bar
}()
}
}