Uast: returning back secondary constructors bodies (KT-21575)

but secondary constructors without primary constructor will not contain initializers, it is still an issue
This commit is contained in:
Nicolay Mitropolsky
2017-12-01 23:52:43 +03:00
committed by xiexed
parent 962c512882
commit b8069b48c5
9 changed files with 326 additions and 8 deletions
+74
View File
@@ -0,0 +1,74 @@
class A(val str: String) {
constructor(i: Int) : this(i.toString())
}
class AWithInit(val str: String) {
init {
println()
}
constructor(i: Int) : this(i.toString())
}
class AWith2Init(val str: String) {
init {
println(1)
}
init {
println(2)
}
constructor(i: Int) : this(i.toString())
}
class AOnlyInit {
init {
println(1)
}
init {
println(2)
}
}
class AWithSecondary {
lateinit var a: String
constructor(i: Int) {
a = i.toString()
}
constructor(s: String) {
a = s
}
}
class AWithSecondaryInit {
lateinit var a: String
init {
// This body will not be picked by UAST because no lightMethod contains it.
// Of course it is not a desired behaviour, so fix it if you know how
println()
}
constructor(i: Int) {
a = i.toString()
}
constructor(s: String) {
a = s
}
}