KT-23397 Optimize out field for property delegate when it's safe (JVM)
This commit is contained in:
committed by
teamcity
parent
9ee0268197
commit
65b2cee913
+13
@@ -0,0 +1,13 @@
|
||||
// WITH_STDLIB
|
||||
// CHECK_BYTECODE_LISTING
|
||||
|
||||
class O {
|
||||
operator fun getValue(thisRef: Any?, property: Any?) =
|
||||
if (thisRef is I) "OK" else "Failed"
|
||||
|
||||
inner class I {
|
||||
val s: String by this@O
|
||||
}
|
||||
}
|
||||
|
||||
fun box() = O().I().s
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
@kotlin.Metadata
|
||||
public final class DelegateToOuterThisKt {
|
||||
// source: 'delegateToOuterThis.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class O$I {
|
||||
// source: 'delegateToOuterThis.kt'
|
||||
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
|
||||
private final @org.jetbrains.annotations.NotNull field s$delegate: O
|
||||
synthetic final field this$0: O
|
||||
static method <clinit>(): void
|
||||
public method <init>(p0: O): void
|
||||
public final @org.jetbrains.annotations.NotNull method getS(): java.lang.String
|
||||
public final inner class O$I
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class O {
|
||||
// source: 'delegateToOuterThis.kt'
|
||||
public method <init>(): void
|
||||
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object): java.lang.String
|
||||
public final inner class O$I
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
@kotlin.Metadata
|
||||
public final class DelegateToOuterThisKt {
|
||||
// source: 'delegateToOuterThis.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class O$I {
|
||||
// source: 'delegateToOuterThis.kt'
|
||||
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
|
||||
synthetic final field this$0: O
|
||||
static method <clinit>(): void
|
||||
public method <init>(p0: O): void
|
||||
private static method getS$delegate(p0: O$I): java.lang.Object
|
||||
public final @org.jetbrains.annotations.NotNull method getS(): java.lang.String
|
||||
public final inner class O$I
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class O {
|
||||
// source: 'delegateToOuterThis.kt'
|
||||
public method <init>(): void
|
||||
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object): java.lang.String
|
||||
public final inner class O$I
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// WITH_STDLIB
|
||||
// CHECK_BYTECODE_LISTING
|
||||
|
||||
class C {
|
||||
operator fun getValue(thisRef: Any?, property: Any?) =
|
||||
if (thisRef == this) "OK" else "Failed"
|
||||
|
||||
val s: String by this
|
||||
}
|
||||
|
||||
fun box() = C().s
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
@kotlin.Metadata
|
||||
public final class C {
|
||||
// source: 'delegateToThis.kt'
|
||||
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
|
||||
private final @org.jetbrains.annotations.NotNull field s$delegate: C
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public final @org.jetbrains.annotations.NotNull method getS(): java.lang.String
|
||||
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class DelegateToThisKt {
|
||||
// source: 'delegateToThis.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
// WITH_STDLIB
|
||||
// CHECK_BYTECODE_LISTING
|
||||
|
||||
class C {
|
||||
val s: String by this
|
||||
}
|
||||
|
||||
val c = C()
|
||||
|
||||
operator fun C.getValue(thisRef: Any?, property: Any?) =
|
||||
if (this == c && thisRef == c) "OK" else "Failed"
|
||||
|
||||
fun box() = c.s
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
@kotlin.Metadata
|
||||
public final class C {
|
||||
// source: 'delegateToThisByExtension.kt'
|
||||
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
|
||||
private final @org.jetbrains.annotations.NotNull field s$delegate: C
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public final @org.jetbrains.annotations.NotNull method getS(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class DelegateToThisByExtensionKt {
|
||||
// source: 'delegateToThisByExtension.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field c: C
|
||||
static method <clinit>(): void
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
public final static @org.jetbrains.annotations.NotNull method getC(): C
|
||||
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.NotNull p0: C, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.String
|
||||
}
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
@kotlin.Metadata
|
||||
public final class C {
|
||||
// source: 'delegateToThisByExtension.kt'
|
||||
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
private static method getS$delegate(p0: C): java.lang.Object
|
||||
public final @org.jetbrains.annotations.NotNull method getS(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class DelegateToThisByExtensionKt {
|
||||
// source: 'delegateToThisByExtension.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field c: C
|
||||
static method <clinit>(): void
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
public final static @org.jetbrains.annotations.NotNull method getC(): C
|
||||
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.NotNull p0: C, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.String
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
@kotlin.Metadata
|
||||
public final class C {
|
||||
// source: 'delegateToThis.kt'
|
||||
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
private static method getS$delegate(p0: C): java.lang.Object
|
||||
public final @org.jetbrains.annotations.NotNull method getS(): java.lang.String
|
||||
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class DelegateToThisKt {
|
||||
// source: 'delegateToThis.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
Reference in New Issue
Block a user