KT-4138: java.lang.VerifyError: (class: kotlin/sql/tests/h2/Foo, method: getA$b$0 signature: ()Lkotlin/sql/tests/h2/Foo;) Wrong return type in function

#KT-4138 Fixed
This commit is contained in:
Mikhael Bogdanov
2013-10-28 15:01:33 +04:00
parent 12d0da8146
commit 3ee918b084
6 changed files with 110 additions and 12 deletions
@@ -0,0 +1,35 @@
class Delegate<T>(var inner: T) {
fun get(t: Any?, p: PropertyMetadata): T = inner
fun set(t: Any?, p: PropertyMetadata, i: T) { inner = i }
}
class Foo (val f: Int) {
class object {
val A: Foo by Delegate(Foo(11))
var B: Foo by Delegate(Foo(11))
}
}
trait FooTrait {
class object {
val A: Foo by Delegate(Foo(11))
var B: Foo by Delegate(Foo(11))
}
}
fun box() : String {
if (Foo.A.f != 11) return "fail 1"
if (Foo.B.f != 11) return "fail 2"
Foo.B = Foo(12)
if (Foo.B.f != 12) return "fail 3"
if (FooTrait.A.f != 11) return "fail 4"
if (FooTrait.B.f != 11) return "fail 5"
FooTrait.B = Foo(12)
if (FooTrait.B.f != 12) return "fail 6"
return "OK"
}