Replaced deprecated inline classes with JvmInline value classes in tests
This commit is contained in:
committed by
TeamCityServer
parent
b0aefd543a
commit
1da46586bd
+7
-4
@@ -1,10 +1,11 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// WITH_RUNTIME
|
||||
|
||||
var setterInvoked = 0
|
||||
|
||||
var backing = 42
|
||||
|
||||
inline class DelegateStr(val ignored: String) {
|
||||
@JvmInline
|
||||
value class DelegateStr(val ignored: String) {
|
||||
|
||||
operator fun getValue(thisRef: Any?, prop: Any?) =
|
||||
backing
|
||||
@@ -15,7 +16,8 @@ inline class DelegateStr(val ignored: String) {
|
||||
}
|
||||
}
|
||||
|
||||
inline class DelegateInt(val ignored: Int) {
|
||||
@JvmInline
|
||||
value class DelegateInt(val ignored: Int) {
|
||||
|
||||
operator fun getValue(thisRef: Any?, prop: Any?) =
|
||||
backing
|
||||
@@ -26,7 +28,8 @@ inline class DelegateInt(val ignored: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
inline class DelegateLong(val ignored: Long) {
|
||||
@JvmInline
|
||||
value class DelegateLong(val ignored: Long) {
|
||||
|
||||
operator fun getValue(thisRef: Any?, prop: Any?) =
|
||||
backing
|
||||
|
||||
Vendored
+3
-2
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// WITH_RUNTIME
|
||||
|
||||
class Foo {
|
||||
var a: Int = 42
|
||||
@@ -7,7 +7,8 @@ class Foo {
|
||||
|
||||
var setterInvoked = 0
|
||||
|
||||
inline class Delegate(val default: Int) {
|
||||
@JvmInline
|
||||
value class Delegate(val default: Int) {
|
||||
|
||||
operator fun getValue(thisRef: Any?, prop: Any?) =
|
||||
(thisRef as? Foo)?.a ?: default
|
||||
|
||||
+5
-3
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// WITH_RUNTIME
|
||||
|
||||
class Foo {
|
||||
var a: Int = 42
|
||||
@@ -8,14 +8,16 @@ class Foo {
|
||||
var provideDelegateInvoked = 0
|
||||
var setterInvoked = 0
|
||||
|
||||
inline class DelegateFactory(val default: Int) {
|
||||
@JvmInline
|
||||
value class DelegateFactory(val default: Int) {
|
||||
operator fun provideDelegate(thisRef: Any?, prop: Any?): Delegate {
|
||||
provideDelegateInvoked++
|
||||
return Delegate(default)
|
||||
}
|
||||
}
|
||||
|
||||
inline class Delegate(val default: Int) {
|
||||
@JvmInline
|
||||
value class Delegate(val default: Int) {
|
||||
|
||||
operator fun getValue(thisRef: Any?, prop: Any?) =
|
||||
(thisRef as? Foo)?.a ?: default
|
||||
|
||||
Vendored
+3
-2
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// WITH_RUNTIME
|
||||
|
||||
class Foo {
|
||||
companion object {
|
||||
@@ -9,7 +9,8 @@ class Foo {
|
||||
|
||||
var setterInvoked = 0
|
||||
|
||||
inline class Delegate(val ignored: Int) {
|
||||
@JvmInline
|
||||
value class Delegate(val ignored: Int) {
|
||||
|
||||
operator fun getValue(thisRef: Any?, prop: Any?) = Foo.a
|
||||
|
||||
|
||||
+2
-2
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
|
||||
@@ -11,7 +10,8 @@ class Foo {
|
||||
|
||||
var setterInvoked = 0
|
||||
|
||||
inline class Delegate(val ignored: Int) {
|
||||
@JvmInline
|
||||
value class Delegate(val ignored: Int) {
|
||||
|
||||
operator fun getValue(thisRef: Any?, prop: Any?) = Foo.a
|
||||
|
||||
|
||||
Vendored
+7
-4
@@ -1,10 +1,11 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// WITH_RUNTIME
|
||||
|
||||
var setterInvoked = 0
|
||||
|
||||
var backing = 42
|
||||
|
||||
inline class DelegateStr(val ignored: String) {
|
||||
@JvmInline
|
||||
value class DelegateStr(val ignored: String) {
|
||||
|
||||
operator fun getValue(thisRef: Any?, prop: Any?) =
|
||||
backing
|
||||
@@ -15,7 +16,8 @@ inline class DelegateStr(val ignored: String) {
|
||||
}
|
||||
}
|
||||
|
||||
inline class DelegateInt(val ignored: Int) {
|
||||
@JvmInline
|
||||
value class DelegateInt(val ignored: Int) {
|
||||
|
||||
operator fun getValue(thisRef: Any?, prop: Any?) =
|
||||
backing
|
||||
@@ -26,7 +28,8 @@ inline class DelegateInt(val ignored: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
inline class DelegateLong(val ignored: Long) {
|
||||
@JvmInline
|
||||
value class DelegateLong(val ignored: Long) {
|
||||
|
||||
operator fun getValue(thisRef: Any?, prop: Any?) =
|
||||
backing
|
||||
|
||||
Vendored
+3
-2
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// WITH_RUNTIME
|
||||
|
||||
object Foo {
|
||||
var a: Int = 42
|
||||
@@ -7,7 +7,8 @@ object Foo {
|
||||
|
||||
var setterInvoked = 0
|
||||
|
||||
inline class Delegate(val ignored: Int) {
|
||||
@JvmInline
|
||||
value class Delegate(val ignored: Int) {
|
||||
|
||||
operator fun getValue(thisRef: Any?, prop: Any?) = Foo.a
|
||||
|
||||
|
||||
+3
-2
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// WITH_RUNTIME
|
||||
|
||||
class Foo {
|
||||
companion object {
|
||||
@@ -12,7 +12,8 @@ class Foo {
|
||||
|
||||
var setterInvoked = 0
|
||||
|
||||
inline class Delegate(val ignored: Int) {
|
||||
@JvmInline
|
||||
value class Delegate(val ignored: Int) {
|
||||
|
||||
operator fun getValue(thisRef: Any?, prop: Any?) = Foo.a
|
||||
|
||||
|
||||
Vendored
+3
-2
@@ -1,9 +1,10 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// WITH_RUNTIME
|
||||
|
||||
var setterInvoked = 0
|
||||
var backing = 42
|
||||
|
||||
inline class Delegate(val ignored: Int) {
|
||||
@JvmInline
|
||||
value class Delegate(val ignored: Int) {
|
||||
|
||||
operator fun getValue(thisRef: Any?, prop: Any?) =
|
||||
backing
|
||||
|
||||
compiler/testData/codegen/box/inlineClasses/propertyDelegation/delegatedPropertyOfInlineClassType.kt
Vendored
+8
-3
@@ -1,8 +1,13 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
inline class ICInt(val i: Int)
|
||||
inline class ICLong(val l: Long)
|
||||
inline class ICOverIC(val o: ICLong)
|
||||
@JvmInline
|
||||
value class ICInt(val i: Int)
|
||||
@JvmInline
|
||||
value class ICLong(val l: Long)
|
||||
@JvmInline
|
||||
value class ICOverIC(val o: ICLong)
|
||||
|
||||
class Delegate<T>(var f: () -> T) {
|
||||
operator fun getValue(thisRef: Any?, property: KProperty<*>): T = f()
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.properties.ReadOnlyProperty
|
||||
@@ -9,7 +8,8 @@ class Foo {
|
||||
val b by Delegate(0)
|
||||
}
|
||||
|
||||
inline class Delegate(val ignored: Int): ReadOnlyProperty<Foo, Int> {
|
||||
@JvmInline
|
||||
value class Delegate(val ignored: Int): ReadOnlyProperty<Foo, Int> {
|
||||
override fun getValue(thisRef: Foo, property: KProperty<*>): Int {
|
||||
return thisRef.a
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
class Delegate {
|
||||
operator fun getValue(t: Any?, p: Any): String = "OK"
|
||||
}
|
||||
|
||||
inline class Kla1(val default: Int) {
|
||||
@JvmInline
|
||||
value class Kla1(val default: Int) {
|
||||
fun getValue(): String {
|
||||
val prop by Delegate()
|
||||
return prop
|
||||
|
||||
Reference in New Issue
Block a user