KT-3118 NoSuchFieldError on private property without backing field &&

KT-3551 Wrong synthetic accessor implementation
This commit is contained in:
Mikhael Bogdanov
2013-04-30 11:40:27 +04:00
parent b1c2d9035a
commit b0b6728c7e
13 changed files with 180 additions and 142 deletions
@@ -33,7 +33,7 @@ class C {
class D {
private var foo = 1
set(i: Int) {
foo = i + 1
$foo = i + 1
}
fun foo() {
@@ -0,0 +1,12 @@
package testing
class Test {
private val hello: String
get() { return "hello" }
fun sayHello() : String = hello
}
fun box(): String {
return if (Test().sayHello() == "hello") "OK" else "fail"
}
@@ -0,0 +1,23 @@
class Identifier() {
private var myNullable : Boolean = false
set(l : Boolean) {
//do nothing
}
fun getValue() : Boolean {
return myNullable
}
class object {
fun init(isNullable : Boolean) : Identifier {
val id = Identifier()
id.myNullable = isNullable
return id
}
}
}
fun box() : String {
val id = Identifier.init(true)
return if (id.getValue() == false) return "OK" else "fail"
}
@@ -0,0 +1,10 @@
class Test {
val a : String = "1"
private val b : String get() = a
fun outer() : Int {
return b.length
}
}
fun box() = if (Test().outer() == 1) "OK" else "fail"