Generate local delegated properties in interface in jvm-default all modes

This commit is contained in:
Mikhael Bogdanov
2021-02-25 09:24:39 +01:00
parent c25a694b6b
commit 49aa36b70d
17 changed files with 318 additions and 18 deletions
@@ -0,0 +1,26 @@
// CHECK_BYTECODE_LISTING
// !JVM_DEFAULT_MODE: all-compatibility
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
// WITH_RUNTIME
// WITH_REFLECT
import kotlin.reflect.KProperty
class Delegate {
operator fun getValue(t: Any?, p: KProperty<*>): String {
return p.returnType.toString()
}
}
interface Foo {
fun test(): String {
val OK by Delegate()
return OK
}
}
fun box(): String {
return if (object : Foo {}.test() != "kotlin.String") "fail" else "OK"
}
@@ -0,0 +1,38 @@
@kotlin.Metadata
public final class Delegate {
// source: 'localDelegatedProperties.kt'
public method <init>(): void
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty): java.lang.String
}
@kotlin.Metadata
public final class Foo$DefaultImpls {
// source: 'localDelegatedProperties.kt'
public deprecated static @java.lang.Deprecated @org.jetbrains.annotations.NotNull method test(@org.jetbrains.annotations.NotNull p0: Foo): java.lang.String
public final inner class Foo$DefaultImpls
}
@kotlin.Metadata
public interface Foo {
// source: 'localDelegatedProperties.kt'
public synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
static method <clinit>(): void
public synthetic static method access$test$jd(p0: Foo): java.lang.String
public @org.jetbrains.annotations.NotNull method test(): java.lang.String
public final inner class Foo$DefaultImpls
}
@kotlin.Metadata
public final class LocalDelegatedPropertiesKt$box$1 {
// source: 'localDelegatedProperties.kt'
enclosing method LocalDelegatedPropertiesKt.box()Ljava/lang/String;
inner (anonymous) class LocalDelegatedPropertiesKt$box$1
method <init>(): void
}
@kotlin.Metadata
public final class LocalDelegatedPropertiesKt {
// source: 'localDelegatedProperties.kt'
inner (anonymous) class LocalDelegatedPropertiesKt$box$1
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}
@@ -0,0 +1,41 @@
@kotlin.Metadata
public final class Delegate {
// source: 'localDelegatedProperties.kt'
public method <init>(): void
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty): java.lang.String
}
@kotlin.Metadata
public final class Foo$DefaultImpls {
// source: 'localDelegatedProperties.kt'
private deprecated static @java.lang.Deprecated method test$lambda-0(p0: Delegate): java.lang.String
public deprecated static @java.lang.Deprecated @org.jetbrains.annotations.NotNull method test(@org.jetbrains.annotations.NotNull p0: Foo): java.lang.String
public final inner class Foo$DefaultImpls
}
@kotlin.Metadata
public interface Foo {
// source: 'localDelegatedProperties.kt'
public synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
static method <clinit>(): void
public synthetic static method access$test$jd(p0: Foo): java.lang.String
public synthetic static method access$test$lambda-0(p0: Delegate): java.lang.String
private static method test$lambda-0(p0: Delegate): java.lang.String
public @org.jetbrains.annotations.NotNull method test(): java.lang.String
public final inner class Foo$DefaultImpls
}
@kotlin.Metadata
public final class LocalDelegatedPropertiesKt$box$1 {
// source: 'localDelegatedProperties.kt'
enclosing method LocalDelegatedPropertiesKt.box()Ljava/lang/String;
inner (anonymous) class LocalDelegatedPropertiesKt$box$1
method <init>(): void
}
@kotlin.Metadata
public final class LocalDelegatedPropertiesKt {
// source: 'localDelegatedProperties.kt'
inner (anonymous) class LocalDelegatedPropertiesKt$box$1
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}
@@ -0,0 +1,26 @@
// CHECK_BYTECODE_LISTING
// !JVM_DEFAULT_MODE: all
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
// WITH_REFLECT
import kotlin.reflect.KProperty
class Delegate {
operator fun getValue(t: Any?, p: KProperty<*>): String {
return p.returnType.toString()
}
}
interface Foo {
fun test(): String {
val OK by Delegate()
return OK
}
}
fun box(): String {
return if (object : Foo {}.test() != "kotlin.String") "fail" else "OK"
}
@@ -0,0 +1,29 @@
@kotlin.Metadata
public final class Delegate {
// source: 'localDelegatedProperties.kt'
public method <init>(): void
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty): java.lang.String
}
@kotlin.Metadata
public interface Foo {
// source: 'localDelegatedProperties.kt'
public synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
static method <clinit>(): void
public @org.jetbrains.annotations.NotNull method test(): java.lang.String
}
@kotlin.Metadata
public final class LocalDelegatedPropertiesKt$box$1 {
// source: 'localDelegatedProperties.kt'
enclosing method LocalDelegatedPropertiesKt.box()Ljava/lang/String;
inner (anonymous) class LocalDelegatedPropertiesKt$box$1
method <init>(): void
}
@kotlin.Metadata
public final class LocalDelegatedPropertiesKt {
// source: 'localDelegatedProperties.kt'
inner (anonymous) class LocalDelegatedPropertiesKt$box$1
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}
@@ -0,0 +1,29 @@
// !JVM_DEFAULT_MODE: all
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
import kotlin.reflect.KProperty
class Delegate {
operator fun getValue(t: Any?, p: KProperty<*>): String = p.name
}
interface Foo {
fun test(): String {
val O by Delegate()
return O
}
}
interface Foo2: Foo {
override fun test(): String {
val K by Delegate()
return super.test() + K
}
}
fun box(): String {
return object : Foo2 {}.test()
}
@@ -0,0 +1,30 @@
@kotlin.Metadata
public final class Delegate {
// source: 'localDelegatedProperties.kt'
public method <init>(): void
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty): java.lang.String
}
@kotlin.Metadata
public interface Foo {
// source: 'localDelegatedProperties.kt'
public synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
static method <clinit>(): void
private static method test$lambda-0(p0: Delegate): java.lang.String
public @org.jetbrains.annotations.NotNull method test(): java.lang.String
}
@kotlin.Metadata
public final class LocalDelegatedPropertiesKt$box$1 {
// source: 'localDelegatedProperties.kt'
enclosing method LocalDelegatedPropertiesKt.box()Ljava/lang/String;
inner (anonymous) class LocalDelegatedPropertiesKt$box$1
method <init>(): void
}
@kotlin.Metadata
public final class LocalDelegatedPropertiesKt {
// source: 'localDelegatedProperties.kt'
inner (anonymous) class LocalDelegatedPropertiesKt$box$1
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}