KT-28054: Treat inline class constructor accessors specially

This commit is contained in:
Dmitry Petrov
2018-11-16 14:14:24 +03:00
parent 3a93cab3b6
commit 90da274eaa
11 changed files with 94 additions and 4 deletions
@@ -0,0 +1,12 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR
inline class Composed(val s: String) {
private constructor(s1: String, s2: String) : this(s1 + s2)
companion object {
fun p1(s: String) = Composed("O", s)
}
}
fun box() = Composed.p1("K").s
@@ -0,0 +1,14 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR
inline class Composed(val s: String) {
constructor(s: String, x: Int) : this(s.subSequence(0, x).toString())
private constructor(s1: String, s2: String) : this(s1 + s2, 2)
fun p1(s2: String) =
{ Composed(s, s2) }
}
fun box() = Composed("O").p1("K1234")().s