FIR checker: fix REFERENCE_BY_QUALIFIED positioning strategy to consider callable reference
This commit is contained in:
committed by
Mikhail Glukhikh
parent
8d8ed4cc18
commit
bfc7eb7bab
Vendored
+3
-3
@@ -5,8 +5,8 @@ annotation class C
|
||||
enum class D
|
||||
|
||||
fun main() {
|
||||
<!UNRESOLVED_REFERENCE!>::A<!>
|
||||
::<!UNRESOLVED_REFERENCE!>A<!>
|
||||
::B
|
||||
<!CALLABLE_REFERENCE_TO_ANNOTATION_CONSTRUCTOR!>::C<!> // KT-3465
|
||||
<!UNRESOLVED_REFERENCE!>::D<!>
|
||||
::<!CALLABLE_REFERENCE_TO_ANNOTATION_CONSTRUCTOR!>C<!> // KT-3465
|
||||
::<!UNRESOLVED_REFERENCE!>D<!>
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -3,7 +3,7 @@ fun foo(x: Int, y: Any) = x
|
||||
fun foo(x: Any, y: Int) = y
|
||||
|
||||
fun main() {
|
||||
<!UNRESOLVED_REFERENCE!>::foo<!>
|
||||
::<!UNRESOLVED_REFERENCE!>foo<!>
|
||||
|
||||
val fooRef: (Int, Any) -> Unit = <!UNRESOLVED_REFERENCE!>::foo<!>
|
||||
val fooRef: (Int, Any) -> Unit = ::<!UNRESOLVED_REFERENCE!>foo<!>
|
||||
}
|
||||
|
||||
Vendored
-5
@@ -1,5 +0,0 @@
|
||||
annotation class Ann(val prop: String)
|
||||
|
||||
val annCtorRef = <!CALLABLE_REFERENCE_TO_ANNOTATION_CONSTRUCTOR!>::Ann<!>
|
||||
val annClassRef = Ann::class
|
||||
val annPropRef = Ann::prop
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
annotation class Ann(val prop: String)
|
||||
|
||||
val annCtorRef = ::<!CALLABLE_REFERENCE_TO_ANNOTATION_CONSTRUCTOR!>Ann<!>
|
||||
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
// FILE: Foo.kt
|
||||
|
||||
package test
|
||||
|
||||
class Foo {
|
||||
fun bar() {}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
import test.Foo
|
||||
|
||||
fun Foo(): String = ""
|
||||
|
||||
val f = Foo::bar
|
||||
val g = <!UNRESOLVED_REFERENCE!>Foo::length<!>
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// FILE: Foo.kt
|
||||
|
||||
package test
|
||||
|
||||
+2
-2
@@ -16,6 +16,6 @@ fun test() {
|
||||
|
||||
Outer.Companion::Wrapper
|
||||
(Outer.Companion)::Wrapper
|
||||
<!UNRESOLVED_REFERENCE!>Outer::Wrapper<!>
|
||||
<!UNRESOLVED_REFERENCE!>(Outer)::Wrapper<!>
|
||||
Outer::<!UNRESOLVED_REFERENCE!>Wrapper<!>
|
||||
(Outer)::<!UNRESOLVED_REFERENCE!>Wrapper<!>
|
||||
}
|
||||
|
||||
Vendored
-31
@@ -1,31 +0,0 @@
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION
|
||||
// FILE: a.kt
|
||||
|
||||
package first
|
||||
|
||||
import checkSubtype
|
||||
|
||||
class A
|
||||
|
||||
fun A.foo() {}
|
||||
fun A.bar() {}
|
||||
fun A.baz() {}
|
||||
|
||||
// FILE: b.kt
|
||||
|
||||
package other
|
||||
|
||||
import kotlin.reflect.KFunction1
|
||||
|
||||
import first.A
|
||||
import first.foo
|
||||
import checkSubtype
|
||||
|
||||
fun main() {
|
||||
val x = first.A::foo
|
||||
<!UNRESOLVED_REFERENCE!>first.A::bar<!>
|
||||
<!UNRESOLVED_REFERENCE!>A::baz<!>
|
||||
|
||||
checkSubtype<KFunction1<A, Unit>>(x)
|
||||
}
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION
|
||||
// FILE: a.kt
|
||||
|
||||
Vendored
-20
@@ -1,20 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
|
||||
class A {
|
||||
fun Int.extInt() = 42
|
||||
fun A.extA(x: String) = x
|
||||
|
||||
fun main() {
|
||||
<!EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED!>Int::extInt<!>
|
||||
<!EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED!>A::extA<!>
|
||||
|
||||
eat(<!EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED!>Int::extInt<!>)
|
||||
eat(<!EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED!>A::extA<!>)
|
||||
}
|
||||
}
|
||||
|
||||
fun eat(value: Any) {}
|
||||
|
||||
fun main() {
|
||||
<!UNRESOLVED_REFERENCE!>A::extInt<!>
|
||||
<!UNRESOLVED_REFERENCE!>A::extA<!>
|
||||
}
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
|
||||
class A {
|
||||
fun Int.extInt() = 42
|
||||
|
||||
Vendored
+2
-2
@@ -26,9 +26,9 @@ class A {
|
||||
|
||||
class B {
|
||||
fun main() {
|
||||
<!UNRESOLVED_REFERENCE!>::Inner<!>
|
||||
::<!UNRESOLVED_REFERENCE!>Inner<!>
|
||||
val y = A::Inner
|
||||
|
||||
checkSubtype<KFunction1<A, A.Inner>>(y)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
-23
@@ -1,23 +0,0 @@
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION
|
||||
// !LANGUAGE: +CallableReferencesToClassMembersWithEmptyLHS
|
||||
|
||||
import kotlin.reflect.KFunction1
|
||||
|
||||
class A {
|
||||
inner class Inner
|
||||
}
|
||||
|
||||
fun A.main() {
|
||||
::Inner
|
||||
val y = A::Inner
|
||||
|
||||
checkSubtype<KFunction1<A, A.Inner>>(y)
|
||||
}
|
||||
|
||||
fun Int.main() {
|
||||
<!UNRESOLVED_REFERENCE!>::Inner<!>
|
||||
val y = A::Inner
|
||||
|
||||
checkSubtype<KFunction1<A, A.Inner>>(y)
|
||||
}
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION
|
||||
// !LANGUAGE: +CallableReferencesToClassMembersWithEmptyLHS
|
||||
|
||||
Vendored
-14
@@ -1,14 +0,0 @@
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION
|
||||
import kotlin.reflect.KFunction1
|
||||
|
||||
class A {
|
||||
inner class Inner
|
||||
}
|
||||
|
||||
fun main() {
|
||||
<!UNRESOLVED_REFERENCE!>::Inner<!>
|
||||
val y = A::Inner
|
||||
|
||||
checkSubtype<KFunction1<A, A.Inner>>(y)
|
||||
}
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION
|
||||
import kotlin.reflect.KFunction1
|
||||
|
||||
Vendored
-33
@@ -1,33 +0,0 @@
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION
|
||||
import kotlin.reflect.KFunction0
|
||||
|
||||
class A {
|
||||
class Nested
|
||||
|
||||
fun main() {
|
||||
val x = ::Nested
|
||||
val y = A::Nested
|
||||
|
||||
checkSubtype<KFunction0<Nested>>(x)
|
||||
checkSubtype<KFunction0<Nested>>(y)
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun main() {
|
||||
::Nested
|
||||
val y = A::Nested
|
||||
|
||||
checkSubtype<KFunction0<A.Nested>>(y)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class B {
|
||||
fun main() {
|
||||
<!UNRESOLVED_REFERENCE!>::Nested<!>
|
||||
val y = A::Nested
|
||||
|
||||
checkSubtype<KFunction0<A.Nested>>(y)
|
||||
}
|
||||
}
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION
|
||||
import kotlin.reflect.KFunction0
|
||||
|
||||
compiler/testData/diagnostics/tests/callableReference/function/nestedConstructorFromExtension.fir.kt
Vendored
-21
@@ -1,21 +0,0 @@
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION
|
||||
import kotlin.reflect.KFunction0
|
||||
|
||||
class A {
|
||||
class Nested
|
||||
}
|
||||
|
||||
fun A.main() {
|
||||
<!UNRESOLVED_REFERENCE!>::Nested<!>
|
||||
val y = A::Nested
|
||||
|
||||
checkSubtype<KFunction0<A.Nested>>(y)
|
||||
}
|
||||
|
||||
fun Int.main() {
|
||||
<!UNRESOLVED_REFERENCE!>::Nested<!>
|
||||
val y = A::Nested
|
||||
|
||||
checkSubtype<KFunction0<A.Nested>>(y)
|
||||
}
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION
|
||||
import kotlin.reflect.KFunction0
|
||||
|
||||
Vendored
+2
-2
@@ -25,7 +25,7 @@ class A {
|
||||
|
||||
expectFunction0Unit(::foo)
|
||||
expectFunction0String(::foo)
|
||||
<!INAPPLICABLE_CANDIDATE!>expectFunction1Unit<!>(<!UNRESOLVED_REFERENCE!>::foo<!>)
|
||||
<!INAPPLICABLE_CANDIDATE!>expectFunction1String<!>(<!UNRESOLVED_REFERENCE!>::foo<!>)
|
||||
<!INAPPLICABLE_CANDIDATE!>expectFunction1Unit<!>(::<!UNRESOLVED_REFERENCE!>foo<!>)
|
||||
<!INAPPLICABLE_CANDIDATE!>expectFunction1String<!>(::<!UNRESOLVED_REFERENCE!>foo<!>)
|
||||
}
|
||||
}
|
||||
|
||||
+8
-8
@@ -4,21 +4,21 @@
|
||||
class A
|
||||
|
||||
fun test1() {
|
||||
val foo = <!UNRESOLVED_REFERENCE!>::foo<!>
|
||||
val foo = ::<!UNRESOLVED_REFERENCE!>foo<!>
|
||||
|
||||
<!UNRESOLVED_REFERENCE!>::bar<!>
|
||||
::<!UNRESOLVED_REFERENCE!>bar<!>
|
||||
|
||||
<!UNRESOLVED_REFERENCE!>A::bar<!>
|
||||
A::<!UNRESOLVED_REFERENCE!>bar<!>
|
||||
|
||||
<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>B<!>::bar<!>
|
||||
<!UNRESOLVED_REFERENCE!>B<!>::<!UNRESOLVED_REFERENCE!>bar<!>
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
fun foo(x: Any) {}
|
||||
fun foo() {}
|
||||
|
||||
<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>Unresolved<!>::foo<!>
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>Unresolved<!>::foo<!>)
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>Unresolved<!>::unresolved<!>)
|
||||
<!UNRESOLVED_REFERENCE!>::unresolved<!>
|
||||
<!UNRESOLVED_REFERENCE!>Unresolved<!>::<!UNRESOLVED_REFERENCE!>foo<!>
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(<!UNRESOLVED_REFERENCE!>Unresolved<!>::<!UNRESOLVED_REFERENCE!>foo<!>)
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(<!UNRESOLVED_REFERENCE!>Unresolved<!>::<!UNRESOLVED_REFERENCE!>unresolved<!>)
|
||||
::<!UNRESOLVED_REFERENCE!>unresolved<!>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user