Test for obsolete KT-10044: "Don't know how to generate outer expression for class" with lambda in init block

#KT-10044 Obsolete
This commit is contained in:
Michael Bogdanov
2016-01-29 12:42:37 +03:00
parent b9c30c739e
commit e1fa6491c1
2 changed files with 47 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
open class JClass() {
fun test(): String {
return "OK"
}
}
class Example : JClass {
constructor() : super()
private var obj: JClass? = null
var result: String? = null
init {
{
result = obj?.test()
}()
}
}
class Example2 : JClass {
constructor() : super()
private var obj: JClass? = this
var result: String? = null
init {
{
result = obj?.test()
}()
}
}
fun box(): String {
val result = Example().result
if (result != null) "fail 1: $result"
return Example2().result!!
}