未解决的参考:JvmInline In kotlin playground

Sou*_*a B 6 kotlin kotlin-inline-class

这是取自kotlin 官网的值类的精确代码片段。

interface I

@JvmInline
value class Foo(val i: Int) : I

fun asInline(f: Foo) {}
fun <T> asGeneric(x: T) {}
fun asInterface(i: I) {}
fun asNullable(i: Foo?) {}

fun <T> id(x: T): T = x

fun main() {
    val f = Foo(42) 
    
    asInline(f)    // unboxed: used as Foo itself
    asGeneric(f)   // boxed: used as generic type T
    asInterface(f) // boxed: used as type I
    asNullable(f)  // boxed: used as Foo?, which is different from Foo
    
    // below, 'f' first is boxed (while being passed to 'id') and then unboxed (when returned from 'id') 
    // In the end, 'c' contains unboxed representation (just '42'), as 'f' 
    val c = id(f)  
}
Run Code Online (Sandbox Code Playgroud)

在 kotlin 操场上运行它给了我这两个相互矛盾的错误:
未解决的参考:尚不
支持没有 @JvmInline 注释的JvmInline值类

我不知道我哪里出错了,我只是想知道这段代码末尾的 val c 的类型。

Com*_*vis 0

Kotlin 1.5 发布后, Kotlin Playground 中的value可以正常运行