Fix for KT-14162: Support @InlineOnly on inline properties
#KT-14162 Fixed
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
// FILE: 1.kt
|
||||
// WITH_RUNTIME
|
||||
package test
|
||||
inline fun stub() {
|
||||
|
||||
}
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.InlineOnly
|
||||
inline val prop: String
|
||||
get() = "OK"
|
||||
|
||||
// FILE: 2.kt
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
return prop
|
||||
}
|
||||
|
||||
// FILE: 2.smap
|
||||
|
||||
SMAP
|
||||
2.kt
|
||||
Kotlin
|
||||
*S Kotlin
|
||||
*F
|
||||
+ 1 2.kt
|
||||
_2Kt
|
||||
*L
|
||||
1#1,8:1
|
||||
*E
|
||||
@@ -0,0 +1,39 @@
|
||||
// FILE: 1.kt
|
||||
// WITH_REFLECT
|
||||
package test
|
||||
|
||||
inline val <reified T : Any> T.className: String; get() = T::class.java.simpleName
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
val z = "OK".className
|
||||
if (z != "String") return "fail: $z"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: 2.smap
|
||||
|
||||
SMAP
|
||||
2.kt
|
||||
Kotlin
|
||||
*S Kotlin
|
||||
*F
|
||||
+ 1 2.kt
|
||||
_2Kt
|
||||
+ 2 1.kt
|
||||
test/_1Kt
|
||||
*L
|
||||
1#1,12:1
|
||||
5#2:13
|
||||
*E
|
||||
*S KotlinDebug
|
||||
*F
|
||||
+ 1 2.kt
|
||||
_2Kt
|
||||
*L
|
||||
6#1:13
|
||||
*E
|
||||
@@ -5,8 +5,13 @@ package test
|
||||
|
||||
fun foo() {
|
||||
inlineOnly<String>()
|
||||
inlineOnlyAnnotated()
|
||||
}
|
||||
|
||||
// No method should be generated in multifile facade for 'inlineOnly'
|
||||
// Because 'inlineOnly' is private in file part (because it's inline-only) and can't be delegated from facade
|
||||
public inline fun <reified T> inlineOnly() {}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.InlineOnly
|
||||
inline fun inlineOnlyAnnotated() { }
|
||||
|
||||
@@ -7,4 +7,5 @@ public final class test/Foo {
|
||||
synthetic final class test/Foo__InlineOnlyMultifileKt {
|
||||
public final static method foo(): void
|
||||
private final static method inlineOnly(): void
|
||||
}
|
||||
private final static @kotlin.internal.InlineOnly method inlineOnlyAnnotated(): void
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
@file:[JvmName("Foo") JvmMultifileClass]
|
||||
package test
|
||||
|
||||
fun foo() {
|
||||
prop
|
||||
"".extProp
|
||||
}
|
||||
|
||||
// No method should be generated in multifile facade for 'inlineOnly'
|
||||
// Because 'inlineOnly' is private in file part (because it's inline-only) and can't be delegated from facade
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.InlineOnly
|
||||
inline var prop: String
|
||||
get() = "12"
|
||||
set(value) {}
|
||||
|
||||
inline val <reified Z> Z.extProp: String
|
||||
get() = "123"
|
||||
@@ -0,0 +1,13 @@
|
||||
@kotlin.Metadata
|
||||
public final class test/Foo {
|
||||
public final static method foo(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
synthetic final class test/Foo__InlineOnlyPropertyMultifileKt {
|
||||
public final static method foo(): void
|
||||
private final static method getExtProp(p0: java.lang.Object): java.lang.String
|
||||
private final static method getProp(): java.lang.String
|
||||
private synthetic deprecated static @kotlin.internal.InlineOnly method prop$annotations(): void
|
||||
private final static method setProp(p0: java.lang.String): void
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
|
||||
// WITH_RUNTIME
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.InlineOnly
|
||||
inline var prop: String
|
||||
get() = "12"
|
||||
set(value) {}
|
||||
|
||||
inline var prop2: String
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.InlineOnly
|
||||
get() = "12"
|
||||
set(value) {}
|
||||
|
||||
|
||||
inline val <reified Z> Z.extProp: String
|
||||
get() = "123"
|
||||
|
||||
class Foo {
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.InlineOnly
|
||||
inline var prop: String
|
||||
get() = "12"
|
||||
set(value) {}
|
||||
|
||||
inline var prop2: String
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.InlineOnly
|
||||
get() = "12"
|
||||
set(value) {}
|
||||
|
||||
|
||||
inline val <reified Z> Z.extProp: String
|
||||
get() = "123"
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
@kotlin.Metadata
|
||||
public final class Foo {
|
||||
public method <init>(): void
|
||||
private final method getExtProp(p0: java.lang.Object): java.lang.String
|
||||
private final method getProp(): java.lang.String
|
||||
private final @kotlin.internal.InlineOnly method getProp2(): java.lang.String
|
||||
private synthetic deprecated static @kotlin.internal.InlineOnly method prop$annotations(): void
|
||||
private final method setProp(p0: java.lang.String): void
|
||||
public final method setProp2(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class InlineOnlyPropertyKt {
|
||||
private final static method getExtProp(p0: java.lang.Object): java.lang.String
|
||||
private final static method getProp(): java.lang.String
|
||||
private final static @kotlin.internal.InlineOnly method getProp2(): java.lang.String
|
||||
private synthetic deprecated static @kotlin.internal.InlineOnly method prop$annotations(): void
|
||||
private final static method setProp(p0: java.lang.String): void
|
||||
public final static method setProp2(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
}
|
||||
Reference in New Issue
Block a user