KT-3573 "Error generating primary constructor" when trying to use "this" in extensions from constructors
#KT-3573 Fixed
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
class Data
|
||||
|
||||
fun newInit(f: Data.() -> Data) = Data().f()
|
||||
|
||||
class TestClass {
|
||||
val test: Data = newInit() { this }
|
||||
}
|
||||
|
||||
fun box() : String {
|
||||
TestClass()
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
class Comment() {
|
||||
var article = ""
|
||||
}
|
||||
|
||||
fun new(body: Comment.() -> Unit) : Comment {
|
||||
val c = Comment()
|
||||
c.body()
|
||||
return c
|
||||
}
|
||||
|
||||
open class Request(val handler : Any.() -> Comment) {
|
||||
val s = handler().article
|
||||
}
|
||||
|
||||
|
||||
class A : Request ({
|
||||
new {
|
||||
this.article = "OK"
|
||||
}
|
||||
})
|
||||
|
||||
fun box() : String {
|
||||
return A().s
|
||||
}
|
||||
Reference in New Issue
Block a user