Get accessors for companion object properties through wrapper class

This commit is contained in:
Mikhail Zarechenskiy
2018-02-06 16:18:51 +03:00
parent 70cd1cfcdf
commit 47aeeb36e4
7 changed files with 53 additions and 5 deletions
@@ -0,0 +1,23 @@
// !LANGUAGE: +InlineClasses
inline class Foo(val c: Char) {
companion object {
val prop = "O"
const val constVal = 1
fun funInCompanion(): String = "K"
}
fun simple() {
prop
constVal
funInCompanion()
}
fun asResult(): String = prop + constVal + funInCompanion() + c
}
fun box(): String {
val r = Foo('2')
if (r.asResult() != "O1K2") return "fail"
return "OK"
}