从无法访问的项目Fork
体验新版 GitCode,发现更多精彩内容 >>
// !LANGUAGE: +InlineClasses, -JvmInlineValueClasses
class Val { operator fun getValue(thisRef: Any?, kProp: Any?) = 1 } class Var { operator fun getValue(thisRef: Any?, kProp: Any?) = 2 operator fun setValue(thisRef: Any?, kProp: Any?, value: Int) {} } object ValObject { operator fun getValue(thisRef: Any?, kProp: Any?) = 1 } object VarObject { operator fun getValue(thisRef: Any?, kProp: Any?) = 2 operator fun setValue(thisRef: Any?, kProp: Any?, value: Int) {} } inline class Z(val data: Int) { val testVal by Val() var testVar by Var() val testValBySingleton by ValObject var testVarBySingleton by VarObject }