FIR2IR: add local delegated property generation

This commit is contained in:
pyos
2020-09-07 14:11:17 +02:00
committed by Mikhail Glukhikh
parent 4792be2522
commit f198a19ab0
43 changed files with 211 additions and 217 deletions
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class Del<T>(var x: T) {
operator fun getValue(thisRef: Any?, kProp: Any) = x
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
@@ -1,6 +1,5 @@
// WITH_RUNTIME
// KJS_WITH_FULL_RUNTIME
// IGNORE_BACKEND_FIR: JVM_IR
val log = StringBuilder()
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
package foo
import kotlin.reflect.KProperty
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
package foo
import kotlin.reflect.KProperty
@@ -14,7 +14,8 @@ class Delegate {
fun box(): String {
var prop: Int by Delegate()
if (prop != 1) return "fail get 1"
run { prop = 2 }
if (prop != 2) return "fail get"
return run { if (prop != 2) "fail set" else "OK" }
if (prop != 2) return "fail get 2"
return run { if (prop != 2) "fail get 3" else "OK" }
}
@@ -14,7 +14,8 @@ class Delegate {
fun box(): String {
var prop: Int by Delegate()
if (prop != 1) return "fail get 1"
run { prop = 2 }
if (prop != 2) return "fail get"
return run { if (prop != 2) "fail set" else "OK" }
if (prop != 2) return "fail get 2"
return run { if (prop != 2) "fail get 3" else "OK" }
}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
package foo
import kotlin.reflect.KProperty
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
package foo
import kotlin.reflect.KProperty
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
//WITH_RUNTIME
fun box(): String {
val x by lazy { "OK" }
@@ -1,5 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
object Whatever {
operator fun getValue(thisRef: Any?, prop: Any?) = "OK"
}
@@ -1,5 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class Delegate(val value: String) {
operator fun getValue(thisRef: Any?, kProperty: Any?) = value
}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
package foo
import kotlin.reflect.KProperty
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
package foo
import kotlin.reflect.KProperty
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
package foo
import kotlin.reflect.KProperty
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
package foo
import kotlin.reflect.KProperty
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class Provider<T>(val _value: T) {
inline operator fun provideDelegate(thisRef: Any?, kProperty: Any?) =
Mut(_value)
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class Provider<T>(val _value: T) {
inline operator fun provideDelegate(thisRef: Any?, kProperty: Any) =
Mut(_value)
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// MODULE: lib
// FILE: lib.kt
package lib
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// MODULE: lib
// FILE: lib.kt
package lib
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
import kotlin.reflect.KProperty
operator fun Int.provideDelegate(thiz: Any?, property: KProperty<*>): String = property.name
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
val topLevelLazyVal by lazy { 1 }
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
import kotlin.reflect.KProperty
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
import kotlin.test.*
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
import kotlin.test.*
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
import kotlin.test.*
@@ -1,5 +1,4 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
import kotlin.reflect.KMutableProperty0
@@ -1,5 +1,4 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND_FIR: JVM_IR
var setterInvoked = 0
@@ -1,5 +1,4 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND_FIR: JVM_IR
var setterInvoked = 0
@@ -1,5 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
import kotlin.reflect.KProperty
inline class ICInt(val i: Int)