From d91000e39c1c83c3b72b76e6d60ed7fae846cec9 Mon Sep 17 00:00:00 2001 From: Kirill Rakhman Date: Fri, 3 Nov 2023 13:39:27 +0100 Subject: [PATCH] [FIR] Report INAPPLICABLE_CANDIDATE or more specific diagnostic for callable references ... instead of just UNRESOLVED_REFERENCE when something went wrong during resolution. #KT-59401 related --- .../callableReferences/companions.fir.txt | 2 +- .../callableReferences/companions.kt | 2 +- ...CallableReferencesAfterAllSimpleArguments.fir.txt | 4 ++-- ...solveCallableReferencesAfterAllSimpleArguments.kt | 4 ++-- .../callableReferences/implicitTypes.fir.txt | 2 +- .../callableReferences/implicitTypes.kt | 2 +- .../implicitTypes.reversed.fir.txt | 2 +- .../callableReferences/implicitTypes.reversed.kt | 2 +- .../src/org/jetbrains/kotlin/fir/FirCallResolver.kt | 12 +++++++----- .../annotations/annotationRenderingInTypes.fir.kt | 2 +- .../adapted/noKFunctionForAdaptation.fir.kt | 4 ++-- .../bound/expressionWithNullableType.fir.kt | 10 +++++----- .../callableReference/bound/privateToThis.fir.kt | 4 ++-- .../bound/reservedExpressionSyntax.fir.kt | 6 +++--- .../bound/reservedExpressionSyntax2.fir.kt | 2 +- .../constraintFromLHSWithCorrectDirection.fir.kt | 2 +- ...constraintFromLHSWithCorrectDirectionError.fir.kt | 2 +- .../expectedTypeAsSubtypeOfFunctionType.fir.kt | 2 +- .../function/abstractClassConstructors.fir.kt | 2 +- .../function/noAmbiguityMemberVsTopLevel.fir.kt | 4 ++-- .../generic/dependOnArgumentType.fir.kt | 4 ++-- .../generic/explicitTypeArguments.fir.kt | 2 +- .../generic/genericExtensionFunction.fir.kt | 4 ++-- .../genericCallWithReferenceAgainstVararg.fir.kt | 2 +- .../tests/callableReference/kt46437.fir.kt | 2 +- ...erExtensionsImportedFromObjectsUnsupported.fir.kt | 6 +++--- .../property/javaInstanceField.fir.kt | 4 ++-- .../property/javaStaticFieldViaImport.fir.kt | 4 ++-- .../adaptedReferenceAgainstReflectionType.fir.kt | 2 +- ...ityWarningOnReferenceAgainstReflectiveType.fir.kt | 2 +- .../callableReference/resolve/kt35887_simple.fir.kt | 2 +- ...eCallableReferencesAfterAllSimpleArguments.fir.kt | 4 ++-- .../diagnostics/tests/delegation/kt49477.fir.kt | 2 +- .../diagnostics/tests/delegation/kt49477Error.fir.kt | 2 +- ...edFieldAndKotlinInvisiblePropertyReference.fir.kt | 4 ++-- .../diagnostics/tests/inference/kt39220.fir.kt | 8 ++++---- .../referenceToSamFunctionAgainstExpectedType.fir.kt | 2 +- ...basicSuspendConversionForCallableReference.fir.kt | 2 +- .../tests/varargs/varargViewedAsArray.fir.kt | 10 +++++----- .../suspendConversionForCallableReferences.fir.kt | 4 ++-- .../callableReferenceToASuspendFunction.fir.kt | 4 ++-- .../inference/delegates/kt50994.fir.kt | 2 +- .../inference/delegates/kt50994.fir.txt | 2 +- .../linked/statements/assignments/p-2/neg/1.2.fir.kt | 6 +++--- 44 files changed, 80 insertions(+), 78 deletions(-) diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/companions.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/companions.fir.txt index 105b47f2b12..9faabb0c7f3 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/companions.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/companions.fir.txt @@ -53,7 +53,7 @@ FILE: main.kt R|/foo1|(Q|KotlinClass|::R|/KotlinClass.Companion.baz|) R|/foo2|(Q|KotlinClass|::R|/KotlinClass.baz|) #(Q|KotlinClass|::R|/KotlinClass.baz|) - R|/foo1#|(Q|KotlinClass|::#) + R|/foo1#|(Q|KotlinClass|::#) R|/foo2|(Q|KotlinClass|::R|/JavaClass.bar|) R|/foo3|(Q|KotlinClass|::R|/JavaClass.bar|) R|/foo1|(Q|KotlinClass2|::R|/KotlinClass2.Companion.bar|) diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/companions.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/companions.kt index 4018e5020bd..5fa55829b48 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/companions.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/companions.kt @@ -34,7 +34,7 @@ fun main() { foo3(KotlinClass::baz) // Type mismatch - foo1(KotlinClass::bar) + foo1(KotlinClass::bar) foo2(KotlinClass::bar) foo3(KotlinClass::bar) diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/fromBasicDiagnosticTests/resolveCallableReferencesAfterAllSimpleArguments.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/fromBasicDiagnosticTests/resolveCallableReferencesAfterAllSimpleArguments.fir.txt index 80b1d363491..16b6d4d9184 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/fromBasicDiagnosticTests/resolveCallableReferencesAfterAllSimpleArguments.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/fromBasicDiagnosticTests/resolveCallableReferencesAfterAllSimpleArguments.fir.txt @@ -10,6 +10,6 @@ FILE: resolveCallableReferencesAfterAllSimpleArguments.kt public final fun baz(e: R|T|, f: R|(T) -> kotlin/Unit|): R|kotlin/Unit| { } public final fun test(a: R|A|, b: R|B|): R|kotlin/Unit| { - R|/baz#|(R|/a|, ::#) - R|/bar#|(::#, R|/a|) + R|/baz#|(R|/a|, ::#) + R|/bar#|(::#, R|/a|) } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/fromBasicDiagnosticTests/resolveCallableReferencesAfterAllSimpleArguments.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/fromBasicDiagnosticTests/resolveCallableReferencesAfterAllSimpleArguments.kt index 4532c22b733..cedc49708ff 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/fromBasicDiagnosticTests/resolveCallableReferencesAfterAllSimpleArguments.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/fromBasicDiagnosticTests/resolveCallableReferencesAfterAllSimpleArguments.kt @@ -7,6 +7,6 @@ fun bar(f: (T) -> Unit, e: T) {} fun baz(e: T, f: (T) -> Unit) {} fun test(a: A, b: B) { - baz(a, ::fooB) - bar(::fooB, a) + baz(a, ::fooB) + bar(::fooB, a) } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.fir.txt index 4ea0a252edf..e4c058df6fe 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.fir.txt @@ -9,7 +9,7 @@ FILE: implicitTypes.kt ^bar Int(1) } public final fun loop1(): R|(ERROR CLASS: Cannot infer argument for type parameter T) -> ERROR CLASS: Cannot infer argument for type parameter R| { - ^loop1 R|/use#|<, >(::#) + ^loop1 R|/use#|<, >(::#) } public final fun loop2(): { ^loop2 R|/loop1|() diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.kt index 1c76deeea5d..b692a26e384 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.kt @@ -3,5 +3,5 @@ fun use(x: (T) -> R): (T) -> R = x fun foo() = use(::bar) fun bar(x: String) = 1 -fun loop1() = use(::loop2) +fun loop1() = use(::loop2) fun loop2() = loop1() diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.reversed.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.reversed.fir.txt index c978e7c8600..e7d60114f62 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.reversed.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.reversed.fir.txt @@ -9,7 +9,7 @@ FILE: implicitTypes.reversed.kt ^bar Int(1) } public final fun loop1(): R|(ERROR CLASS: Cannot infer argument for type parameter T) -> ERROR CLASS: Cannot infer argument for type parameter R| { - ^loop1 R|/use#|<, >(::#) + ^loop1 R|/use#|<, >(::#) } public final fun loop2(): R|(ERROR CLASS: Cannot infer argument for type parameter T) -> ERROR CLASS: Cannot infer argument for type parameter R| { ^loop2 R|/loop1|() diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.reversed.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.reversed.kt index 561f29d2471..a3ce3669f23 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.reversed.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/implicitTypes.reversed.kt @@ -3,5 +3,5 @@ fun use(x: (T) -> R): (T) -> R = x fun foo() = use(::bar) fun bar(x: String) = 1 -fun loop1() = use(::loop2) +fun loop1() = use(::loop2) fun loop2() = loop1() diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirCallResolver.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirCallResolver.kt index 010e24b9272..bb525069598 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirCallResolver.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/FirCallResolver.kt @@ -414,11 +414,13 @@ class FirCallResolver( !isSuccess -> { val errorReference = buildReferenceWithErrorCandidate( info, - if (applicability == CandidateApplicability.K2_UNSUPPORTED) { - val unsupportedResolutionDiagnostic = reducedCandidates.firstOrNull()?.diagnostics?.firstOrNull() as? Unsupported - ConeUnsupported(unsupportedResolutionDiagnostic?.message ?: "", unsupportedResolutionDiagnostic?.source) - } else { - ConeUnresolvedReferenceError(info.name) + when { + applicability == CandidateApplicability.K2_UNSUPPORTED -> { + val unsupportedResolutionDiagnostic = reducedCandidates.firstOrNull()?.diagnostics?.firstOrNull() as? Unsupported + ConeUnsupported(unsupportedResolutionDiagnostic?.message ?: "", unsupportedResolutionDiagnostic?.source) + } + reducedCandidates.size == 1 -> createConeDiagnosticForCandidateWithError(applicability, reducedCandidates.single()) + else -> ConeUnresolvedReferenceError(info.name) }, callableReferenceAccess.source ) diff --git a/compiler/testData/diagnostics/tests/annotations/annotationRenderingInTypes.fir.kt b/compiler/testData/diagnostics/tests/annotations/annotationRenderingInTypes.fir.kt index 7d6814ec7b3..5be4614dd3e 100644 --- a/compiler/testData/diagnostics/tests/annotations/annotationRenderingInTypes.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/annotationRenderingInTypes.fir.kt @@ -3,7 +3,7 @@ fun f1(x: String) {} fun f2(f: () -> Unit) {} -fun test1() = f2(::f1) +fun test1() = f2(::f1) @Target(AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.TYPE) diff --git a/compiler/testData/diagnostics/tests/callableReference/adapted/noKFunctionForAdaptation.fir.kt b/compiler/testData/diagnostics/tests/callableReference/adapted/noKFunctionForAdaptation.fir.kt index 8eab7076077..2621c349681 100644 --- a/compiler/testData/diagnostics/tests/callableReference/adapted/noKFunctionForAdaptation.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/adapted/noKFunctionForAdaptation.fir.kt @@ -3,12 +3,12 @@ fun foo(x: String = "O"): String = x fun bar(x: String = "K"): String = x fun dump(dumpStrategy: String) { - val k0: kotlin.reflect.KFunction0 = returnAdapter(::foo) // Error: ADAPTED_CALLABLE_REFERENCE_AGAINST_REFLECTION_TYPE + val k0: kotlin.reflect.KFunction0 = returnAdapter(::foo) // Error: ADAPTED_CALLABLE_REFERENCE_AGAINST_REFLECTION_TYPE val k1: kotlin.reflect.KFunction0 = ::foo // Should be error here, too val k2: kotlin.reflect.KFunction0 = if (dumpStrategy == "KotlinLike") ::foo else ::bar - val f0: Function0 = returnAdapter(::foo) + val f0: Function0 = returnAdapter(::foo) val f1: Function0 = ::foo val f2: Function0 = if (dumpStrategy == "KotlinLike") ::foo else ::bar } diff --git a/compiler/testData/diagnostics/tests/callableReference/bound/expressionWithNullableType.fir.kt b/compiler/testData/diagnostics/tests/callableReference/bound/expressionWithNullableType.fir.kt index 7f33b4cbd4c..5b2122695fb 100644 --- a/compiler/testData/diagnostics/tests/callableReference/bound/expressionWithNullableType.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/bound/expressionWithNullableType.fir.kt @@ -6,10 +6,10 @@ public interface J { // FILE: test.kt -fun f1(x: Int?): Any = x::hashCode -fun f2(t: T): Any = t::hashCode -fun f3(s: S): Any = s::hashCode -fun f4(u: U?): Any = u::hashCode -fun f5(c: List<*>): Any = c[0]::hashCode +fun f1(x: Int?): Any = x::hashCode +fun f2(t: T): Any = t::hashCode +fun f3(s: S): Any = s::hashCode +fun f4(u: U?): Any = u::hashCode +fun f5(c: List<*>): Any = c[0]::hashCode fun f6(j: J): Any = j.platformString()::hashCode diff --git a/compiler/testData/diagnostics/tests/callableReference/bound/privateToThis.fir.kt b/compiler/testData/diagnostics/tests/callableReference/bound/privateToThis.fir.kt index 442c3627147..8c260b27967 100644 --- a/compiler/testData/diagnostics/tests/callableReference/bound/privateToThis.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/bound/privateToThis.fir.kt @@ -9,7 +9,7 @@ class Foo(name: T) { val ok2 = this@Foo::prop val ok3 = object { val y: Any = this@Foo::prop } - val fail1 = Foo(prop)::prop + val fail1 = Foo(prop)::prop } fun testFunc() { @@ -17,7 +17,7 @@ class Foo(name: T) { val ok2 = this@Foo::func val ok3 = object { val y: Any = this@Foo::func } - val fail1 = Foo(prop)::func + val fail1 = Foo(prop)::func } private fun func(t: T): T = t diff --git a/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax.fir.kt b/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax.fir.kt index 2f4780bc6e2..0bbe805ba4d 100644 --- a/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax.fir.kt @@ -19,9 +19,9 @@ class Test { fun List.testCallable1(): () -> Unit = a::foo fun List.testCallable1a(): () -> Unit = a::foo - fun List.testCallable2(): () -> Unit = b?::foo - fun List.testCallable3(): () -> Unit = b::foo - fun List.testCallable4(): () -> Unit = b?::foo + fun List.testCallable2(): () -> Unit = b?::foo + fun List.testCallable3(): () -> Unit = b::foo + fun List.testCallable4(): () -> Unit = b?::foo fun List.testClassLiteral1() = a::class fun List.testClassLiteral1a() = a::class diff --git a/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax2.fir.kt b/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax2.fir.kt index 1a8ec946b8a..254f337237f 100644 --- a/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax2.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax2.fir.kt @@ -4,4 +4,4 @@ package test fun nullableFun(): Int? = null fun Int.foo() {} -val test1 = nullableFun()?::foo +val test1 = nullableFun()?::foo diff --git a/compiler/testData/diagnostics/tests/callableReference/constraintFromLHSWithCorrectDirection.fir.kt b/compiler/testData/diagnostics/tests/callableReference/constraintFromLHSWithCorrectDirection.fir.kt index eae0aa00f0d..47da11be8c7 100644 --- a/compiler/testData/diagnostics/tests/callableReference/constraintFromLHSWithCorrectDirection.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/constraintFromLHSWithCorrectDirection.fir.kt @@ -18,6 +18,6 @@ fun B.star(p: KProperty1<*, V>): B = TODO() fun B.test(){ foo(A::bla) bar(A::bla) - baz(A::bla) + baz(A::bla) star(A::bla) } diff --git a/compiler/testData/diagnostics/tests/callableReference/constraintFromLHSWithCorrectDirectionError.fir.kt b/compiler/testData/diagnostics/tests/callableReference/constraintFromLHSWithCorrectDirectionError.fir.kt index 6f84b03e6ff..cb3fe48d189 100644 --- a/compiler/testData/diagnostics/tests/callableReference/constraintFromLHSWithCorrectDirectionError.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/constraintFromLHSWithCorrectDirectionError.fir.kt @@ -14,5 +14,5 @@ fun B.foo(p: KProperty1) {} class C : A fun B.test(){ - foo(C::bla) + foo(C::bla) } diff --git a/compiler/testData/diagnostics/tests/callableReference/expectedTypeAsSubtypeOfFunctionType.fir.kt b/compiler/testData/diagnostics/tests/callableReference/expectedTypeAsSubtypeOfFunctionType.fir.kt index 86913a82ace..4f913e25bf8 100644 --- a/compiler/testData/diagnostics/tests/callableReference/expectedTypeAsSubtypeOfFunctionType.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/expectedTypeAsSubtypeOfFunctionType.fir.kt @@ -7,6 +7,6 @@ fun takeIt(x: T, f: SubFunction) {} fun cr() {} fun test() { - takeIt(42, ::cr) + takeIt(42, ::cr) takeIt(42, { }) } diff --git a/compiler/testData/diagnostics/tests/callableReference/function/abstractClassConstructors.fir.kt b/compiler/testData/diagnostics/tests/callableReference/function/abstractClassConstructors.fir.kt index dabdec37e8c..d919a018e30 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/abstractClassConstructors.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/abstractClassConstructors.fir.kt @@ -8,5 +8,5 @@ fun main() { ::A ::B ::C // KT-3465 - ::D + ::D } diff --git a/compiler/testData/diagnostics/tests/callableReference/function/noAmbiguityMemberVsTopLevel.fir.kt b/compiler/testData/diagnostics/tests/callableReference/function/noAmbiguityMemberVsTopLevel.fir.kt index cb21ffcfa16..7e866f8668e 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/noAmbiguityMemberVsTopLevel.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/noAmbiguityMemberVsTopLevel.fir.kt @@ -25,7 +25,7 @@ class A { expectFunction0Unit(::foo) expectFunction0String(::foo) - expectFunction1Unit(::foo) - expectFunction1String(::foo) + expectFunction1Unit(::foo) + expectFunction1String(::foo) } } diff --git a/compiler/testData/diagnostics/tests/callableReference/generic/dependOnArgumentType.fir.kt b/compiler/testData/diagnostics/tests/callableReference/generic/dependOnArgumentType.fir.kt index fc8eea48886..62c5d3f9615 100644 --- a/compiler/testData/diagnostics/tests/callableReference/generic/dependOnArgumentType.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/generic/dependOnArgumentType.fir.kt @@ -16,14 +16,14 @@ fun bar(s: T) {} fun complex(t: T, f: (T) -> Unit) {} fun test1() { - foo(1, A::invokeLater) // KT-24507 SAM conversion accidentally applied to callable reference and incorrectly handled via BE + foo(1, A::invokeLater) // KT-24507 SAM conversion accidentally applied to callable reference and incorrectly handled via BE foo(1, ::bar) complex(1, ::bar) } fun test2(x: R) { - foo(x, A::invokeLater) // KT-24507 SAM conversion accidentally applied to callable reference and incorrectly handled via BE + foo(x, A::invokeLater) // KT-24507 SAM conversion accidentally applied to callable reference and incorrectly handled via BE foo(x, ::bar) complex(x, ::bar) diff --git a/compiler/testData/diagnostics/tests/callableReference/generic/explicitTypeArguments.fir.kt b/compiler/testData/diagnostics/tests/callableReference/generic/explicitTypeArguments.fir.kt index 00fd1ed9da6..29433d0f8b4 100644 --- a/compiler/testData/diagnostics/tests/callableReference/generic/explicitTypeArguments.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/generic/explicitTypeArguments.fir.kt @@ -13,7 +13,7 @@ fun Wrapper.baz(transform: (T) -> Unit): T = TODO() fun test() { takeFun(::foo) - takeFun(::fooInt) + takeFun(::fooInt) callFun>(::createWrapper) callFun>(::createWrapper) diff --git a/compiler/testData/diagnostics/tests/callableReference/generic/genericExtensionFunction.fir.kt b/compiler/testData/diagnostics/tests/callableReference/generic/genericExtensionFunction.fir.kt index 5582063a049..b9f2892c322 100644 --- a/compiler/testData/diagnostics/tests/callableReference/generic/genericExtensionFunction.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/generic/genericExtensionFunction.fir.kt @@ -22,8 +22,8 @@ fun test1() { fun test2() { bar(Wrapper::fooReturnString).checkType { _>() } bar(Wrapper::fooReturnString).checkType { _>() } - bar(Wrapper::fooReturnString) - bar(Wrapper::fooReturnString) + bar(Wrapper::fooReturnString) + bar(Wrapper::fooReturnString) bar(Wrapper::fooTakeInt).checkType { _>() } bar(Wrapper::fooTakeInt).checkType { _>() } diff --git a/compiler/testData/diagnostics/tests/callableReference/genericCallWithReferenceAgainstVararg.fir.kt b/compiler/testData/diagnostics/tests/callableReference/genericCallWithReferenceAgainstVararg.fir.kt index 995bf4d0184..456c8a638e7 100644 --- a/compiler/testData/diagnostics/tests/callableReference/genericCallWithReferenceAgainstVararg.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/genericCallWithReferenceAgainstVararg.fir.kt @@ -4,7 +4,7 @@ fun foo(vararg ints: Int) {} fun test(i: IntArray) { myLet(i, ::foo) myLet(::foo) - myLet(::foo) + myLet(::foo) myLet(::foo) myLetExplicit1(::foo) myLetExplicit2(::foo) diff --git a/compiler/testData/diagnostics/tests/callableReference/kt46437.fir.kt b/compiler/testData/diagnostics/tests/callableReference/kt46437.fir.kt index 44e6814a701..2bd177997e1 100644 --- a/compiler/testData/diagnostics/tests/callableReference/kt46437.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/kt46437.fir.kt @@ -1,5 +1,5 @@ fun box(): String { - if (true) X::y else null + if (true) X::y else null return "OK" } diff --git a/compiler/testData/diagnostics/tests/callableReference/memberExtensionsImportedFromObjectsUnsupported.fir.kt b/compiler/testData/diagnostics/tests/callableReference/memberExtensionsImportedFromObjectsUnsupported.fir.kt index acb5d9506f8..88854f3feff 100644 --- a/compiler/testData/diagnostics/tests/callableReference/memberExtensionsImportedFromObjectsUnsupported.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/memberExtensionsImportedFromObjectsUnsupported.fir.kt @@ -15,11 +15,11 @@ class A { fun test() { String::ext - Obj::ext + Obj::ext String::ext2 - A.Companion::ext2 - A::ext2 + A.Companion::ext2 + A::ext2 A::foo A::bar diff --git a/compiler/testData/diagnostics/tests/callableReference/property/javaInstanceField.fir.kt b/compiler/testData/diagnostics/tests/callableReference/property/javaInstanceField.fir.kt index e2c3f36339b..17869fb872a 100644 --- a/compiler/testData/diagnostics/tests/callableReference/property/javaInstanceField.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/property/javaInstanceField.fir.kt @@ -21,6 +21,6 @@ fun test() { 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 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 e5362097048..b3f62015aec 100644 --- a/compiler/testData/diagnostics/tests/callableReference/property/javaStaticFieldViaImport.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/property/javaStaticFieldViaImport.fir.kt @@ -23,6 +23,6 @@ fun test() { val pubMutRef: KMutableProperty0 = ::publicMutable val protFinRef: KProperty = ::protectedFinal val protMutRef: KMutableProperty = ::protectedMutable - val privFinRef: KProperty = ::privateFinal - val privMutRef: KMutableProperty = ::privateMutable + val privFinRef: KProperty = ::privateFinal + val privMutRef: KMutableProperty = ::privateMutable } diff --git a/compiler/testData/diagnostics/tests/callableReference/resolve/adaptedReferenceAgainstReflectionType.fir.kt b/compiler/testData/diagnostics/tests/callableReference/resolve/adaptedReferenceAgainstReflectionType.fir.kt index 07280bcb466..fc0641a74e3 100644 --- a/compiler/testData/diagnostics/tests/callableReference/resolve/adaptedReferenceAgainstReflectionType.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/resolve/adaptedReferenceAgainstReflectionType.fir.kt @@ -22,6 +22,6 @@ object Local { fun baz(x: Int, y: Int = 0): Int = 0 fun test() { - bar(::baz) + bar(::baz) } } diff --git a/compiler/testData/diagnostics/tests/callableReference/resolve/compatibilityWarningOnReferenceAgainstReflectiveType.fir.kt b/compiler/testData/diagnostics/tests/callableReference/resolve/compatibilityWarningOnReferenceAgainstReflectiveType.fir.kt index 7c0b8f8f939..597c63f7b05 100644 --- a/compiler/testData/diagnostics/tests/callableReference/resolve/compatibilityWarningOnReferenceAgainstReflectiveType.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/resolve/compatibilityWarningOnReferenceAgainstReflectiveType.fir.kt @@ -22,6 +22,6 @@ object Local { fun baz(x: Int, y: Int = 0): Int = 0 fun test() { - bar(::baz) + bar(::baz) } } diff --git a/compiler/testData/diagnostics/tests/callableReference/resolve/kt35887_simple.fir.kt b/compiler/testData/diagnostics/tests/callableReference/resolve/kt35887_simple.fir.kt index 203670aacc0..3640c45fa0e 100644 --- a/compiler/testData/diagnostics/tests/callableReference/resolve/kt35887_simple.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/resolve/kt35887_simple.fir.kt @@ -5,4 +5,4 @@ import kotlin.reflect.KProperty0 object A fun property0(property: KProperty0) = A -val K.key get() : A = property0(Map.Entry::key) // should be forbidden +val K.key get() : A = property0(Map.Entry::key) // should be forbidden diff --git a/compiler/testData/diagnostics/tests/callableReference/resolve/resolveCallableReferencesAfterAllSimpleArguments.fir.kt b/compiler/testData/diagnostics/tests/callableReference/resolve/resolveCallableReferencesAfterAllSimpleArguments.fir.kt index 69546dbdc88..0d91f681fe7 100644 --- a/compiler/testData/diagnostics/tests/callableReference/resolve/resolveCallableReferencesAfterAllSimpleArguments.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/resolve/resolveCallableReferencesAfterAllSimpleArguments.fir.kt @@ -10,6 +10,6 @@ fun baz(e: T, f: (T) -> Unit) {} fun test(a: A, b: B) { // Note that diagnostic is always on callable references as they are resolved after simple arguments - baz(a, ::fooB) - bar(::fooB, a) + baz(a, ::fooB) + bar(::fooB, a) } diff --git a/compiler/testData/diagnostics/tests/delegation/kt49477.fir.kt b/compiler/testData/diagnostics/tests/delegation/kt49477.fir.kt index cedbdc38b5e..79ba936d589 100644 --- a/compiler/testData/diagnostics/tests/delegation/kt49477.fir.kt +++ b/compiler/testData/diagnostics/tests/delegation/kt49477.fir.kt @@ -26,7 +26,7 @@ infix fun filter(filter: (R, Any?) -> Boolean): Delegate class GitLabChangesProcessor: DatabaseEntity { var buildProcessors by child_many( GitLabBuildProcessor::class.java, - GitLabBuildProcessor::processor + GitLabBuildProcessor::processor ) } diff --git a/compiler/testData/diagnostics/tests/delegation/kt49477Error.fir.kt b/compiler/testData/diagnostics/tests/delegation/kt49477Error.fir.kt index a00df2948db..a78904be132 100644 --- a/compiler/testData/diagnostics/tests/delegation/kt49477Error.fir.kt +++ b/compiler/testData/diagnostics/tests/delegation/kt49477Error.fir.kt @@ -27,7 +27,7 @@ infix fun filter(filter: (R, Any?) -> Boolean): Delegate class GitLabChangesProcessor: DatabaseEntity { var buildProcessors by child_many( GitLabBuildProcessor::class.java, - GitLabBuildProcessor::processor + GitLabBuildProcessor::processor ) } diff --git a/compiler/testData/diagnostics/tests/fieldRename/javaProtectedFieldAndKotlinInvisiblePropertyReference.fir.kt b/compiler/testData/diagnostics/tests/fieldRename/javaProtectedFieldAndKotlinInvisiblePropertyReference.fir.kt index 701de67cda4..5424fff8e69 100644 --- a/compiler/testData/diagnostics/tests/fieldRename/javaProtectedFieldAndKotlinInvisiblePropertyReference.fir.kt +++ b/compiler/testData/diagnostics/tests/fieldRename/javaProtectedFieldAndKotlinInvisiblePropertyReference.fir.kt @@ -56,7 +56,7 @@ class Derived : Intermediate() { fun bar() = a // Non-reference - fun baz() = this::b // Non-protected + fun baz() = this::b // Non-protected } typealias Alias = Intermediate @@ -90,5 +90,5 @@ class DirectlyDerived : BaseJava() { } fun test(d: Derived) { - d::a // Field is also invisible + d::a // Field is also invisible } diff --git a/compiler/testData/diagnostics/tests/inference/kt39220.fir.kt b/compiler/testData/diagnostics/tests/inference/kt39220.fir.kt index 4ada5ae2a3c..adcf17020ab 100644 --- a/compiler/testData/diagnostics/tests/inference/kt39220.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/kt39220.fir.kt @@ -114,14 +114,14 @@ fun main() { bar7(Foo::resolve) // OK // with LHS and sentension function expected type - bar10(Int::x1) // ERROR before the fix in NI + bar10(Int::x1) // ERROR before the fix in NI bar10(Int::x1) // OK bar10(Int::x1) // OK fun Int.ext() { // with LHS and sentension function expected type - bar10(::x1) // ERROR before the fix in NI - bar10(::x1) // OK - bar10(::x1) // OK + bar10(::x1) // ERROR before the fix in NI + bar10(::x1) // OK + bar10(::x1) // OK } } diff --git a/compiler/testData/diagnostics/tests/j+k/sam/referenceToSamFunctionAgainstExpectedType.fir.kt b/compiler/testData/diagnostics/tests/j+k/sam/referenceToSamFunctionAgainstExpectedType.fir.kt index 48c9bef96a7..63ce474ff44 100644 --- a/compiler/testData/diagnostics/tests/j+k/sam/referenceToSamFunctionAgainstExpectedType.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/sam/referenceToSamFunctionAgainstExpectedType.fir.kt @@ -18,7 +18,7 @@ public class Inv { fun test(inv: Inv) { val m: ((String) -> String) -> Inv = inv::map - take(inv::map) + take(inv::map) } fun take(f: ((String) -> String) -> Inv) {} diff --git a/compiler/testData/diagnostics/tests/suspendConversion/basicSuspendConversionForCallableReference.fir.kt b/compiler/testData/diagnostics/tests/suspendConversion/basicSuspendConversionForCallableReference.fir.kt index 3536c68318e..063b6ce1cac 100644 --- a/compiler/testData/diagnostics/tests/suspendConversion/basicSuspendConversionForCallableReference.fir.kt +++ b/compiler/testData/diagnostics/tests/suspendConversion/basicSuspendConversionForCallableReference.fir.kt @@ -14,5 +14,5 @@ fun test() { foo2(42, ::bar2) foo2("str", ::bar2) - foo2(42, ::bar1) + foo2(42, ::bar1) } diff --git a/compiler/testData/diagnostics/tests/varargs/varargViewedAsArray.fir.kt b/compiler/testData/diagnostics/tests/varargs/varargViewedAsArray.fir.kt index a370fdbd428..a158ea76755 100644 --- a/compiler/testData/diagnostics/tests/varargs/varargViewedAsArray.fir.kt +++ b/compiler/testData/diagnostics/tests/varargs/varargViewedAsArray.fir.kt @@ -20,9 +20,9 @@ fun test() { useStringArray(::stringVararg) useIntArray(::numberVararg) usePrimitiveIntArray(::intVararg) - useIntArray(::intVararg) - useMixedStringArgs1(::stringVararg) - useMixedStringArgs2(::stringVararg) - useMixedStringArgs3(::stringVararg) - useTwoStringArrays(::stringVararg) + useIntArray(::intVararg) + useMixedStringArgs1(::stringVararg) + useMixedStringArgs2(::stringVararg) + useMixedStringArgs3(::stringVararg) + useTwoStringArrays(::stringVararg) } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/suspendConversionForCallableReferences.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/suspendConversionForCallableReferences.fir.kt index 5360e356001..92f3d015856 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/suspendConversionForCallableReferences.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/callableReference/suspendConversionForCallableReferences.fir.kt @@ -10,7 +10,7 @@ suspend fun String.id(): String = this fun box() { val x = "f" builder { - go1(x::id) - go2(x::id) + go1(x::id) + go2(x::id) } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/callableReferenceToASuspendFunction.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/callableReferenceToASuspendFunction.fir.kt index 56be7f1b012..ad4c2065b61 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/callableReferenceToASuspendFunction.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/callableReferenceToASuspendFunction.fir.kt @@ -14,8 +14,8 @@ suspend fun bar(x: Int) {} fun test() { test0(::foo) - test1(::foo) + test1(::foo) - test0(::bar) + test0(::bar) test1(::bar) } diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/delegates/kt50994.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/delegates/kt50994.fir.kt index 7a0ea532842..672525b7cd7 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/delegates/kt50994.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/delegates/kt50994.fir.kt @@ -9,7 +9,7 @@ class ProcessorWithParent : Entity { } class ProcessorWithChildren : Entity { - var processors by children(ProcessorWithParent::class.java, ProcessorWithParent::processor) + var processors by children(ProcessorWithParent::class.java, ProcessorWithParent::processor) } class Processor2WithParent : Entity { diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/delegates/kt50994.fir.txt b/compiler/testData/diagnostics/testsWithStdLib/inference/delegates/kt50994.fir.txt index 0c43ed18384..98b2a44ddb6 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/delegates/kt50994.fir.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/delegates/kt50994.fir.txt @@ -18,7 +18,7 @@ FILE: kt50994.fir.kt super() } - public final var processors: R|kotlin/collections/MutableCollection|by this@R|/ProcessorWithChildren|.R|/children#|((Q|ProcessorWithParent|).R|kotlin/jvm/java|, Q|ProcessorWithParent|::#) + public final var processors: R|kotlin/collections/MutableCollection|by this@R|/ProcessorWithChildren|.R|/children#|((Q|ProcessorWithParent|).R|kotlin/jvm/java|, Q|ProcessorWithParent|::#) public get(): R|kotlin/collections/MutableCollection| { ^ this@R|/ProcessorWithChildren|.D|/ProcessorWithChildren.processors|.R|SubstitutionOverride|>|(this@R|/ProcessorWithChildren|, ::R|/ProcessorWithChildren.processors|) } diff --git a/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/neg/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/neg/1.2.fir.kt index e625400b03d..c7cc1be185b 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/neg/1.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/neg/1.2.fir.kt @@ -21,7 +21,7 @@ fun case1() { val x : Case1? = Case1() x.x = "0" x?.x = "0" - x::x = TODO() + x::x = TODO() } class Case1{ @@ -37,7 +37,7 @@ fun case2() { val x : Case2? = Case2(null) x.x = "0" x?.x = "0" - x::x = TODO() + x::x = TODO() } class Case2(val x: Any?) {} @@ -50,7 +50,7 @@ fun case3() { val x : Case3? = Case3() x.x = "0" x?.x = "0" - x::x = TODO() + x::x = TODO() } class Case3() {