Desugar constructor call of inline class to the underlying value

Also add information about KotlinType to the constant stack values
This commit is contained in:
Mikhail Zarechenskiy
2018-02-09 04:10:58 +03:00
parent 6320368609
commit 8015295059
10 changed files with 123 additions and 10 deletions
@@ -0,0 +1,30 @@
// !LANGUAGE: +InlineClasses
inline class AsInt(val value: Int) {
override fun toString(): String {
return "asInt: ${value.toString()}"
}
}
inline class AsAny(val value: Any) {
override fun toString(): String {
return "asAny: ${value.toString()}"
}
}
fun takeAny(a: Any): String = a.toString()
fun getInt(): Int = 10
fun <T> id(x: T) = x
fun box(): String {
if (takeAny(AsInt(123)) != "asInt: 123") return "fail"
if (takeAny(AsAny(321)) != "asAny: 321") return "fail"
if (takeAny(AsInt(getInt())) != "asInt: 10") return "fail"
if (takeAny(AsInt(id(20))) != "asInt: 20") return "fail"
if (takeAny(AsAny(id(30))) != "asAny: 30") return "fail"
return "OK"
}