[FIR] During resolve, set correctly property reference type in delegate
This commit is contained in:
+2
-2
@@ -33,8 +33,8 @@ operator fun CustomDelegate3.setValue(thisRef: Any?, prop: KProperty<*>, value:
|
||||
|
||||
class Example {
|
||||
|
||||
var a by CustomDelegate()
|
||||
val aval by CustomDelegate()
|
||||
var a by <!INAPPLICABLE_CANDIDATE!>CustomDelegate()<!>
|
||||
val aval by <!INAPPLICABLE_CANDIDATE!>CustomDelegate()<!>
|
||||
var b by OkDelegate()
|
||||
var c by CustomDelegate2()
|
||||
var d by CustomDelegate3()
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ abstract class My(@Field arg: Int, @Field val w: Int) {
|
||||
fun foo() {}
|
||||
|
||||
@Field
|
||||
val v: Int by <!UNRESOLVED_REFERENCE!>Delegates<!>.<!UNRESOLVED_REFERENCE!>lazy<!> { 42 }
|
||||
val v: Int by <!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>Delegates<!>.<!UNRESOLVED_REFERENCE!>lazy<!> { 42 }<!>
|
||||
}
|
||||
|
||||
enum class Your {
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ private fun <T> lazy(init: () -> T): kotlin.Lazy<T> {
|
||||
}
|
||||
|
||||
object DefaultHttpClientWithBy : HttpClient by client {
|
||||
val client by lazy { HttpClientImpl() }
|
||||
val client by <!UNRESOLVED_REFERENCE!>lazy { HttpClientImpl() }<!>
|
||||
}
|
||||
|
||||
object DefaultFqHttpClient : HttpClient by DefaultFqHttpClient.client {
|
||||
|
||||
Vendored
+1
-1
@@ -11,7 +11,7 @@ fun test() {
|
||||
const val <T> a3 = 0
|
||||
lateinit val <T> a4 = 0
|
||||
val <T> a5 by Delegate<Int>()
|
||||
val <T> a6 by Delegate<T>()
|
||||
val <T> a6 by <!INAPPLICABLE_CANDIDATE!>Delegate<T>()<!>
|
||||
}
|
||||
|
||||
class Delegate<F> {
|
||||
|
||||
Vendored
+1
-1
@@ -11,7 +11,7 @@ fun test() {
|
||||
const val <T> a3 = 0
|
||||
lateinit val <T> a4 = 0
|
||||
val <T> a5 by Delegate<Int>()
|
||||
val <T> a6 by Delegate<T>()
|
||||
val <T> a6 by <!INAPPLICABLE_CANDIDATE!>Delegate<T>()<!>
|
||||
}
|
||||
|
||||
class Delegate<F> {
|
||||
|
||||
+2
-2
@@ -5,10 +5,10 @@ import kotlin.reflect.KProperty
|
||||
class A
|
||||
|
||||
class D {
|
||||
val c: Int by IncorrectThis<A>()
|
||||
val c: Int by <!UNRESOLVED_REFERENCE!>IncorrectThis<A>()<!>
|
||||
}
|
||||
|
||||
val cTopLevel: Int by IncorrectThis<A>()
|
||||
val cTopLevel: Int by <!UNRESOLVED_REFERENCE!>IncorrectThis<A>()<!>
|
||||
|
||||
class IncorrectThis<T> {
|
||||
fun <R> get(t: Any?, p: KProperty<*>): Int {
|
||||
|
||||
+2
-2
@@ -4,10 +4,10 @@ package foo
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
open class A {
|
||||
val B.w: Int by MyProperty()
|
||||
val B.w: Int by <!INAPPLICABLE_CANDIDATE!>MyProperty()<!>
|
||||
}
|
||||
|
||||
val B.r: Int by MyProperty()
|
||||
val B.r: Int by <!INAPPLICABLE_CANDIDATE!>MyProperty()<!>
|
||||
|
||||
val A.e: Int by MyProperty()
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -5,7 +5,7 @@ package test
|
||||
import first.*
|
||||
import second.*
|
||||
|
||||
val a12 by A()
|
||||
val a12 by <!AMBIGUITY!>A()<!>
|
||||
|
||||
// FILE: first.kt
|
||||
package first
|
||||
|
||||
@@ -8,4 +8,4 @@ class ValueWrapper()
|
||||
fun setValue(v: Int) { backingValue = v }
|
||||
}
|
||||
|
||||
val foo by ValueWrapper()
|
||||
val foo by <!INAPPLICABLE_CANDIDATE!>ValueWrapper()<!>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
val a: Int by A()
|
||||
val a: Int by <!UNRESOLVED_REFERENCE!>A()<!>
|
||||
|
||||
class A
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class B {
|
||||
val c by <!INAPPLICABLE_CANDIDATE!>Delegate<!>(<!UNRESOLVED_REFERENCE!>ag<!>)
|
||||
val c by <!UNRESOLVED_REFERENCE!><!INAPPLICABLE_CANDIDATE!>Delegate<!>(<!UNRESOLVED_REFERENCE!>ag<!>)<!>
|
||||
}
|
||||
|
||||
class Delegate<T: Any>(val init: T) {
|
||||
|
||||
Vendored
+1
-1
@@ -5,5 +5,5 @@ object T1 {
|
||||
operator fun Long.getValue(receiver: String, p: Any): Double = 1.0
|
||||
|
||||
val String.test1 by 1
|
||||
val test2 by 1
|
||||
val test2 by <!INAPPLICABLE_CANDIDATE!>1<!>
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -10,5 +10,5 @@ object T2 {
|
||||
operator fun <T> Foo<T>.getValue(receiver: String, p: Any?): T = TODO()
|
||||
|
||||
val String.test1: String by delegate()
|
||||
val test2: String by delegate()
|
||||
val test2: String by <!INAPPLICABLE_CANDIDATE!>delegate()<!>
|
||||
}
|
||||
@@ -4,12 +4,12 @@
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
val a by a
|
||||
val a by <!UNRESOLVED_REFERENCE!>a<!>
|
||||
|
||||
val b by Delegate(b)
|
||||
|
||||
val c by d
|
||||
val d by c
|
||||
val c by <!UNRESOLVED_REFERENCE!>d<!>
|
||||
val d by <!UNRESOLVED_REFERENCE!>c<!>
|
||||
|
||||
class Delegate(i: Int) {
|
||||
operator fun getValue(t: Any?, p: KProperty<*>): Int {
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import kotlin.reflect.KProperty
|
||||
val Int.a by Delegate(this)
|
||||
|
||||
class A {
|
||||
val Int.a by <!INAPPLICABLE_CANDIDATE!>Delegate<!>(this)
|
||||
val Int.a by <!UNRESOLVED_REFERENCE!><!INAPPLICABLE_CANDIDATE!>Delegate<!>(this)<!>
|
||||
}
|
||||
|
||||
class Delegate(i: Int) {
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class A {
|
||||
var a: Int by Delegate()
|
||||
var a: Int by <!INAPPLICABLE_CANDIDATE!>Delegate()<!>
|
||||
}
|
||||
|
||||
var aTopLevel: Int by Delegate()
|
||||
|
||||
+2
-2
@@ -4,10 +4,10 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class A {
|
||||
var a: Int by Delegate()
|
||||
var a: Int by <!INAPPLICABLE_CANDIDATE!>Delegate()<!>
|
||||
}
|
||||
|
||||
var aTopLevel: Int by Delegate()
|
||||
var aTopLevel: Int by <!INAPPLICABLE_CANDIDATE!>Delegate()<!>
|
||||
|
||||
class Delegate {
|
||||
fun getValue(t: Nothing, p: KProperty<*>): Int {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class A {
|
||||
val c: Int by Delegate()
|
||||
val c: Int by <!INAPPLICABLE_CANDIDATE!>Delegate()<!>
|
||||
}
|
||||
|
||||
class Delegate {
|
||||
|
||||
+2
-2
@@ -5,10 +5,10 @@ import kotlin.reflect.KProperty
|
||||
class A
|
||||
|
||||
class B {
|
||||
val b: Int by Delegate<A>()
|
||||
val b: Int by <!INAPPLICABLE_CANDIDATE!>Delegate<A>()<!>
|
||||
}
|
||||
|
||||
val bTopLevel: Int by Delegate<A>()
|
||||
val bTopLevel: Int by <!INAPPLICABLE_CANDIDATE!>Delegate<A>()<!>
|
||||
|
||||
class C {
|
||||
val c: Int by Delegate<C>()
|
||||
|
||||
Vendored
+2
-2
@@ -4,10 +4,10 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class B {
|
||||
val b: Int by Delegate()
|
||||
val b: Int by <!INAPPLICABLE_CANDIDATE!>Delegate()<!>
|
||||
}
|
||||
|
||||
val bTopLevel: Int by Delegate()
|
||||
val bTopLevel: Int by <!INAPPLICABLE_CANDIDATE!>Delegate()<!>
|
||||
|
||||
class A
|
||||
|
||||
|
||||
+2
-2
@@ -3,10 +3,10 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class A {
|
||||
val a: Int by Delegate()
|
||||
val a: Int by <!INAPPLICABLE_CANDIDATE!>Delegate()<!>
|
||||
}
|
||||
|
||||
val aTopLevel: Int by Delegate()
|
||||
val aTopLevel: Int by <!INAPPLICABLE_CANDIDATE!>Delegate()<!>
|
||||
|
||||
class Delegate {
|
||||
fun getValue(t: Any?, p: KProperty<*>, a: Int): Int {
|
||||
|
||||
Vendored
+2
-2
@@ -5,9 +5,9 @@ import kotlin.reflect.KProperty
|
||||
operator fun Any.getValue(x: Any?, y: Any): Any = null!!
|
||||
|
||||
class C {
|
||||
val x by 1
|
||||
val x by <!UNRESOLVED_REFERENCE!>1<!>
|
||||
val `$$delegatedProperties`: Array<KProperty<*>> = null!!
|
||||
}
|
||||
|
||||
val x by 1
|
||||
val x by <!UNRESOLVED_REFERENCE!>1<!>
|
||||
val `$$delegatedProperties`: Array<KProperty<*>> = null!!
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ fun foo() {
|
||||
property1 = 1
|
||||
|
||||
val
|
||||
propertyWithBy by <!UNRESOLVED_REFERENCE!>lazy<!> { 1 }
|
||||
propertyWithBy by <!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>lazy<!> { 1 }<!>
|
||||
|
||||
val
|
||||
propertyWithType: Int
|
||||
|
||||
Vendored
+1
-1
@@ -19,5 +19,5 @@ public class J {
|
||||
// FILE: k.kt
|
||||
|
||||
var A by J.staticNN
|
||||
var B by J.staticN
|
||||
var B by <!INAPPLICABLE_CANDIDATE!>J.staticN<!>
|
||||
var C by J.staticJ
|
||||
+1
-1
@@ -8,7 +8,7 @@ class Delegate {
|
||||
fun foo(): Int {
|
||||
val prop: Int by Delegate()
|
||||
|
||||
val prop2: Int by 123
|
||||
val prop2: Int by <!UNRESOLVED_REFERENCE!>123<!>
|
||||
|
||||
val obj = object {
|
||||
fun v(): Int {
|
||||
|
||||
Reference in New Issue
Block a user