Support generating computable properties inside inline classes

This commit is contained in:
Mikhail Zarechenskiy
2018-02-06 16:52:52 +03:00
parent 47aeeb36e4
commit 30c79ffadc
10 changed files with 88 additions and 3 deletions
@@ -0,0 +1,24 @@
// !LANGUAGE: +InlineClasses
inline class Foo(val x: Int) {
fun empty() = ""
fun withParam(a: String) = a
fun withInlineClassParam(f: Foo) = f.toString()
fun test(): String {
val a = empty()
val b = withParam("hello")
val c = withInlineClassParam(this)
return a + b + c
}
override fun toString(): String {
return x.toString()
}
}
fun box(): String {
val f = Foo(12)
return if (f.test() != "hello12") "fail" else "OK"
return "OK"
}
@@ -0,0 +1,10 @@
// !LANGUAGE: +InlineClasses
inline class UIntArray(private val intArray: IntArray) {
val size get() = intArray.size
}
fun box(): String {
val array = UIntArray(intArrayOf(1, 2, 3))
return if (array.size != 3) "fail" else "OK"
}