[FIR] Handle unresolved callable references more correctly
This commit is contained in:
+20
-5
@@ -7,7 +7,9 @@ package org.jetbrains.kotlin.fir.resolve.transformers
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.Modality
|
import org.jetbrains.kotlin.descriptors.Modality
|
||||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||||
import org.jetbrains.kotlin.fir.*
|
import org.jetbrains.kotlin.fir.FirElement
|
||||||
|
import org.jetbrains.kotlin.fir.FirSession
|
||||||
|
import org.jetbrains.kotlin.fir.copy
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
||||||
import org.jetbrains.kotlin.fir.declarations.addDefaultBoundIfNecessary
|
import org.jetbrains.kotlin.fir.declarations.addDefaultBoundIfNecessary
|
||||||
import org.jetbrains.kotlin.fir.declarations.impl.FirDeclarationStatusImpl
|
import org.jetbrains.kotlin.fir.declarations.impl.FirDeclarationStatusImpl
|
||||||
@@ -16,10 +18,13 @@ import org.jetbrains.kotlin.fir.declarations.impl.FirTypeParameterImpl
|
|||||||
import org.jetbrains.kotlin.fir.declarations.impl.FirValueParameterImpl
|
import org.jetbrains.kotlin.fir.declarations.impl.FirValueParameterImpl
|
||||||
import org.jetbrains.kotlin.fir.expressions.*
|
import org.jetbrains.kotlin.fir.expressions.*
|
||||||
import org.jetbrains.kotlin.fir.expressions.impl.FirFunctionCallImpl
|
import org.jetbrains.kotlin.fir.expressions.impl.FirFunctionCallImpl
|
||||||
|
import org.jetbrains.kotlin.fir.inferenceContext
|
||||||
import org.jetbrains.kotlin.fir.references.FirReference
|
import org.jetbrains.kotlin.fir.references.FirReference
|
||||||
|
import org.jetbrains.kotlin.fir.references.impl.FirErrorNamedReferenceImpl
|
||||||
import org.jetbrains.kotlin.fir.references.impl.FirStubReference
|
import org.jetbrains.kotlin.fir.references.impl.FirStubReference
|
||||||
import org.jetbrains.kotlin.fir.resolve.BodyResolveComponents
|
import org.jetbrains.kotlin.fir.resolve.BodyResolveComponents
|
||||||
import org.jetbrains.kotlin.fir.resolve.calls.*
|
import org.jetbrains.kotlin.fir.resolve.calls.*
|
||||||
|
import org.jetbrains.kotlin.fir.resolve.diagnostics.FirUnresolvedNameError
|
||||||
import org.jetbrains.kotlin.fir.resolve.inference.FirCallCompleter
|
import org.jetbrains.kotlin.fir.resolve.inference.FirCallCompleter
|
||||||
import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirAbstractBodyResolveTransformer
|
import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirAbstractBodyResolveTransformer
|
||||||
import org.jetbrains.kotlin.fir.resolve.withNullability
|
import org.jetbrains.kotlin.fir.resolve.withNullability
|
||||||
@@ -108,7 +113,13 @@ class FirSyntheticCallGenerator(
|
|||||||
val reference =
|
val reference =
|
||||||
generateCalleeReferenceWithCandidate(
|
generateCalleeReferenceWithCandidate(
|
||||||
idFunction, arguments, SyntheticCallableId.ID.callableName, CallKind.SyntheticIdForCallableReferencesResolution
|
idFunction, arguments, SyntheticCallableId.ID.callableName, CallKind.SyntheticIdForCallableReferencesResolution
|
||||||
) ?: return null
|
) ?: return callableReferenceAccess.transformCalleeReference(
|
||||||
|
StoreCalleeReference,
|
||||||
|
FirErrorNamedReferenceImpl(
|
||||||
|
callableReferenceAccess.source,
|
||||||
|
FirUnresolvedNameError(callableReferenceAccess.calleeReference.name)
|
||||||
|
)
|
||||||
|
)
|
||||||
val fakeCallElement = FirFunctionCallImpl(null).copy(calleeReference = reference, arguments = arguments)
|
val fakeCallElement = FirFunctionCallImpl(null).copy(calleeReference = reference, arguments = arguments)
|
||||||
|
|
||||||
return callCompleter.completeCall(fakeCallElement, expectedTypeRef).arguments[0] as FirCallableReferenceAccess?
|
return callCompleter.completeCall(fakeCallElement, expectedTypeRef).arguments[0] as FirCallableReferenceAccess?
|
||||||
@@ -204,7 +215,9 @@ class FirSyntheticCallGenerator(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun generateMemberFunction(session: FirSession, symbol: FirNamedFunctionSymbol, name: Name, returnType: FirTypeRef): FirSimpleFunctionImpl {
|
private fun generateMemberFunction(
|
||||||
|
session: FirSession, symbol: FirNamedFunctionSymbol, name: Name, returnType: FirTypeRef
|
||||||
|
): FirSimpleFunctionImpl {
|
||||||
val status = FirDeclarationStatusImpl(Visibilities.PUBLIC, Modality.FINAL).apply {
|
val status = FirDeclarationStatusImpl(Visibilities.PUBLIC, Modality.FINAL).apply {
|
||||||
isExpect = false
|
isExpect = false
|
||||||
isActual = false
|
isActual = false
|
||||||
@@ -229,8 +242,10 @@ class FirSyntheticCallGenerator(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun FirResolvedTypeRef.toValueParameter(session: FirSession, name: String, isVararg: Boolean = false): FirValueParameterImpl {
|
private fun FirResolvedTypeRef.toValueParameter(
|
||||||
val name = Name.identifier(name)
|
session: FirSession, nameAsString: String, isVararg: Boolean = false
|
||||||
|
): FirValueParameterImpl {
|
||||||
|
val name = Name.identifier(nameAsString)
|
||||||
return FirValueParameterImpl(
|
return FirValueParameterImpl(
|
||||||
session = session,
|
session = session,
|
||||||
source = null,
|
source = null,
|
||||||
|
|||||||
+4
-4
@@ -87,21 +87,21 @@ internal object StoreNameReference : FirDefaultTransformer<FirNamedReference>()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal object StoreCalleeReference : FirTransformer<FirResolvedNamedReference>() {
|
internal object StoreCalleeReference : FirTransformer<FirNamedReference>() {
|
||||||
override fun <E : FirElement> transformElement(element: E, data: FirResolvedNamedReference): CompositeTransformResult<E> {
|
override fun <E : FirElement> transformElement(element: E, data: FirNamedReference): CompositeTransformResult<E> {
|
||||||
return element.compose()
|
return element.compose()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun transformNamedReference(
|
override fun transformNamedReference(
|
||||||
namedReference: FirNamedReference,
|
namedReference: FirNamedReference,
|
||||||
data: FirResolvedNamedReference
|
data: FirNamedReference
|
||||||
): CompositeTransformResult<FirNamedReference> {
|
): CompositeTransformResult<FirNamedReference> {
|
||||||
return data.compose()
|
return data.compose()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun transformResolvedNamedReference(
|
override fun transformResolvedNamedReference(
|
||||||
resolvedNamedReference: FirResolvedNamedReference,
|
resolvedNamedReference: FirResolvedNamedReference,
|
||||||
data: FirResolvedNamedReference
|
data: FirNamedReference
|
||||||
): CompositeTransformResult<FirNamedReference> {
|
): CompositeTransformResult<FirNamedReference> {
|
||||||
return data.compose()
|
return data.compose()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ class Your {
|
|||||||
|
|
||||||
class My {
|
class My {
|
||||||
fun foo() {
|
fun foo() {
|
||||||
val x = ::Nested // Should be error
|
val x = <!UNRESOLVED_REFERENCE!>::Nested<!> // Should be error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ FILE: errCallable.kt
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final fun foo(): R|kotlin/Unit| {
|
public final fun foo(): R|kotlin/Unit| {
|
||||||
lval x: <ERROR TYPE REF: No result type for initializer> = ::Nested#
|
lval x: <ERROR TYPE REF: No result type for initializer> = ::<Unresolved name: Nested>#
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public final fun R|Your|.foo(): R|kotlin/Unit| {
|
public final fun R|Your|.foo(): R|kotlin/Unit| {
|
||||||
lval x: <ERROR TYPE REF: No result type for initializer> = ::Nested#
|
lval x: R|kotlin/reflect/KFunction0<Your.Nested>| = ::R|/Your.Nested.Nested|
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
fun test() = ("").<!UNRESOLVED_REFERENCE!>hashCode<!>::hashCode
|
fun test() = <!UNRESOLVED_REFERENCE!>("").<!UNRESOLVED_REFERENCE!>hashCode<!>::hashCode<!>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class Foo {
|
class Foo {
|
||||||
fun bar() {}
|
fun bar() {}
|
||||||
fun f() = <!UNRESOLVED_REFERENCE!>Unresolved<!>()::bar
|
fun f() = <!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>Unresolved<!>()::bar<!>
|
||||||
}
|
}
|
||||||
|
|
||||||
val f: () -> Unit = <!UNRESOLVED_REFERENCE!>Unresolved<!>()::foo
|
val f: () -> Unit = <!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>Unresolved<!>()::foo<!>
|
||||||
|
|||||||
Vendored
+2
-2
@@ -5,8 +5,8 @@ annotation class C
|
|||||||
enum class D
|
enum class D
|
||||||
|
|
||||||
fun main() {
|
fun main() {
|
||||||
::A
|
<!UNRESOLVED_REFERENCE!>::A<!>
|
||||||
::B
|
::B
|
||||||
::C // KT-3465
|
::C // KT-3465
|
||||||
::D
|
<!UNRESOLVED_REFERENCE!>::D<!>
|
||||||
}
|
}
|
||||||
+1
-1
@@ -13,4 +13,4 @@ import test.Foo
|
|||||||
fun Foo(): String = ""
|
fun Foo(): String = ""
|
||||||
|
|
||||||
val f = Foo::bar
|
val f = Foo::bar
|
||||||
val g = Foo::length
|
val g = <!UNRESOLVED_REFERENCE!>Foo::length<!>
|
||||||
|
|||||||
Vendored
+2
-2
@@ -21,8 +21,8 @@ import first.foo
|
|||||||
|
|
||||||
fun main() {
|
fun main() {
|
||||||
val x = first.A::foo
|
val x = first.A::foo
|
||||||
first.A::bar
|
<!UNRESOLVED_REFERENCE!>first.A::bar<!>
|
||||||
A::baz
|
<!UNRESOLVED_REFERENCE!>A::baz<!>
|
||||||
|
|
||||||
checkSubtype<KFunction1<A, Unit>>(x)
|
checkSubtype<KFunction1<A, Unit>>(x)
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+2
-2
@@ -15,6 +15,6 @@ class A {
|
|||||||
fun eat(value: Any) {}
|
fun eat(value: Any) {}
|
||||||
|
|
||||||
fun main() {
|
fun main() {
|
||||||
A::extInt
|
<!UNRESOLVED_REFERENCE!>A::extInt<!>
|
||||||
A::extA
|
<!UNRESOLVED_REFERENCE!>A::extA<!>
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -26,7 +26,7 @@ class A {
|
|||||||
|
|
||||||
class B {
|
class B {
|
||||||
fun main() {
|
fun main() {
|
||||||
::Inner
|
<!UNRESOLVED_REFERENCE!>::Inner<!>
|
||||||
val y = A::Inner
|
val y = A::Inner
|
||||||
|
|
||||||
checkSubtype<KFunction1<A, A.Inner>>(y)
|
checkSubtype<KFunction1<A, A.Inner>>(y)
|
||||||
|
|||||||
Vendored
+1
-1
@@ -16,7 +16,7 @@ fun A.main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun Int.main() {
|
fun Int.main() {
|
||||||
::Inner
|
<!UNRESOLVED_REFERENCE!>::Inner<!>
|
||||||
val y = A::Inner
|
val y = A::Inner
|
||||||
|
|
||||||
checkSubtype<KFunction1<A, A.Inner>>(y)
|
checkSubtype<KFunction1<A, A.Inner>>(y)
|
||||||
|
|||||||
Vendored
+1
-1
@@ -7,7 +7,7 @@ class A {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun main() {
|
fun main() {
|
||||||
::Inner
|
<!UNRESOLVED_REFERENCE!>::Inner<!>
|
||||||
val y = A::Inner
|
val y = A::Inner
|
||||||
|
|
||||||
checkSubtype<KFunction1<A, A.Inner>>(y)
|
checkSubtype<KFunction1<A, A.Inner>>(y)
|
||||||
|
|||||||
Vendored
+1
-1
@@ -25,7 +25,7 @@ class A {
|
|||||||
|
|
||||||
class B {
|
class B {
|
||||||
fun main() {
|
fun main() {
|
||||||
::Nested
|
<!UNRESOLVED_REFERENCE!>::Nested<!>
|
||||||
val y = A::Nested
|
val y = A::Nested
|
||||||
|
|
||||||
<!INAPPLICABLE_CANDIDATE!>checkSubtype<!><KFunction0<A.Nested>>(y)
|
<!INAPPLICABLE_CANDIDATE!>checkSubtype<!><KFunction0<A.Nested>>(y)
|
||||||
|
|||||||
compiler/testData/diagnostics/tests/callableReference/function/nestedConstructorFromExtension.fir.kt
Vendored
+1
-1
@@ -14,7 +14,7 @@ fun A.main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun Int.main() {
|
fun Int.main() {
|
||||||
::Nested
|
<!UNRESOLVED_REFERENCE!>::Nested<!>
|
||||||
val y = A::Nested
|
val y = A::Nested
|
||||||
|
|
||||||
<!INAPPLICABLE_CANDIDATE!>checkSubtype<!><KFunction0<A.Nested>>(y)
|
<!INAPPLICABLE_CANDIDATE!>checkSubtype<!><KFunction0<A.Nested>>(y)
|
||||||
|
|||||||
+8
-8
@@ -4,21 +4,21 @@
|
|||||||
class A
|
class A
|
||||||
|
|
||||||
fun test1() {
|
fun test1() {
|
||||||
val foo = ::foo
|
val foo = <!UNRESOLVED_REFERENCE!>::foo<!>
|
||||||
|
|
||||||
::bar
|
<!UNRESOLVED_REFERENCE!>::bar<!>
|
||||||
|
|
||||||
A::bar
|
<!UNRESOLVED_REFERENCE!>A::bar<!>
|
||||||
|
|
||||||
<!UNRESOLVED_REFERENCE!>B<!>::bar
|
<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>B<!>::bar<!>
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test2() {
|
fun test2() {
|
||||||
fun foo(x: Any) {}
|
fun foo(x: Any) {}
|
||||||
fun foo() {}
|
fun foo() {}
|
||||||
|
|
||||||
<!UNRESOLVED_REFERENCE!>Unresolved<!>::foo
|
<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>Unresolved<!>::foo<!>
|
||||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(<!UNRESOLVED_REFERENCE!>Unresolved<!>::foo)
|
<!INAPPLICABLE_CANDIDATE!>foo<!>(<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>Unresolved<!>::foo<!>)
|
||||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(<!UNRESOLVED_REFERENCE!>Unresolved<!>::unresolved)
|
<!INAPPLICABLE_CANDIDATE!>foo<!>(<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>Unresolved<!>::unresolved<!>)
|
||||||
::unresolved
|
<!UNRESOLVED_REFERENCE!>::unresolved<!>
|
||||||
}
|
}
|
||||||
@@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
fun main() {
|
fun main() {
|
||||||
Configuration().commands {
|
Configuration().commands {
|
||||||
<!INAPPLICABLE_CANDIDATE!>Command1<!> { <!UNRESOLVED_REFERENCE!>someService<!>::execute } // Overload resolution ambiguity. All these functions match.
|
<!INAPPLICABLE_CANDIDATE!>Command1<!> { <!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>someService<!>::execute<!> } // Overload resolution ambiguity. All these functions match.
|
||||||
<!INAPPLICABLE_CANDIDATE!>Command2<!> { <!UNRESOLVED_REFERENCE!>someService<!>::execute } // Overload resolution ambiguity. All these functions match.
|
<!INAPPLICABLE_CANDIDATE!>Command2<!> { <!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>someService<!>::execute<!> } // Overload resolution ambiguity. All these functions match.
|
||||||
<!INAPPLICABLE_CANDIDATE!>Command1<!> { { <!UNRESOLVED_REFERENCE!>someService<!>.<!UNRESOLVED_REFERENCE!>execute<!>(<!UNRESOLVED_REFERENCE!>it<!>) } } // fine
|
<!INAPPLICABLE_CANDIDATE!>Command1<!> { { <!UNRESOLVED_REFERENCE!>someService<!>.<!UNRESOLVED_REFERENCE!>execute<!>(<!UNRESOLVED_REFERENCE!>it<!>) } } // fine
|
||||||
<!INAPPLICABLE_CANDIDATE!>Command2<!> { { <!UNRESOLVED_REFERENCE!>someService<!>.<!UNRESOLVED_REFERENCE!>execute<!>(<!UNRESOLVED_REFERENCE!>it<!>) } } // fine
|
<!INAPPLICABLE_CANDIDATE!>Command2<!> { { <!UNRESOLVED_REFERENCE!>someService<!>.<!UNRESOLVED_REFERENCE!>execute<!>(<!UNRESOLVED_REFERENCE!>it<!>) } } // fine
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -4,8 +4,8 @@ class Unrelated()
|
|||||||
|
|
||||||
class Test(val name: String = "") {
|
class Test(val name: String = "") {
|
||||||
init {
|
init {
|
||||||
Unrelated::name
|
<!UNRESOLVED_REFERENCE!>Unrelated::name<!>
|
||||||
Unrelated::foo
|
<!UNRESOLVED_REFERENCE!>Unrelated::foo<!>
|
||||||
}
|
}
|
||||||
|
|
||||||
fun foo() {}
|
fun foo() {}
|
||||||
|
|||||||
+2
-2
@@ -21,6 +21,6 @@ fun test() {
|
|||||||
A.Companion::ext2
|
A.Companion::ext2
|
||||||
A::ext2
|
A::ext2
|
||||||
|
|
||||||
A::foo
|
<!UNRESOLVED_REFERENCE!>A::foo<!>
|
||||||
A::bar
|
<!UNRESOLVED_REFERENCE!>A::bar<!>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
package foo
|
package foo
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
foo::test
|
<!UNRESOLVED_REFERENCE!>foo::test<!>
|
||||||
}
|
}
|
||||||
|
|
||||||
// FILE: qualifiedName.kt
|
// FILE: qualifiedName.kt
|
||||||
@@ -12,5 +12,5 @@ fun test() {
|
|||||||
package foo.bar
|
package foo.bar
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
foo.bar::test
|
<!UNRESOLVED_REFERENCE!>foo.bar::test<!>
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -17,10 +17,10 @@ public class JavaClass {
|
|||||||
import kotlin.reflect.*
|
import kotlin.reflect.*
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
val pubFinRef: KProperty1<JavaClass, Int> = JavaClass::publicFinal
|
val pubFinRef: KProperty1<JavaClass, Int> = <!UNRESOLVED_REFERENCE!>JavaClass::publicFinal<!>
|
||||||
val pubMutRef: KMutableProperty1<JavaClass, Long> = JavaClass::publicMutable
|
val pubMutRef: KMutableProperty1<JavaClass, Long> = <!UNRESOLVED_REFERENCE!>JavaClass::publicMutable<!>
|
||||||
val protFinRef: KProperty1<JavaClass, Double> = JavaClass::protectedFinal
|
val protFinRef: KProperty1<JavaClass, Double> = <!UNRESOLVED_REFERENCE!>JavaClass::protectedFinal<!>
|
||||||
val protMutRef: KMutableProperty1<JavaClass, Char> = JavaClass::protectedMutable
|
val protMutRef: KMutableProperty1<JavaClass, Char> = <!UNRESOLVED_REFERENCE!>JavaClass::protectedMutable<!>
|
||||||
val privFinRef: KProperty1<JavaClass, String?> = JavaClass::privateFinal
|
val privFinRef: KProperty1<JavaClass, String?> = <!UNRESOLVED_REFERENCE!>JavaClass::privateFinal<!>
|
||||||
val privMutRef: KMutableProperty1<JavaClass, Any?> = JavaClass::privateMutable
|
val privMutRef: KMutableProperty1<JavaClass, Any?> = <!UNRESOLVED_REFERENCE!>JavaClass::privateMutable<!>
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+6
-6
@@ -19,10 +19,10 @@ import JavaClass.*
|
|||||||
import kotlin.reflect.*
|
import kotlin.reflect.*
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
val pubFinRef: KProperty0<String> = ::publicFinal
|
val pubFinRef: KProperty0<String> = <!UNRESOLVED_REFERENCE!>::publicFinal<!>
|
||||||
val pubMutRef: KMutableProperty0<Any?> = ::publicMutable
|
val pubMutRef: KMutableProperty0<Any?> = <!UNRESOLVED_REFERENCE!>::publicMutable<!>
|
||||||
val protFinRef: KProperty<Double> = ::protectedFinal
|
val protFinRef: KProperty<Double> = <!UNRESOLVED_REFERENCE!>::protectedFinal<!>
|
||||||
val protMutRef: KMutableProperty<Char> = ::protectedMutable
|
val protMutRef: KMutableProperty<Char> = <!UNRESOLVED_REFERENCE!>::protectedMutable<!>
|
||||||
val privFinRef: KProperty<JavaClass?> = ::privateFinal
|
val privFinRef: KProperty<JavaClass?> = <!UNRESOLVED_REFERENCE!>::privateFinal<!>
|
||||||
val privMutRef: KMutableProperty<Throwable?> = ::privateMutable
|
val privMutRef: KMutableProperty<Throwable?> = <!UNRESOLVED_REFERENCE!>::privateMutable<!>
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -7,5 +7,5 @@ class TestClass(var prop: Int)
|
|||||||
open class OtherClass
|
open class OtherClass
|
||||||
fun OtherClass.test(prop: KProperty1<TestClass, Int>): Unit = throw Exception()
|
fun OtherClass.test(prop: KProperty1<TestClass, Int>): Unit = throw Exception()
|
||||||
class OtherClass2: OtherClass() {
|
class OtherClass2: OtherClass() {
|
||||||
val result = <!INAPPLICABLE_CANDIDATE!>test<!>(TestClass::result)
|
val result = <!INAPPLICABLE_CANDIDATE!>test<!>(<!UNRESOLVED_REFERENCE!>TestClass::result<!>)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
fun eat(value: Any) {}
|
fun eat(value: Any) {}
|
||||||
|
|
||||||
fun test(param: String) {
|
fun test(param: String) {
|
||||||
val a = ::param
|
val a = <!UNRESOLVED_REFERENCE!>::param<!>
|
||||||
|
|
||||||
val local = "local"
|
val local = "local"
|
||||||
val b = ::local
|
val b = ::local
|
||||||
|
|||||||
@@ -7,5 +7,5 @@ fun f(x: KClass<out Int>) {}
|
|||||||
fun test() {
|
fun test() {
|
||||||
f(42::class)
|
f(42::class)
|
||||||
f((40 + 2)::class)
|
f((40 + 2)::class)
|
||||||
42::toInt
|
<!UNRESOLVED_REFERENCE!>42::toInt<!>
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION
|
// !DIAGNOSTICS: -UNUSED_EXPRESSION
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
"a"."b"::foo
|
<!UNRESOLVED_REFERENCE!>"a"."b"::foo<!>
|
||||||
"a"."b"::class
|
"a"."b"::class
|
||||||
"a"."b"."c"::foo
|
<!UNRESOLVED_REFERENCE!>"a"."b"."c"::foo<!>
|
||||||
"a"."b"."c"::class
|
"a"."b"."c"::class
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -3,5 +3,5 @@ fun <T, U> T.map(f: (T) -> U) = f(this)
|
|||||||
fun consume(s: String) {}
|
fun consume(s: String) {}
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
consume(1.<!INAPPLICABLE_CANDIDATE!>map<!>(::foo))
|
consume(1.<!INAPPLICABLE_CANDIDATE!>map<!>(<!UNRESOLVED_REFERENCE!>::foo<!>))
|
||||||
}
|
}
|
||||||
+8
-8
@@ -115,17 +115,17 @@ class C : O.B() {
|
|||||||
val n = FromCompanionC::foo
|
val n = FromCompanionC::foo
|
||||||
|
|
||||||
// INVISIBLE: direct superclasses themselves.
|
// INVISIBLE: direct superclasses themselves.
|
||||||
val a = <!UNRESOLVED_REFERENCE!>A<!>::foo
|
val a = <!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>A<!>::foo<!>
|
||||||
val b = <!UNRESOLVED_REFERENCE!>A<!>::foo
|
val b = <!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>A<!>::foo<!>
|
||||||
|
|
||||||
// DEPRECATED: Classifiers from companions of direct superclasses
|
// DEPRECATED: Classifiers from companions of direct superclasses
|
||||||
val e = FromCompanionA::foo
|
val e = FromCompanionA::foo
|
||||||
val f = FromCompanionB::foo
|
val f = FromCompanionB::foo
|
||||||
|
|
||||||
// INVISIBLE: "cousin" supertypes themselves
|
// INVISIBLE: "cousin" supertypes themselves
|
||||||
val g = <!UNRESOLVED_REFERENCE!>Alpha<!>::foo
|
val g = <!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>Alpha<!>::foo<!>
|
||||||
val h = <!UNRESOLVED_REFERENCE!>Beta<!>::foo
|
val h = <!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>Beta<!>::foo<!>
|
||||||
val i = <!UNRESOLVED_REFERENCE!>Gamma<!>::foo
|
val i = <!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>Gamma<!>::foo<!>
|
||||||
|
|
||||||
// DEPRECATED: classifiers from "cousin" superclasses
|
// DEPRECATED: classifiers from "cousin" superclasses
|
||||||
val k = FromAlpha::foo
|
val k = FromAlpha::foo
|
||||||
@@ -133,9 +133,9 @@ class C : O.B() {
|
|||||||
val m = FromGamma::foo
|
val m = FromGamma::foo
|
||||||
|
|
||||||
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
|
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
|
||||||
val o = <!UNRESOLVED_REFERENCE!>FromCompanionAlpha<!>::foo
|
val o = <!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>FromCompanionAlpha<!>::foo<!>
|
||||||
val p = <!UNRESOLVED_REFERENCE!>FromCompanionBeta<!>::foo
|
val p = <!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>FromCompanionBeta<!>::foo<!>
|
||||||
val q = <!UNRESOLVED_REFERENCE!>FromCompanionGamma<!>::foo
|
val q = <!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>FromCompanionGamma<!>::foo<!>
|
||||||
|
|
||||||
// DEPRECATED: Classifiers from supertypes of our own companion
|
// DEPRECATED: Classifiers from supertypes of our own companion
|
||||||
val r = FromDelta::foo
|
val r = FromDelta::foo
|
||||||
|
|||||||
+8
-8
@@ -115,17 +115,17 @@ class C : O.B() {
|
|||||||
val n = FromCompanionC::foo
|
val n = FromCompanionC::foo
|
||||||
|
|
||||||
// INVISIBLE: direct superclasses themselves.
|
// INVISIBLE: direct superclasses themselves.
|
||||||
val a = <!UNRESOLVED_REFERENCE!>A<!>::foo
|
val a = <!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>A<!>::foo<!>
|
||||||
val b = <!UNRESOLVED_REFERENCE!>A<!>::foo
|
val b = <!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>A<!>::foo<!>
|
||||||
|
|
||||||
// DEPRECATED: Classifiers from companions of direct superclasses
|
// DEPRECATED: Classifiers from companions of direct superclasses
|
||||||
val e = FromCompanionA::foo
|
val e = FromCompanionA::foo
|
||||||
val f = FromCompanionB::foo
|
val f = FromCompanionB::foo
|
||||||
|
|
||||||
// INVISIBLE: "cousin" supertypes themselves
|
// INVISIBLE: "cousin" supertypes themselves
|
||||||
val g = <!UNRESOLVED_REFERENCE!>Alpha<!>::foo
|
val g = <!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>Alpha<!>::foo<!>
|
||||||
val h = <!UNRESOLVED_REFERENCE!>Beta<!>::foo
|
val h = <!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>Beta<!>::foo<!>
|
||||||
val i = <!UNRESOLVED_REFERENCE!>Gamma<!>::foo
|
val i = <!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>Gamma<!>::foo<!>
|
||||||
|
|
||||||
// DEPRECATED: classifiers from "cousin" superclasses
|
// DEPRECATED: classifiers from "cousin" superclasses
|
||||||
val k = FromAlpha::foo
|
val k = FromAlpha::foo
|
||||||
@@ -133,9 +133,9 @@ class C : O.B() {
|
|||||||
val m = FromGamma::foo
|
val m = FromGamma::foo
|
||||||
|
|
||||||
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
|
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
|
||||||
val o = <!UNRESOLVED_REFERENCE!>FromCompanionAlpha<!>::foo
|
val o = <!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>FromCompanionAlpha<!>::foo<!>
|
||||||
val p = <!UNRESOLVED_REFERENCE!>FromCompanionBeta<!>::foo
|
val p = <!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>FromCompanionBeta<!>::foo<!>
|
||||||
val q = <!UNRESOLVED_REFERENCE!>FromCompanionGamma<!>::foo
|
val q = <!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>FromCompanionGamma<!>::foo<!>
|
||||||
|
|
||||||
// DEPRECATED: Classifiers from supertypes of our own companion
|
// DEPRECATED: Classifiers from supertypes of our own companion
|
||||||
val r = FromDelta::foo
|
val r = FromDelta::foo
|
||||||
|
|||||||
Vendored
+2
-2
@@ -119,8 +119,8 @@ class C : O.B() {
|
|||||||
val b = O.A::foo
|
val b = O.A::foo
|
||||||
|
|
||||||
// DEPRECATED: Classifiers from companions of direct superclasses
|
// DEPRECATED: Classifiers from companions of direct superclasses
|
||||||
val e = O.A.<!AMBIGUITY!>Companion<!>.<!UNRESOLVED_REFERENCE!>FromCompanionA<!>::foo
|
val e = <!UNRESOLVED_REFERENCE!>O.A.<!AMBIGUITY!>Companion<!>.<!UNRESOLVED_REFERENCE!>FromCompanionA<!>::foo<!>
|
||||||
val f = O.B.<!AMBIGUITY!>Companion<!>.<!UNRESOLVED_REFERENCE!>FromCompanionB<!>::foo
|
val f = <!UNRESOLVED_REFERENCE!>O.B.<!AMBIGUITY!>Companion<!>.<!UNRESOLVED_REFERENCE!>FromCompanionB<!>::foo<!>
|
||||||
|
|
||||||
// INVISIBLE: "cousin" supertypes themselves
|
// INVISIBLE: "cousin" supertypes themselves
|
||||||
val g = O.Alpha::foo
|
val g = O.Alpha::foo
|
||||||
|
|||||||
Vendored
+2
-2
@@ -119,8 +119,8 @@ class C : O.B() {
|
|||||||
val b = O.A::foo
|
val b = O.A::foo
|
||||||
|
|
||||||
// DEPRECATED: Classifiers from companions of direct superclasses
|
// DEPRECATED: Classifiers from companions of direct superclasses
|
||||||
val e = O.A.<!AMBIGUITY!>Companion<!>.<!UNRESOLVED_REFERENCE!>FromCompanionA<!>::foo
|
val e = <!UNRESOLVED_REFERENCE!>O.A.<!AMBIGUITY!>Companion<!>.<!UNRESOLVED_REFERENCE!>FromCompanionA<!>::foo<!>
|
||||||
val f = O.B.<!AMBIGUITY!>Companion<!>.<!UNRESOLVED_REFERENCE!>FromCompanionB<!>::foo
|
val f = <!UNRESOLVED_REFERENCE!>O.B.<!AMBIGUITY!>Companion<!>.<!UNRESOLVED_REFERENCE!>FromCompanionB<!>::foo<!>
|
||||||
|
|
||||||
// INVISIBLE: "cousin" supertypes themselves
|
// INVISIBLE: "cousin" supertypes themselves
|
||||||
val g = O.Alpha::foo
|
val g = O.Alpha::foo
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
// !WITH_NEW_INFERENCE
|
// !WITH_NEW_INFERENCE
|
||||||
val unwrapped = <!UNRESOLVED_REFERENCE!>some<!><<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>sdf<!>()()<!><out Any><!>::unwrap
|
val unwrapped = <!UNRESOLVED_REFERENCE!>some<!><<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>sdf<!>()()<!><out Any><!>::unwrap<!>
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
// !WITH_NEW_INFERENCE
|
// !WITH_NEW_INFERENCE
|
||||||
// NI_EXPECTED_FILE
|
// NI_EXPECTED_FILE
|
||||||
|
|
||||||
val unwrapped = some.<!SYNTAX!><<!><!UNRESOLVED_REFERENCE!>cabc<!><!SYNTAX!>$Wrapper<!><out Any>::unwrap
|
val unwrapped = some.<!SYNTAX!><<!><!UNRESOLVED_REFERENCE!>cabc<!><!UNRESOLVED_REFERENCE!><!SYNTAX!>$Wrapper<!><out Any>::unwrap<!>
|
||||||
@@ -3,5 +3,5 @@
|
|||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
val text: List<Any> = null!!
|
val text: List<Any> = null!!
|
||||||
text.<!UNRESOLVED_REFERENCE!>map<!> <!UNRESOLVED_REFERENCE!>Any<!><!SYNTAX!>?<!>::toString
|
text.<!UNRESOLVED_REFERENCE!>map<!> <!UNRESOLVED_REFERENCE!>Any<!><!UNRESOLVED_REFERENCE!><!SYNTAX!>?<!>::toString<!>
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -6,5 +6,5 @@ val <T : Any> KClass<T>.java: Class<T> get() = null!!
|
|||||||
|
|
||||||
val <T : Any> KClass<T>.foo: Any?
|
val <T : Any> KClass<T>.foo: Any?
|
||||||
get() {
|
get() {
|
||||||
return java.<!UNRESOLVED_REFERENCE!>lang<!>.<!UNRESOLVED_REFERENCE!>Integer<!>::hashCode
|
return <!UNRESOLVED_REFERENCE!>java.<!UNRESOLVED_REFERENCE!>lang<!>.<!UNRESOLVED_REFERENCE!>Integer<!>::hashCode<!>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,4 +4,4 @@ class C {
|
|||||||
|
|
||||||
typealias CA = C
|
typealias CA = C
|
||||||
|
|
||||||
val cf = CA::foo
|
val cf = <!UNRESOLVED_REFERENCE!>CA::foo<!>
|
||||||
|
|||||||
+2
-2
@@ -50,7 +50,7 @@ fun foo(
|
|||||||
test.ClassAlias::Nested
|
test.ClassAlias::Nested
|
||||||
|
|
||||||
test.ClassSample::func
|
test.ClassSample::func
|
||||||
test.ClassAlias::func
|
<!UNRESOLVED_REFERENCE!>test.ClassAlias::func<!>
|
||||||
|
|
||||||
test.ClassSample.Nested::func
|
test.ClassSample.Nested::func
|
||||||
test.ClassAlias.Nested::func
|
test.ClassAlias.Nested::func
|
||||||
@@ -68,7 +68,7 @@ fun foo(
|
|||||||
test.EnumAlias::Nested
|
test.EnumAlias::Nested
|
||||||
|
|
||||||
test.EnumSample::func
|
test.EnumSample::func
|
||||||
test.EnumAlias::func
|
<!UNRESOLVED_REFERENCE!>test.EnumAlias::func<!>
|
||||||
|
|
||||||
test.EnumSample.Nested::func
|
test.EnumSample.Nested::func
|
||||||
test.EnumAlias.Nested::func
|
test.EnumAlias.Nested::func
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ FILE fqName:<root> fileName:/propertyReferences.kt
|
|||||||
PROPERTY name:test_J_CONST visibility:public modality:FINAL [val]
|
PROPERTY name:test_J_CONST visibility:public modality:FINAL [val]
|
||||||
FIELD PROPERTY_BACKING_FIELD name:test_J_CONST type:IrErrorType visibility:private [final,static]
|
FIELD PROPERTY_BACKING_FIELD name:test_J_CONST type:IrErrorType visibility:private [final,static]
|
||||||
EXPRESSION_BODY
|
EXPRESSION_BODY
|
||||||
ERROR_CALL 'Unsupported callable reference: Q|J|::CONST#' type=IrErrorType
|
ERROR_CALL 'Unsupported callable reference: Q|J|::<Unresolved name: CONST>#' type=IrErrorType
|
||||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test_J_CONST> visibility:public modality:FINAL <> () returnType:IrErrorType
|
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test_J_CONST> visibility:public modality:FINAL <> () returnType:IrErrorType
|
||||||
correspondingProperty: PROPERTY name:test_J_CONST visibility:public modality:FINAL [val]
|
correspondingProperty: PROPERTY name:test_J_CONST visibility:public modality:FINAL [val]
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
@@ -261,7 +261,7 @@ FILE fqName:<root> fileName:/propertyReferences.kt
|
|||||||
PROPERTY name:test_J_nonConst visibility:public modality:FINAL [val]
|
PROPERTY name:test_J_nonConst visibility:public modality:FINAL [val]
|
||||||
FIELD PROPERTY_BACKING_FIELD name:test_J_nonConst type:IrErrorType visibility:private [final,static]
|
FIELD PROPERTY_BACKING_FIELD name:test_J_nonConst type:IrErrorType visibility:private [final,static]
|
||||||
EXPRESSION_BODY
|
EXPRESSION_BODY
|
||||||
ERROR_CALL 'Unsupported callable reference: Q|J|::nonConst#' type=IrErrorType
|
ERROR_CALL 'Unsupported callable reference: Q|J|::<Unresolved name: nonConst>#' type=IrErrorType
|
||||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test_J_nonConst> visibility:public modality:FINAL <> () returnType:IrErrorType
|
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test_J_nonConst> visibility:public modality:FINAL <> () returnType:IrErrorType
|
||||||
correspondingProperty: PROPERTY name:test_J_nonConst visibility:public modality:FINAL [val]
|
correspondingProperty: PROPERTY name:test_J_nonConst visibility:public modality:FINAL [val]
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
|
|||||||
Reference in New Issue
Block a user