Fix unboxing values of inline class type from type parameters
This commit is contained in:
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
inline class Result<T>(val a: Any?) {
|
||||
fun typed(): T = a as T
|
||||
}
|
||||
|
||||
fun <K> materialize(): K = TODO()
|
||||
|
||||
fun test(asInt: Result<Int>, asString: Result<String>, asResult: Result<Result<Int>>) {
|
||||
val a1 = materialize<Result<Int>>() // unbox
|
||||
val a2 = materialize<Result<Result<Int>>>() // unbox
|
||||
|
||||
val b1 = asInt.typed() // intValue
|
||||
val b2 = asString.typed()
|
||||
|
||||
val c1 = asResult.typed() // unbox
|
||||
|
||||
materialize<Result<Int>>()
|
||||
asInt.typed()
|
||||
asString.typed()
|
||||
asResult.typed()
|
||||
}
|
||||
|
||||
// 0 INVOKESTATIC Result\$Erased.box
|
||||
// 3 INVOKEVIRTUAL Result.unbox
|
||||
|
||||
// 0 valueOf
|
||||
// 1 intValue
|
||||
Reference in New Issue
Block a user