From e644edfe84ab8543e1487148dae33da3b24a61af Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 21 Jan 2020 17:35:50 +0300 Subject: [PATCH] [FIR] Handle unresolved callable references more correctly --- .../transformers/FirSyntheticCallGenerator.kt | 25 +++++++++++++++---- .../resolve/transformers/TransformUtils.kt | 8 +++--- .../resolve/expresssions/errCallable.kt | 2 +- .../resolve/expresssions/errCallable.txt | 4 +-- .../bound/functionCallWithoutArguments.fir.kt | 2 +- .../callableReference/bound/kt12843.fir.kt | 4 +-- .../function/abstractClassConstructors.fir.kt | 4 +-- ...lassMemberVsConstructorLikeFunction.fir.kt | 2 +- .../function/differentPackageExtension.fir.kt | 4 +-- .../extensionInClassDisallowed.fir.kt | 4 +-- .../function/innerConstructorFromClass.fir.kt | 2 +- .../innerConstructorFromExtension.fir.kt | 2 +- .../innerConstructorFromTopLevel.fir.kt | 2 +- .../nestedConstructorFromClass.fir.kt | 2 +- .../nestedConstructorFromExtension.fir.kt | 2 +- .../function/unresolved.fir.kt | 16 ++++++------ .../tests/callableReference/kt32267.fir.kt | 4 +-- .../kt7430_wrongClassOnLHS.fir.kt | 4 +-- ...sionsImportedFromObjectsUnsupported.fir.kt | 4 +-- .../callableReference/packageInLhs.fir.kt | 4 +-- .../property/javaInstanceField.fir.kt | 12 ++++----- .../property/javaStaticFieldViaImport.fir.kt | 12 ++++----- .../property/kt7945_unrelatedClass.fir.kt | 2 +- .../property/localVariable.fir.kt | 2 +- .../classLiteral/integerValueType.fir.kt | 2 +- .../illegalSelectorCallableReference.fir.kt | 4 +-- ...boutUnresolvedReferenceAsUnresolved.fir.kt | 2 +- .../kt21515/callableReferencesNew.fir.kt | 16 ++++++------ .../kt21515/callableReferencesOld.fir.kt | 16 ++++++------ ...lableReferencesWithQualificationNew.fir.kt | 4 +-- ...lableReferencesWithQualificationOld.fir.kt | 4 +-- .../calleeExpressionAsCallExpression.fir.kt | 2 +- .../nullCalleeExpression.fir.kt | 2 +- .../tests/regressions/kt13685.fir.kt | 2 +- ...JavaClassReferenceInKClassExtension.fir.kt | 2 +- .../tests/typealias/methodReference.fir.kt | 2 +- .../typealias/typeAliasesInQualifiers.fir.kt | 4 +-- .../expressions/propertyReferences.fir.txt | 4 +-- 38 files changed, 105 insertions(+), 90 deletions(-) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirSyntheticCallGenerator.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirSyntheticCallGenerator.kt index 89ba3c11171..3b866b18a41 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirSyntheticCallGenerator.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirSyntheticCallGenerator.kt @@ -7,7 +7,9 @@ package org.jetbrains.kotlin.fir.resolve.transformers import org.jetbrains.kotlin.descriptors.Modality 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.addDefaultBoundIfNecessary 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.expressions.* 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.impl.FirErrorNamedReferenceImpl import org.jetbrains.kotlin.fir.references.impl.FirStubReference import org.jetbrains.kotlin.fir.resolve.BodyResolveComponents 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.transformers.body.resolve.FirAbstractBodyResolveTransformer import org.jetbrains.kotlin.fir.resolve.withNullability @@ -108,7 +113,13 @@ class FirSyntheticCallGenerator( val reference = generateCalleeReferenceWithCandidate( 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) 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 { isExpect = false isActual = false @@ -229,8 +242,10 @@ class FirSyntheticCallGenerator( } } - private fun FirResolvedTypeRef.toValueParameter(session: FirSession, name: String, isVararg: Boolean = false): FirValueParameterImpl { - val name = Name.identifier(name) + private fun FirResolvedTypeRef.toValueParameter( + session: FirSession, nameAsString: String, isVararg: Boolean = false + ): FirValueParameterImpl { + val name = Name.identifier(nameAsString) return FirValueParameterImpl( session = session, source = null, diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/TransformUtils.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/TransformUtils.kt index eb64e40641e..e81ded96685 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/TransformUtils.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/TransformUtils.kt @@ -87,21 +87,21 @@ internal object StoreNameReference : FirDefaultTransformer() } } -internal object StoreCalleeReference : FirTransformer() { - override fun transformElement(element: E, data: FirResolvedNamedReference): CompositeTransformResult { +internal object StoreCalleeReference : FirTransformer() { + override fun transformElement(element: E, data: FirNamedReference): CompositeTransformResult { return element.compose() } override fun transformNamedReference( namedReference: FirNamedReference, - data: FirResolvedNamedReference + data: FirNamedReference ): CompositeTransformResult { return data.compose() } override fun transformResolvedNamedReference( resolvedNamedReference: FirResolvedNamedReference, - data: FirResolvedNamedReference + data: FirNamedReference ): CompositeTransformResult { return data.compose() } diff --git a/compiler/fir/resolve/testData/resolve/expresssions/errCallable.kt b/compiler/fir/resolve/testData/resolve/expresssions/errCallable.kt index 9dcb5c85aba..b9bd7de05e4 100644 --- a/compiler/fir/resolve/testData/resolve/expresssions/errCallable.kt +++ b/compiler/fir/resolve/testData/resolve/expresssions/errCallable.kt @@ -4,7 +4,7 @@ class Your { class My { fun foo() { - val x = ::Nested // Should be error + val x = ::Nested // Should be error } } diff --git a/compiler/fir/resolve/testData/resolve/expresssions/errCallable.txt b/compiler/fir/resolve/testData/resolve/expresssions/errCallable.txt index b8ae98e1c27..2a0c11a1297 100644 --- a/compiler/fir/resolve/testData/resolve/expresssions/errCallable.txt +++ b/compiler/fir/resolve/testData/resolve/expresssions/errCallable.txt @@ -18,10 +18,10 @@ FILE: errCallable.kt } public final fun foo(): R|kotlin/Unit| { - lval x: = ::Nested# + lval x: = ::# } } public final fun R|Your|.foo(): R|kotlin/Unit| { - lval x: = ::Nested# + lval x: R|kotlin/reflect/KFunction0| = ::R|/Your.Nested.Nested| } diff --git a/compiler/testData/diagnostics/tests/callableReference/bound/functionCallWithoutArguments.fir.kt b/compiler/testData/diagnostics/tests/callableReference/bound/functionCallWithoutArguments.fir.kt index be9c7e33b9e..2bd5ea09f15 100644 --- a/compiler/testData/diagnostics/tests/callableReference/bound/functionCallWithoutArguments.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/bound/functionCallWithoutArguments.fir.kt @@ -1 +1 @@ -fun test() = ("").hashCode::hashCode +fun test() = ("").hashCode::hashCode diff --git a/compiler/testData/diagnostics/tests/callableReference/bound/kt12843.fir.kt b/compiler/testData/diagnostics/tests/callableReference/bound/kt12843.fir.kt index 18df77a2d46..6c25be049d7 100644 --- a/compiler/testData/diagnostics/tests/callableReference/bound/kt12843.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/bound/kt12843.fir.kt @@ -1,6 +1,6 @@ class Foo { fun bar() {} - fun f() = Unresolved()::bar + fun f() = Unresolved()::bar } -val f: () -> Unit = Unresolved()::foo +val f: () -> Unit = Unresolved()::foo diff --git a/compiler/testData/diagnostics/tests/callableReference/function/abstractClassConstructors.fir.kt b/compiler/testData/diagnostics/tests/callableReference/function/abstractClassConstructors.fir.kt index 82e9593dd3a..c1e3021ba95 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/abstractClassConstructors.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/abstractClassConstructors.fir.kt @@ -5,8 +5,8 @@ annotation class C enum class D fun main() { - ::A + ::A ::B ::C // KT-3465 - ::D + ::D } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/callableReference/function/classMemberVsConstructorLikeFunction.fir.kt b/compiler/testData/diagnostics/tests/callableReference/function/classMemberVsConstructorLikeFunction.fir.kt index 5b1cccdd062..32a416ccb01 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/classMemberVsConstructorLikeFunction.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/classMemberVsConstructorLikeFunction.fir.kt @@ -13,4 +13,4 @@ import test.Foo fun Foo(): String = "" val f = Foo::bar -val g = Foo::length +val g = Foo::length diff --git a/compiler/testData/diagnostics/tests/callableReference/function/differentPackageExtension.fir.kt b/compiler/testData/diagnostics/tests/callableReference/function/differentPackageExtension.fir.kt index 7668bc02168..fda9de85f94 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/differentPackageExtension.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/differentPackageExtension.fir.kt @@ -21,8 +21,8 @@ import first.foo fun main() { val x = first.A::foo - first.A::bar - A::baz + first.A::bar + A::baz checkSubtype>(x) } diff --git a/compiler/testData/diagnostics/tests/callableReference/function/extensionInClassDisallowed.fir.kt b/compiler/testData/diagnostics/tests/callableReference/function/extensionInClassDisallowed.fir.kt index 8ece6d0a2f6..33d81eee6f6 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/extensionInClassDisallowed.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/extensionInClassDisallowed.fir.kt @@ -15,6 +15,6 @@ class A { fun eat(value: Any) {} fun main() { - A::extInt - A::extA + A::extInt + A::extA } diff --git a/compiler/testData/diagnostics/tests/callableReference/function/innerConstructorFromClass.fir.kt b/compiler/testData/diagnostics/tests/callableReference/function/innerConstructorFromClass.fir.kt index 5141391eb96..1834f7ca424 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/innerConstructorFromClass.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/innerConstructorFromClass.fir.kt @@ -26,7 +26,7 @@ class A { class B { fun main() { - ::Inner + ::Inner val y = A::Inner checkSubtype>(y) diff --git a/compiler/testData/diagnostics/tests/callableReference/function/innerConstructorFromExtension.fir.kt b/compiler/testData/diagnostics/tests/callableReference/function/innerConstructorFromExtension.fir.kt index e7fb089d9b4..790224bd8eb 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/innerConstructorFromExtension.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/innerConstructorFromExtension.fir.kt @@ -16,7 +16,7 @@ fun A.main() { } fun Int.main() { - ::Inner + ::Inner val y = A::Inner checkSubtype>(y) diff --git a/compiler/testData/diagnostics/tests/callableReference/function/innerConstructorFromTopLevel.fir.kt b/compiler/testData/diagnostics/tests/callableReference/function/innerConstructorFromTopLevel.fir.kt index fa27fdca024..486f0e3b38c 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/innerConstructorFromTopLevel.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/innerConstructorFromTopLevel.fir.kt @@ -7,7 +7,7 @@ class A { } fun main() { - ::Inner + ::Inner val y = A::Inner checkSubtype>(y) diff --git a/compiler/testData/diagnostics/tests/callableReference/function/nestedConstructorFromClass.fir.kt b/compiler/testData/diagnostics/tests/callableReference/function/nestedConstructorFromClass.fir.kt index bdeaa0b46d0..98a7a6f7137 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/nestedConstructorFromClass.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/nestedConstructorFromClass.fir.kt @@ -25,7 +25,7 @@ class A { class B { fun main() { - ::Nested + ::Nested val y = A::Nested checkSubtype>(y) diff --git a/compiler/testData/diagnostics/tests/callableReference/function/nestedConstructorFromExtension.fir.kt b/compiler/testData/diagnostics/tests/callableReference/function/nestedConstructorFromExtension.fir.kt index 195f5c0051b..3e0361b3185 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/nestedConstructorFromExtension.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/nestedConstructorFromExtension.fir.kt @@ -14,7 +14,7 @@ fun A.main() { } fun Int.main() { - ::Nested + ::Nested val y = A::Nested checkSubtype>(y) diff --git a/compiler/testData/diagnostics/tests/callableReference/function/unresolved.fir.kt b/compiler/testData/diagnostics/tests/callableReference/function/unresolved.fir.kt index d6e8601e7b4..3995290ce81 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/unresolved.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/unresolved.fir.kt @@ -4,21 +4,21 @@ class A fun test1() { - val foo = ::foo + val foo = ::foo - ::bar + ::bar - A::bar + A::bar - B::bar + B::bar } fun test2() { fun foo(x: Any) {} fun foo() {} - Unresolved::foo - foo(Unresolved::foo) - foo(Unresolved::unresolved) - ::unresolved + Unresolved::foo + foo(Unresolved::foo) + foo(Unresolved::unresolved) + ::unresolved } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/callableReference/kt32267.fir.kt b/compiler/testData/diagnostics/tests/callableReference/kt32267.fir.kt index 379a9b29356..37af30f8af0 100644 --- a/compiler/testData/diagnostics/tests/callableReference/kt32267.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/kt32267.fir.kt @@ -4,8 +4,8 @@ fun main() { Configuration().commands { - Command1 { someService::execute } // Overload resolution ambiguity. All these functions match. - Command2 { someService::execute } // Overload resolution ambiguity. All these functions match. + Command1 { someService::execute } // Overload resolution ambiguity. All these functions match. + Command2 { someService::execute } // Overload resolution ambiguity. All these functions match. Command1 { { someService.execute(it) } } // fine Command2 { { someService.execute(it) } } // fine } diff --git a/compiler/testData/diagnostics/tests/callableReference/kt7430_wrongClassOnLHS.fir.kt b/compiler/testData/diagnostics/tests/callableReference/kt7430_wrongClassOnLHS.fir.kt index bcf23b25647..48901ace5f8 100644 --- a/compiler/testData/diagnostics/tests/callableReference/kt7430_wrongClassOnLHS.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/kt7430_wrongClassOnLHS.fir.kt @@ -4,8 +4,8 @@ class Unrelated() class Test(val name: String = "") { init { - Unrelated::name - Unrelated::foo + Unrelated::name + Unrelated::foo } fun foo() {} diff --git a/compiler/testData/diagnostics/tests/callableReference/memberExtensionsImportedFromObjectsUnsupported.fir.kt b/compiler/testData/diagnostics/tests/callableReference/memberExtensionsImportedFromObjectsUnsupported.fir.kt index acee4e1fb1d..3920a8fb636 100644 --- a/compiler/testData/diagnostics/tests/callableReference/memberExtensionsImportedFromObjectsUnsupported.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/memberExtensionsImportedFromObjectsUnsupported.fir.kt @@ -21,6 +21,6 @@ fun test() { A.Companion::ext2 A::ext2 - A::foo - A::bar + A::foo + A::bar } diff --git a/compiler/testData/diagnostics/tests/callableReference/packageInLhs.fir.kt b/compiler/testData/diagnostics/tests/callableReference/packageInLhs.fir.kt index 9a280b8ae57..6d81b0b3f52 100644 --- a/compiler/testData/diagnostics/tests/callableReference/packageInLhs.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/packageInLhs.fir.kt @@ -4,7 +4,7 @@ package foo fun test() { - foo::test + foo::test } // FILE: qualifiedName.kt @@ -12,5 +12,5 @@ fun test() { package foo.bar fun test() { - foo.bar::test + foo.bar::test } diff --git a/compiler/testData/diagnostics/tests/callableReference/property/javaInstanceField.fir.kt b/compiler/testData/diagnostics/tests/callableReference/property/javaInstanceField.fir.kt index a5f8a33c53a..06eb08b4f3c 100644 --- a/compiler/testData/diagnostics/tests/callableReference/property/javaInstanceField.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/property/javaInstanceField.fir.kt @@ -17,10 +17,10 @@ public class JavaClass { import kotlin.reflect.* fun test() { - val pubFinRef: KProperty1 = JavaClass::publicFinal - val pubMutRef: KMutableProperty1 = JavaClass::publicMutable - val protFinRef: KProperty1 = JavaClass::protectedFinal - val protMutRef: KMutableProperty1 = JavaClass::protectedMutable - val privFinRef: KProperty1 = JavaClass::privateFinal - val privMutRef: KMutableProperty1 = JavaClass::privateMutable + val pubFinRef: KProperty1 = JavaClass::publicFinal + val pubMutRef: KMutableProperty1 = JavaClass::publicMutable + val protFinRef: KProperty1 = JavaClass::protectedFinal + val protMutRef: KMutableProperty1 = JavaClass::protectedMutable + val privFinRef: KProperty1 = JavaClass::privateFinal + val privMutRef: KMutableProperty1 = JavaClass::privateMutable } diff --git a/compiler/testData/diagnostics/tests/callableReference/property/javaStaticFieldViaImport.fir.kt b/compiler/testData/diagnostics/tests/callableReference/property/javaStaticFieldViaImport.fir.kt index 48a363f78fe..ee0f768f20a 100644 --- a/compiler/testData/diagnostics/tests/callableReference/property/javaStaticFieldViaImport.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/property/javaStaticFieldViaImport.fir.kt @@ -19,10 +19,10 @@ import JavaClass.* import kotlin.reflect.* fun test() { - val pubFinRef: KProperty0 = ::publicFinal - val pubMutRef: KMutableProperty0 = ::publicMutable - val protFinRef: KProperty = ::protectedFinal - val protMutRef: KMutableProperty = ::protectedMutable - val privFinRef: KProperty = ::privateFinal - val privMutRef: KMutableProperty = ::privateMutable + val pubFinRef: KProperty0 = ::publicFinal + val pubMutRef: KMutableProperty0 = ::publicMutable + val protFinRef: KProperty = ::protectedFinal + val protMutRef: KMutableProperty = ::protectedMutable + val privFinRef: KProperty = ::privateFinal + val privMutRef: KMutableProperty = ::privateMutable } diff --git a/compiler/testData/diagnostics/tests/callableReference/property/kt7945_unrelatedClass.fir.kt b/compiler/testData/diagnostics/tests/callableReference/property/kt7945_unrelatedClass.fir.kt index 719be10b741..cfa47d0096c 100644 --- a/compiler/testData/diagnostics/tests/callableReference/property/kt7945_unrelatedClass.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/property/kt7945_unrelatedClass.fir.kt @@ -7,5 +7,5 @@ class TestClass(var prop: Int) open class OtherClass fun OtherClass.test(prop: KProperty1): Unit = throw Exception() class OtherClass2: OtherClass() { - val result = test(TestClass::result) + val result = test(TestClass::result) } diff --git a/compiler/testData/diagnostics/tests/callableReference/property/localVariable.fir.kt b/compiler/testData/diagnostics/tests/callableReference/property/localVariable.fir.kt index c170c78a97a..09ca94be062 100644 --- a/compiler/testData/diagnostics/tests/callableReference/property/localVariable.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/property/localVariable.fir.kt @@ -3,7 +3,7 @@ fun eat(value: Any) {} fun test(param: String) { - val a = ::param + val a = ::param val local = "local" val b = ::local diff --git a/compiler/testData/diagnostics/tests/classLiteral/integerValueType.fir.kt b/compiler/testData/diagnostics/tests/classLiteral/integerValueType.fir.kt index 53b51edd83f..5eba48b42c9 100644 --- a/compiler/testData/diagnostics/tests/classLiteral/integerValueType.fir.kt +++ b/compiler/testData/diagnostics/tests/classLiteral/integerValueType.fir.kt @@ -7,5 +7,5 @@ fun f(x: KClass) {} fun test() { f(42::class) f((40 + 2)::class) - 42::toInt + 42::toInt } diff --git a/compiler/testData/diagnostics/tests/incompleteCode/illegalSelectorCallableReference.fir.kt b/compiler/testData/diagnostics/tests/incompleteCode/illegalSelectorCallableReference.fir.kt index 3ed64132ea1..f628947f48b 100644 --- a/compiler/testData/diagnostics/tests/incompleteCode/illegalSelectorCallableReference.fir.kt +++ b/compiler/testData/diagnostics/tests/incompleteCode/illegalSelectorCallableReference.fir.kt @@ -1,8 +1,8 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION fun test() { - "a"."b"::foo + "a"."b"::foo "a"."b"::class - "a"."b"."c"::foo + "a"."b"."c"::foo "a"."b"."c"::class } diff --git a/compiler/testData/diagnostics/tests/inference/reportAboutUnresolvedReferenceAsUnresolved.fir.kt b/compiler/testData/diagnostics/tests/inference/reportAboutUnresolvedReferenceAsUnresolved.fir.kt index c54efbeda12..ece51b0e384 100644 --- a/compiler/testData/diagnostics/tests/inference/reportAboutUnresolvedReferenceAsUnresolved.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/reportAboutUnresolvedReferenceAsUnresolved.fir.kt @@ -3,5 +3,5 @@ fun T.map(f: (T) -> U) = f(this) fun consume(s: String) {} fun test() { - consume(1.map(::foo)) + consume(1.map(::foo)) } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/objects/kt21515/callableReferencesNew.fir.kt b/compiler/testData/diagnostics/tests/objects/kt21515/callableReferencesNew.fir.kt index bdf54158467..010fca061ef 100644 --- a/compiler/testData/diagnostics/tests/objects/kt21515/callableReferencesNew.fir.kt +++ b/compiler/testData/diagnostics/tests/objects/kt21515/callableReferencesNew.fir.kt @@ -115,17 +115,17 @@ class C : O.B() { val n = FromCompanionC::foo // INVISIBLE: direct superclasses themselves. - val a = A::foo - val b = A::foo + val a = A::foo + val b = A::foo // DEPRECATED: Classifiers from companions of direct superclasses val e = FromCompanionA::foo val f = FromCompanionB::foo // INVISIBLE: "cousin" supertypes themselves - val g = Alpha::foo - val h = Beta::foo - val i = Gamma::foo + val g = Alpha::foo + val h = Beta::foo + val i = Gamma::foo // DEPRECATED: classifiers from "cousin" superclasses val k = FromAlpha::foo @@ -133,9 +133,9 @@ class C : O.B() { val m = FromGamma::foo // INVISIBLE: We don't see classifiers from companions of "cousin" superclasses - val o = FromCompanionAlpha::foo - val p = FromCompanionBeta::foo - val q = FromCompanionGamma::foo + val o = FromCompanionAlpha::foo + val p = FromCompanionBeta::foo + val q = FromCompanionGamma::foo // DEPRECATED: Classifiers from supertypes of our own companion val r = FromDelta::foo diff --git a/compiler/testData/diagnostics/tests/objects/kt21515/callableReferencesOld.fir.kt b/compiler/testData/diagnostics/tests/objects/kt21515/callableReferencesOld.fir.kt index 4ada62f2fa3..5cf582c3d69 100644 --- a/compiler/testData/diagnostics/tests/objects/kt21515/callableReferencesOld.fir.kt +++ b/compiler/testData/diagnostics/tests/objects/kt21515/callableReferencesOld.fir.kt @@ -115,17 +115,17 @@ class C : O.B() { val n = FromCompanionC::foo // INVISIBLE: direct superclasses themselves. - val a = A::foo - val b = A::foo + val a = A::foo + val b = A::foo // DEPRECATED: Classifiers from companions of direct superclasses val e = FromCompanionA::foo val f = FromCompanionB::foo // INVISIBLE: "cousin" supertypes themselves - val g = Alpha::foo - val h = Beta::foo - val i = Gamma::foo + val g = Alpha::foo + val h = Beta::foo + val i = Gamma::foo // DEPRECATED: classifiers from "cousin" superclasses val k = FromAlpha::foo @@ -133,9 +133,9 @@ class C : O.B() { val m = FromGamma::foo // INVISIBLE: We don't see classifiers from companions of "cousin" superclasses - val o = FromCompanionAlpha::foo - val p = FromCompanionBeta::foo - val q = FromCompanionGamma::foo + val o = FromCompanionAlpha::foo + val p = FromCompanionBeta::foo + val q = FromCompanionGamma::foo // DEPRECATED: Classifiers from supertypes of our own companion val r = FromDelta::foo diff --git a/compiler/testData/diagnostics/tests/objects/kt21515/callableReferencesWithQualificationNew.fir.kt b/compiler/testData/diagnostics/tests/objects/kt21515/callableReferencesWithQualificationNew.fir.kt index f41297aaf61..2145890ee7f 100644 --- a/compiler/testData/diagnostics/tests/objects/kt21515/callableReferencesWithQualificationNew.fir.kt +++ b/compiler/testData/diagnostics/tests/objects/kt21515/callableReferencesWithQualificationNew.fir.kt @@ -119,8 +119,8 @@ class C : O.B() { val b = O.A::foo // DEPRECATED: Classifiers from companions of direct superclasses - val e = O.A.Companion.FromCompanionA::foo - val f = O.B.Companion.FromCompanionB::foo + val e = O.A.Companion.FromCompanionA::foo + val f = O.B.Companion.FromCompanionB::foo // INVISIBLE: "cousin" supertypes themselves val g = O.Alpha::foo diff --git a/compiler/testData/diagnostics/tests/objects/kt21515/callableReferencesWithQualificationOld.fir.kt b/compiler/testData/diagnostics/tests/objects/kt21515/callableReferencesWithQualificationOld.fir.kt index db6ecab54d1..0d19aa10ead 100644 --- a/compiler/testData/diagnostics/tests/objects/kt21515/callableReferencesWithQualificationOld.fir.kt +++ b/compiler/testData/diagnostics/tests/objects/kt21515/callableReferencesWithQualificationOld.fir.kt @@ -119,8 +119,8 @@ class C : O.B() { val b = O.A::foo // DEPRECATED: Classifiers from companions of direct superclasses - val e = O.A.Companion.FromCompanionA::foo - val f = O.B.Companion.FromCompanionB::foo + val e = O.A.Companion.FromCompanionA::foo + val f = O.B.Companion.FromCompanionB::foo // INVISIBLE: "cousin" supertypes themselves val g = O.Alpha::foo diff --git a/compiler/testData/diagnostics/tests/qualifiedExpression/calleeExpressionAsCallExpression.fir.kt b/compiler/testData/diagnostics/tests/qualifiedExpression/calleeExpressionAsCallExpression.fir.kt index 5f2399d1564..7bb29de02cb 100644 --- a/compiler/testData/diagnostics/tests/qualifiedExpression/calleeExpressionAsCallExpression.fir.kt +++ b/compiler/testData/diagnostics/tests/qualifiedExpression/calleeExpressionAsCallExpression.fir.kt @@ -1,2 +1,2 @@ // !WITH_NEW_INFERENCE -val unwrapped = some<sdf()()::unwrap \ No newline at end of file +val unwrapped = some<sdf()()::unwrap \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/qualifiedExpression/nullCalleeExpression.fir.kt b/compiler/testData/diagnostics/tests/qualifiedExpression/nullCalleeExpression.fir.kt index 81fced65a49..72e653963d6 100644 --- a/compiler/testData/diagnostics/tests/qualifiedExpression/nullCalleeExpression.fir.kt +++ b/compiler/testData/diagnostics/tests/qualifiedExpression/nullCalleeExpression.fir.kt @@ -1,4 +1,4 @@ // !WITH_NEW_INFERENCE // NI_EXPECTED_FILE -val unwrapped = some.<cabc$Wrapper::unwrap \ No newline at end of file +val unwrapped = some.<cabc$Wrapper::unwrap \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/kt13685.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt13685.fir.kt index 9d924b02776..71b6485cce8 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt13685.fir.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt13685.fir.kt @@ -3,5 +3,5 @@ fun foo() { val text: List = null!! - text.map Any?::toString + text.map Any?::toString } diff --git a/compiler/testData/diagnostics/tests/sourceCompatibility/noBoundCallableReferences/qualifiedJavaClassReferenceInKClassExtension.fir.kt b/compiler/testData/diagnostics/tests/sourceCompatibility/noBoundCallableReferences/qualifiedJavaClassReferenceInKClassExtension.fir.kt index 13462c5f330..4dab9e8908b 100644 --- a/compiler/testData/diagnostics/tests/sourceCompatibility/noBoundCallableReferences/qualifiedJavaClassReferenceInKClassExtension.fir.kt +++ b/compiler/testData/diagnostics/tests/sourceCompatibility/noBoundCallableReferences/qualifiedJavaClassReferenceInKClassExtension.fir.kt @@ -6,5 +6,5 @@ val KClass.java: Class get() = null!! val KClass.foo: Any? get() { - return java.lang.Integer::hashCode + return java.lang.Integer::hashCode } diff --git a/compiler/testData/diagnostics/tests/typealias/methodReference.fir.kt b/compiler/testData/diagnostics/tests/typealias/methodReference.fir.kt index c0914863e45..66da9ad11ee 100644 --- a/compiler/testData/diagnostics/tests/typealias/methodReference.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/methodReference.fir.kt @@ -4,4 +4,4 @@ class C { typealias CA = C -val cf = CA::foo +val cf = CA::foo diff --git a/compiler/testData/diagnostics/tests/typealias/typeAliasesInQualifiers.fir.kt b/compiler/testData/diagnostics/tests/typealias/typeAliasesInQualifiers.fir.kt index d1910623e44..5e69145cd2a 100644 --- a/compiler/testData/diagnostics/tests/typealias/typeAliasesInQualifiers.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/typeAliasesInQualifiers.fir.kt @@ -50,7 +50,7 @@ fun foo( test.ClassAlias::Nested test.ClassSample::func - test.ClassAlias::func + test.ClassAlias::func test.ClassSample.Nested::func test.ClassAlias.Nested::func @@ -68,7 +68,7 @@ fun foo( test.EnumAlias::Nested test.EnumSample::func - test.EnumAlias::func + test.EnumAlias::func test.EnumSample.Nested::func test.EnumAlias.Nested::func diff --git a/compiler/testData/ir/irText/expressions/propertyReferences.fir.txt b/compiler/testData/ir/irText/expressions/propertyReferences.fir.txt index 9d9a12cb898..7d40da4e59f 100644 --- a/compiler/testData/ir/irText/expressions/propertyReferences.fir.txt +++ b/compiler/testData/ir/irText/expressions/propertyReferences.fir.txt @@ -252,7 +252,7 @@ FILE fqName: fileName:/propertyReferences.kt PROPERTY name:test_J_CONST visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:test_J_CONST type:IrErrorType visibility:private [final,static] EXPRESSION_BODY - ERROR_CALL 'Unsupported callable reference: Q|J|::CONST#' type=IrErrorType + ERROR_CALL 'Unsupported callable reference: Q|J|::#' type=IrErrorType FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:IrErrorType correspondingProperty: PROPERTY name:test_J_CONST visibility:public modality:FINAL [val] BLOCK_BODY @@ -261,7 +261,7 @@ FILE fqName: fileName:/propertyReferences.kt PROPERTY name:test_J_nonConst visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:test_J_nonConst type:IrErrorType visibility:private [final,static] EXPRESSION_BODY - ERROR_CALL 'Unsupported callable reference: Q|J|::nonConst#' type=IrErrorType + ERROR_CALL 'Unsupported callable reference: Q|J|::#' type=IrErrorType FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:IrErrorType correspondingProperty: PROPERTY name:test_J_nonConst visibility:public modality:FINAL [val] BLOCK_BODY