Deprecate (V)::a reference resolution to companion in FE 1.0

^KT-45315 Fixed
This commit is contained in:
Denis.Zharkov
2021-06-17 16:20:11 +03:00
committed by TeamCityServer
parent 46b297477c
commit 7645663d12
19 changed files with 152 additions and 15 deletions
@@ -27,10 +27,10 @@ fun test() {
val r4 = test.C.Companion::foo
checkSubtype<() -> String>(r4)
val r5 = (C)::foo
val r5 = <!PARENTHESIZED_COMPANION_LHS_DEPRECATION!>(C)<!>::foo
checkSubtype<() -> String>(r5)
val r6 = (test.C)::foo
val r6 = <!PARENTHESIZED_COMPANION_LHS_DEPRECATION!>(test.C)<!>::foo
checkSubtype<() -> String>(r6)
val c = C.Companion
@@ -0,0 +1,34 @@
// !CHECK_TYPE
// SKIP_TXT
// FILE: lib.kt
package test.abc
class V {
companion object
}
val V.a: String
get() = "1"
val V.Companion.a: Int
get() = 1
// FILE: main.kt
import test.abc.V
import test.abc.a
import kotlin.reflect.KProperty0
import kotlin.reflect.KProperty1
fun case() {
(V)::a checkType { <!INAPPLICABLE_CANDIDATE!>_<!><KProperty0<Int>>() }
(V)::a checkType { _<KProperty1<V, String>>() }
(test.abc.V)::a checkType { <!INAPPLICABLE_CANDIDATE!>_<!><KProperty0<Int>>() }
(test.abc.V)::a checkType { _<KProperty1<V, String>>() }
V::a checkType { _<KProperty1<V, String>>() }
V.Companion::a checkType { _<KProperty0<Int>>() }
(V.Companion)::a checkType { _<KProperty0<Int>>() }
}
@@ -0,0 +1,34 @@
// !CHECK_TYPE
// SKIP_TXT
// FILE: lib.kt
package test.abc
class V {
companion object
}
val V.a: String
get() = "1"
val V.Companion.a: Int
get() = 1
// FILE: main.kt
import test.abc.V
import test.abc.a
import kotlin.reflect.KProperty0
import kotlin.reflect.KProperty1
fun case() {
<!PARENTHESIZED_COMPANION_LHS_DEPRECATION!>(V)<!>::a checkType { _<KProperty0<Int>>() }
<!PARENTHESIZED_COMPANION_LHS_DEPRECATION!>(V)<!>::a checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><KProperty1<V, String>>() }
<!PARENTHESIZED_COMPANION_LHS_DEPRECATION!>(test.abc.V)<!>::a checkType { _<KProperty0<Int>>() }
<!PARENTHESIZED_COMPANION_LHS_DEPRECATION!>(test.abc.V)<!>::a checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><KProperty1<V, String>>() }
V::a checkType { _<KProperty1<V, String>>() }
V.Companion::a checkType { _<KProperty0<Int>>() }
(V.Companion)::a checkType { _<KProperty0<Int>>() }
}