diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/receivers/implicitReceivers.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/receivers/implicitReceivers.kt index e3c433a879e..ddbf455364e 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/receivers/implicitReceivers.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/receivers/implicitReceivers.kt @@ -34,8 +34,8 @@ fun Any?.test_2() { } fun test_3(a: Any, b: Any, c: Any) { - with(a) wa@{ - with(b) wb@{ + with(a) wa@{ + with(b) wb@{ with(c) wc@{ this@wb as A this@wb.foo() diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/fromBasicDiagnosticTests/chooseCallableReferenceDependingOnInferredReceiver.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/fromBasicDiagnosticTests/chooseCallableReferenceDependingOnInferredReceiver.kt index a3a42e6696c..30e6b89cf05 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/fromBasicDiagnosticTests/chooseCallableReferenceDependingOnInferredReceiver.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/fromBasicDiagnosticTests/chooseCallableReferenceDependingOnInferredReceiver.kt @@ -14,18 +14,18 @@ class B { fun bar(f: (T) -> Unit): T = TODO() fun test() { - myWith(A()) { - val t1 = bar(::foo) + myWith(A()) { + val t1 = bar(::foo) val t2 = bar(::baz) - myWith(B()) { + myWith(B()) { val a: A = bar(::foo) val b: B = bar(::foo) val t3 = bar(::baz) - bar(::foo) + bar(::foo) } } } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/coneDiagnosticToFirDiagnostic.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/coneDiagnosticToFirDiagnostic.kt index 38568986466..ef6ac44117b 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/coneDiagnosticToFirDiagnostic.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/coneDiagnosticToFirDiagnostic.kt @@ -19,6 +19,7 @@ import org.jetbrains.kotlin.fir.builder.FirSyntaxErrors import org.jetbrains.kotlin.fir.declarations.utils.* import org.jetbrains.kotlin.fir.diagnostics.* import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessExpression +import org.jetbrains.kotlin.fir.expressions.FirResolvable import org.jetbrains.kotlin.fir.references.toResolvedCallableSymbol import org.jetbrains.kotlin.fir.resolve.calls.* import org.jetbrains.kotlin.fir.resolve.diagnostics.* @@ -513,7 +514,9 @@ private fun ConstraintSystemError.toDiagnostic( } FirErrors.NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER.createOn( - candidate.sourceOfCallToSymbolWith(this.typeVariable as ConeTypeVariable) ?: source, + (resolvedAtom as? FirResolvable)?.calleeReference?.source + ?: candidate.sourceOfCallToSymbolWith(this.typeVariable as ConeTypeVariable) + ?: source, typeVariableName, ) } diff --git a/compiler/testData/diagnostics/tests/callableReference/kt34314.fir.kt b/compiler/testData/diagnostics/tests/callableReference/kt34314.fir.kt index 1832a82cbb4..81f175cf846 100644 --- a/compiler/testData/diagnostics/tests/callableReference/kt34314.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/kt34314.fir.kt @@ -1,5 +1,5 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE fun main() { - val x = run { ::run } // no error + val x = run { ::run } // no error } diff --git a/compiler/testData/diagnostics/tests/callableReference/resolve/chooseCallableReferenceDependingOnInferredReceiver.fir.kt b/compiler/testData/diagnostics/tests/callableReference/resolve/chooseCallableReferenceDependingOnInferredReceiver.fir.kt index 7dc38927dad..8951ffb6417 100644 --- a/compiler/testData/diagnostics/tests/callableReference/resolve/chooseCallableReferenceDependingOnInferredReceiver.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/resolve/chooseCallableReferenceDependingOnInferredReceiver.fir.kt @@ -16,21 +16,21 @@ class B { fun bar(f: (T) -> Unit): T = TODO() fun test() { - myWith(A()) { - val t1 = bar(::foo) + myWith(A()) { + val t1 = bar(::foo) t1 val t2 = bar(::baz) t2 - myWith(B()) { + myWith(B()) { val a: A = bar(::foo) val b: B = bar(::foo) val t3 = bar(::baz) t3 - bar(::foo) + bar(::foo) } } } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/noInferenceFromGetValueThroughSetValue.fir.kt b/compiler/testData/diagnostics/tests/delegatedProperty/noInferenceFromGetValueThroughSetValue.fir.kt index eeeadf6dd3b..48c1526680b 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/noInferenceFromGetValueThroughSetValue.fir.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/noInferenceFromGetValueThroughSetValue.fir.kt @@ -9,7 +9,7 @@ operator fun M.setValue(thisRef: Any?, property: KProperty<*>, value: fun m(): M = M() // We don't allow to infer type of a delegate expression through a setValue, where the argument (value) is constrained by the return type of a getValue -var a by m() +var a by m() // We infer type of delegate expression through a setValue from the explicit property type var b: String by m() diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/conflicting.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/conflicting.fir.kt index b6f76a1d9a5..f17e57bc930 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/conflicting.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/conflicting.fir.kt @@ -10,8 +10,8 @@ fun f(): Unit = TODO() fun f(): Unit = TODO() fun test(a: A, b: B) { - with(a) { - with(b) { + with(a) { + with(b) { f() } } diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/conflictingWithDifferentOrder.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/conflictingWithDifferentOrder.fir.kt index f17e936a79b..f4f302aa4d2 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/conflictingWithDifferentOrder.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/conflictingWithDifferentOrder.fir.kt @@ -10,8 +10,8 @@ context(B, A) fun f(): Unit = TODO() fun test(a: A, b: B) { - with(a) { - with(b) { + with(a) { + with(b) { f() } } diff --git a/compiler/testData/diagnostics/tests/incompleteCode/controlStructuresErrors.fir.kt b/compiler/testData/diagnostics/tests/incompleteCode/controlStructuresErrors.fir.kt index a07e5bad292..1aeeb33d0a7 100644 --- a/compiler/testData/diagnostics/tests/incompleteCode/controlStructuresErrors.fir.kt +++ b/compiler/testData/diagnostics/tests/incompleteCode/controlStructuresErrors.fir.kt @@ -1,20 +1,20 @@ fun test1() { - if (rr) { - if (l) { + if (rr) { + if (l) { a.q() } else { a.w() - } + } } else { - if (n) { + if (n) { a.t() } else { a.u() - } + } } } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferences.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferences.fir.kt index 866cbc0a23f..f20dd7e65c2 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferences.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferences.fir.kt @@ -185,7 +185,7 @@ fun poll25(flag: Boolean): Flow { fun poll26(flag: Boolean): Flow { return flow { - val inv = when (flag) { true -> ::Foo7 false -> foo7() else -> ::Foo7 } + val inv = when (flag) { true -> ::Foo7 false -> foo7() else -> ::Foo7 } inv } } @@ -479,7 +479,7 @@ fun poll85(): Flow { fun poll86(): Flow { return flow { - val inv = ::Foo7 in setOf(::Foo7) + val inv = ::Foo7 in setOf(::Foo7) inv } } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesUnrestricted.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesUnrestricted.fir.kt index adc7e3b777b..bf08d80886a 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesUnrestricted.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesUnrestricted.fir.kt @@ -187,7 +187,7 @@ fun poll25(flag: Boolean): Flow { fun poll26(flag: Boolean): Flow { return flow { - val inv = when (flag) { true -> ::Foo7 false -> foo7() else -> ::Foo7 } + val inv = when (flag) { true -> ::Foo7 false -> foo7() else -> ::Foo7 } inv } } @@ -481,7 +481,7 @@ fun poll85(): Flow { fun poll86(): Flow { return flow { - val inv = ::Foo7 in setOf(::Foo7) + val inv = ::Foo7 in setOf(::Foo7) inv } } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/stubTypeReceiverRestriction.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/stubTypeReceiverRestriction.fir.kt index 0e03ee7300b..c6355e2225d 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/stubTypeReceiverRestriction.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/stubTypeReceiverRestriction.fir.kt @@ -64,9 +64,9 @@ val T.genericLambda: T.((T) -> Unit) -> Unit get() = {} fun test6() { b { - extension() + extension() genericLambda { } - genericLambda { it.extension() } + genericLambda { it.extension() } use(::extension) } } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/stubTypeReceiverRestrictionDisabled.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/stubTypeReceiverRestrictionDisabled.fir.kt index fead69570bd..90c55c85030 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/stubTypeReceiverRestrictionDisabled.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/stubTypeReceiverRestrictionDisabled.fir.kt @@ -65,9 +65,9 @@ val T.genericLambda: T.((T) -> Unit) -> Unit get() = {} fun test6() { b { - extension() + extension() genericLambda { } - genericLambda { it.extension() } + genericLambda { it.extension() } use(::extension) } } diff --git a/compiler/testData/diagnostics/tests/inference/coercionToUnit/coersionWithAnonymousFunctionsAndUnresolved.fir.kt b/compiler/testData/diagnostics/tests/inference/coercionToUnit/coersionWithAnonymousFunctionsAndUnresolved.fir.kt index e83d32a3203..b28af901fe0 100644 --- a/compiler/testData/diagnostics/tests/inference/coercionToUnit/coersionWithAnonymousFunctionsAndUnresolved.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/coercionToUnit/coersionWithAnonymousFunctionsAndUnresolved.fir.kt @@ -53,8 +53,8 @@ fun testParameter() { takeFnToParameter { Unit } takeFnToParameter { unresolved() } takeFnToParameter { if (true) unresolved() } - takeFnToParameter { - if (true) unresolved() else unresolved() + takeFnToParameter { + if (true) unresolved() else unresolved() } takeFnToParameter(fun() = Unit) takeFnToParameter(fun() {}) diff --git a/compiler/testData/diagnostics/tests/inference/nothingType/notEnoughInformationAndNothing.fir.kt b/compiler/testData/diagnostics/tests/inference/nothingType/notEnoughInformationAndNothing.fir.kt index 9930a8c49d1..ea53eab9efa 100644 --- a/compiler/testData/diagnostics/tests/inference/nothingType/notEnoughInformationAndNothing.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/nothingType/notEnoughInformationAndNothing.fir.kt @@ -27,12 +27,12 @@ fun test2() { null ) select( - materialize(), - materialize() + materialize(), + materialize() ) select( - materialize(), - materialize(), + materialize(), + materialize(), null ) } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2200.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2200.fir.kt index d65dcef2264..06cd8cc0772 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2200.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2200.fir.kt @@ -5,7 +5,7 @@ package n import checkSubtype fun main() { - val a = array(array()) + val a = array(array()) val a0 : Array> = array(array()) val a1 = array(array()) checkSubtype>>(a1) diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt36342.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt36342.fir.kt index 53bc861e9cb..e591c92105f 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt36342.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt36342.fir.kt @@ -7,18 +7,18 @@ fun test() { id(unresolved)!! unresolved!!!! try { - id(unresolved) + id(unresolved) } catch (e: Exception) { - id(unresolved) + id(unresolved) } if (true) - id(unresolved) + id(unresolved) else - id(unresolved) + id(unresolved) when { true -> id(unresolved) } - id(unresolved) ?: id(unresolved) + id(unresolved) ?: id(unresolved) } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt36342_2.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt36342_2.fir.kt index 2d63f5c4196..f11b3fb205a 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt36342_2.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt36342_2.fir.kt @@ -3,11 +3,11 @@ fun id(arg: K): K = arg fun materialize(): M = TODO() fun test(b: Boolean) { - id(if (b) { - id(unresolved) + id(if (b) { + id(unresolved) } else { - id( + id( materialize() ) - }) + }) } diff --git a/compiler/testData/diagnostics/tests/inference/reportNotEnoughTypeInformationErrorsOnBlockExpressions.fir.kt b/compiler/testData/diagnostics/tests/inference/reportNotEnoughTypeInformationErrorsOnBlockExpressions.fir.kt index a573fded5ef..b86faf58f28 100644 --- a/compiler/testData/diagnostics/tests/inference/reportNotEnoughTypeInformationErrorsOnBlockExpressions.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/reportNotEnoughTypeInformationErrorsOnBlockExpressions.fir.kt @@ -14,7 +14,7 @@ fun poll17(flag: Boolean): Any? { } fun poll26(flag: Boolean): Any? { - val inv = when (flag) { true -> ::Foo7 false -> foo7() else -> ::Foo7 } + val inv = when (flag) { true -> ::Foo7 false -> foo7() else -> ::Foo7 } return inv } diff --git a/compiler/testData/diagnostics/tests/inference/specialCallsWithCallableReferences.fir.kt b/compiler/testData/diagnostics/tests/inference/specialCallsWithCallableReferences.fir.kt index 49f9132003b..11ae531a292 100644 --- a/compiler/testData/diagnostics/tests/inference/specialCallsWithCallableReferences.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/specialCallsWithCallableReferences.fir.kt @@ -94,7 +94,7 @@ fun poll25(flag: Boolean) { } fun poll26(flag: Boolean) { - val inv = when (flag) { true -> ::Foo7 false -> foo7() else -> ::Foo7 } + val inv = when (flag) { true -> ::Foo7 false -> foo7() else -> ::Foo7 } inv } @@ -304,7 +304,7 @@ fun poll85() { } fun poll86() { - val inv = ::Foo7 in setOf(::Foo7) + val inv = ::Foo7 in setOf(::Foo7) inv } diff --git a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInferenceWithNestedCalls.fir.kt b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInferenceWithNestedCalls.fir.kt index c21845f5748..1276072b31c 100644 --- a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInferenceWithNestedCalls.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInferenceWithNestedCalls.fir.kt @@ -16,4 +16,4 @@ typealias C2 = MapLike val test1 = C(1, C(2, null)) val test2 = C(1, C("", null)) val test23 = C2(if (true) 1 else null) -val test234 = C2(C2(if (true) 1 else null)) +val test234 = C2(C2(if (true) 1 else null))