From fe5adab652a184f5e9ec0f4ff03354db5dcb9a35 Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Wed, 30 Nov 2022 14:20:11 +0100 Subject: [PATCH] K2: Avoid inference diagnostics when arguments are already error typed For example, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER It became especially relevant after 0e84bf20532bbf218b53af5a62ec9c52211f4015 that together with later commits bring a lot of unnecessary NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER diagnostic --- ...nWithImplicitType.out_of_src_roots.fir.txt | 2 +- .../coneDiagnosticToFirDiagnostic.kt | 4 ++++ .../kotlin/fir/resolve/calls/Arguments.kt | 13 ++++++------ .../fir/resolve/calls/ResolutionDiagnostic.kt | 2 ++ .../inference/genericMethods.fir.kt | 2 +- .../propertyDefferedType.fir.kt | 2 +- .../entriesPropertyInCompanionClash.fir.kt | 2 +- .../entriesPropertyInCompanionClashOn.fir.kt | 2 +- .../extensionMemberInClassObject.fir.kt | 18 ----------------- .../extensionMemberInClassObject.kt | 1 + ...WithAnonymousFunctionsAndUnresolved.fir.kt | 2 +- .../emptyIntersectionTypes/kt52393.fir.kt | 2 +- .../hasErrorInConstrainingTypes.fir.kt | 8 -------- .../inference/hasErrorInConstrainingTypes.kt | 1 + ...tionalExpectedTypeForLambdaArgument.fir.kt | 2 +- .../intersectionLocations.fir.kt | 2 +- .../inference/recursiveCalls/kt23531.fir.kt | 8 ++++---- .../recursiveLocalFuns/selfCall.fir.kt | 2 +- .../tests/inference/regressions/kt2741.fir.kt | 2 +- .../tests/inference/regressions/kt2841.fir.kt | 16 --------------- .../tests/inference/regressions/kt2841.kt | 1 + .../inference/regressions/kt2841_it.fir.kt | 19 ------------------ .../tests/inference/regressions/kt2841_it.kt | 1 + .../regressions/kt2841_it_this.fir.kt | 20 ------------------- .../inference/regressions/kt2841_it_this.kt | 1 + .../inference/regressions/kt2841_this.fir.kt | 19 ------------------ .../inference/regressions/kt2841_this.kt | 1 + .../inference/regressions/kt36342.fir.kt | 2 +- ...oAmbiguityForDifferentFunctionTypes.fir.kt | 16 --------------- .../NoAmbiguityForDifferentFunctionTypes.kt | 1 + .../inferTypeFromUnresolvedArgument.fir.kt | 2 +- .../recursiveGetter.fir.kt | 4 ++-- .../testsWithStdLib/labelClashes.fir.kt | 8 ++++---- 33 files changed, 43 insertions(+), 145 deletions(-) delete mode 100644 compiler/testData/diagnostics/tests/extensions/extensionMemberInClassObject.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/inference/hasErrorInConstrainingTypes.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/inference/regressions/kt2841.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/inference/regressions/kt2841_it.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/inference/regressions/kt2841_it_this.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/inference/regressions/kt2841_this.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/inference/reportingImprovements/NoAmbiguityForDifferentFunctionTypes.fir.kt diff --git a/analysis/low-level-api-fir/testdata/innerDeclarationsResolve/functionWithImplicitType.out_of_src_roots.fir.txt b/analysis/low-level-api-fir/testdata/innerDeclarationsResolve/functionWithImplicitType.out_of_src_roots.fir.txt index 096620bacb6..68e6841cd57 100644 --- a/analysis/low-level-api-fir/testdata/innerDeclarationsResolve/functionWithImplicitType.out_of_src_roots.fir.txt +++ b/analysis/low-level-api-fir/testdata/innerDeclarationsResolve/functionWithImplicitType.out_of_src_roots.fir.txt @@ -2,5 +2,5 @@ FILE: functionWithImplicitType.kt public final [BODY_RESOLVE] fun <[BODY_RESOLVE] T> checkSubtype([BODY_RESOLVE] t: R|T|): R|T| { ^checkSubtype R|/t| } - public final [BODY_RESOLVE] val ab: R|kotlin/collections/List?| = R|/checkSubtype|?|>(#.#()) + public final [BODY_RESOLVE] val ab: R|kotlin/collections/List?| = R|/checkSubtype#|?|>(#.#()) public [BODY_RESOLVE] get(): R|kotlin/collections/List?| 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 21b5decc275..4d25bc7ea1a 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 @@ -225,6 +225,10 @@ private fun mapInapplicableCandidateError( ) } + // We don't report anything here, because there are already some errors inside the call or declaration + // And the errors should be reported there + is ErrorTypeInArguments -> null + is MultipleContextReceiversApplicableForExtensionReceivers -> FirErrors.AMBIGUOUS_CALL_WITH_IMPLICIT_CONTEXT_RECEIVER.createOn(qualifiedAccessSource ?: source) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt index ae19d048ea0..6f43b05c36f 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/Arguments.kt @@ -352,13 +352,12 @@ private fun checkApplicabilityForArgumentType( // todo run this approximation only once for call val argumentType = captureFromTypeParameterUpperBoundIfNeeded(argumentTypeBeforeCapturing, expectedType, context.session) - fun subtypeError(actualExpectedType: ConeKotlinType): ResolutionDiagnostic? { + fun subtypeError(actualExpectedType: ConeKotlinType): ResolutionDiagnostic { if (argument.isNullLiteral && actualExpectedType.nullability == ConeNullability.NOT_NULL) { return NullForNotNullType(argument) } - fun tryGetConeTypeThatCompatibleWithKtType(type: ConeKotlinType): ConeKotlinType? { - if (type is ConeErrorType) return null + fun tryGetConeTypeThatCompatibleWithKtType(type: ConeKotlinType): ConeKotlinType { if (type is ConeTypeVariableType) { val lookupTag = type.lookupTag @@ -380,8 +379,10 @@ private fun checkApplicabilityForArgumentType( return type } - val preparedExpectedType = tryGetConeTypeThatCompatibleWithKtType(actualExpectedType) ?: return null - val preparedActualType = tryGetConeTypeThatCompatibleWithKtType(argumentType) ?: return null + if (argumentType is ConeErrorType || actualExpectedType is ConeErrorType) return ErrorTypeInArguments + + val preparedExpectedType = tryGetConeTypeThatCompatibleWithKtType(actualExpectedType) + val preparedActualType = tryGetConeTypeThatCompatibleWithKtType(argumentType) return ArgumentTypeMismatch( preparedExpectedType, preparedActualType, @@ -419,7 +420,7 @@ private fun checkApplicabilityForArgumentType( } if (!isReceiver) { - sink.reportDiagnosticIfNotNull(subtypeError(expectedType)) + sink.reportDiagnostic(subtypeError(expectedType)) return } diff --git a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionDiagnostic.kt b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionDiagnostic.kt index 63808ab6cf4..1dc2b010a38 100644 --- a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionDiagnostic.kt +++ b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionDiagnostic.kt @@ -78,6 +78,8 @@ class NameForAmbiguousParameter( object InapplicableCandidate : ResolutionDiagnostic(INAPPLICABLE) +object ErrorTypeInArguments : ResolutionDiagnostic(INAPPLICABLE) + object HiddenCandidate : ResolutionDiagnostic(HIDDEN) object VisibilityError : ResolutionDiagnostic(K2_VISIBILITY_ERROR) diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethods.fir.kt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethods.fir.kt index 53629cace64..591ae43ea5b 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethods.fir.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethods.fir.kt @@ -3,7 +3,7 @@ import kotlin.reflect.KProperty var a: Int by A() -var a1 by A() +var a1 by A() var b: Int by B() diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDefferedType.fir.kt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDefferedType.fir.kt index c91c433a199..cd444a26355 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDefferedType.fir.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDefferedType.fir.kt @@ -4,7 +4,7 @@ import kotlin.reflect.KProperty class B { - val c by Delegate(ag) + val c by Delegate(ag) } class Delegate(val init: T) { diff --git a/compiler/testData/diagnostics/tests/enum/entries/entriesPropertyInCompanionClash.fir.kt b/compiler/testData/diagnostics/tests/enum/entries/entriesPropertyInCompanionClash.fir.kt index bd625d588c6..51666567a98 100644 --- a/compiler/testData/diagnostics/tests/enum/entries/entriesPropertyInCompanionClash.fir.kt +++ b/compiler/testData/diagnostics/tests/enum/entries/entriesPropertyInCompanionClash.fir.kt @@ -13,7 +13,7 @@ fun test() { A.entries A.Companion.entries - with(A) { + with(A) { entries this.entries values() // to be sure that we don't resolve into synthetic 'values' diff --git a/compiler/testData/diagnostics/tests/enum/entries/entriesPropertyInCompanionClashOn.fir.kt b/compiler/testData/diagnostics/tests/enum/entries/entriesPropertyInCompanionClashOn.fir.kt index 9317dd9c5f0..d09ab299398 100644 --- a/compiler/testData/diagnostics/tests/enum/entries/entriesPropertyInCompanionClashOn.fir.kt +++ b/compiler/testData/diagnostics/tests/enum/entries/entriesPropertyInCompanionClashOn.fir.kt @@ -13,7 +13,7 @@ fun test() { A.entries A.Companion.entries - with(A) { + with(A) { entries this.entries values() // to be sure that we don't resolve into synthetic 'values' diff --git a/compiler/testData/diagnostics/tests/extensions/extensionMemberInClassObject.fir.kt b/compiler/testData/diagnostics/tests/extensions/extensionMemberInClassObject.fir.kt deleted file mode 100644 index a3e0ed7428e..00000000000 --- a/compiler/testData/diagnostics/tests/extensions/extensionMemberInClassObject.fir.kt +++ /dev/null @@ -1,18 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER - -interface JPAEntityClass { - fun T.findByName(s: String): D {null!!} -} - -class Foo { - companion object : JPAEntityClass -} - -fun main() { - with("", { - Foo.findByName("") - }) - with(Foo) { - findByName("") - } -} diff --git a/compiler/testData/diagnostics/tests/extensions/extensionMemberInClassObject.kt b/compiler/testData/diagnostics/tests/extensions/extensionMemberInClassObject.kt index 5b5862e9dae..2038d0daa27 100644 --- a/compiler/testData/diagnostics/tests/extensions/extensionMemberInClassObject.kt +++ b/compiler/testData/diagnostics/tests/extensions/extensionMemberInClassObject.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER interface JPAEntityClass { diff --git a/compiler/testData/diagnostics/tests/inference/coercionToUnit/coersionWithAnonymousFunctionsAndUnresolved.fir.kt b/compiler/testData/diagnostics/tests/inference/coercionToUnit/coersionWithAnonymousFunctionsAndUnresolved.fir.kt index 11c6c56583e..e83d32a3203 100644 --- a/compiler/testData/diagnostics/tests/inference/coercionToUnit/coersionWithAnonymousFunctionsAndUnresolved.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/coercionToUnit/coersionWithAnonymousFunctionsAndUnresolved.fir.kt @@ -51,7 +51,7 @@ fun testUnit() { fun testParameter() { takeFnToParameter { } takeFnToParameter { Unit } - takeFnToParameter { unresolved() } + takeFnToParameter { unresolved() } takeFnToParameter { if (true) unresolved() } takeFnToParameter { if (true) unresolved() else unresolved() diff --git a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt52393.fir.kt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt52393.fir.kt index d050bf3dd5d..8b33fdc569f 100644 --- a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt52393.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt52393.fir.kt @@ -11,7 +11,7 @@ fun main() { val number: Int = 5 // doesn't work // val number: Long = 5 // works - with (WrapperFunctions()) { + with (WrapperFunctions()) { wrapper greaterEq number } } diff --git a/compiler/testData/diagnostics/tests/inference/hasErrorInConstrainingTypes.fir.kt b/compiler/testData/diagnostics/tests/inference/hasErrorInConstrainingTypes.fir.kt deleted file mode 100644 index 54978edd32c..00000000000 --- a/compiler/testData/diagnostics/tests/inference/hasErrorInConstrainingTypes.fir.kt +++ /dev/null @@ -1,8 +0,0 @@ -package n - -fun foo(t: T, t1: T) {} - -fun test() { - //no type inference error - foo(aaab, bbb) -} diff --git a/compiler/testData/diagnostics/tests/inference/hasErrorInConstrainingTypes.kt b/compiler/testData/diagnostics/tests/inference/hasErrorInConstrainingTypes.kt index 6ad150321f2..0989a6a5821 100644 --- a/compiler/testData/diagnostics/tests/inference/hasErrorInConstrainingTypes.kt +++ b/compiler/testData/diagnostics/tests/inference/hasErrorInConstrainingTypes.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL package n fun foo(t: T, t1: T) {} diff --git a/compiler/testData/diagnostics/tests/inference/nonFunctionalExpectedTypeForLambdaArgument.fir.kt b/compiler/testData/diagnostics/tests/inference/nonFunctionalExpectedTypeForLambdaArgument.fir.kt index 92fd990d740..63780bd4239 100644 --- a/compiler/testData/diagnostics/tests/inference/nonFunctionalExpectedTypeForLambdaArgument.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/nonFunctionalExpectedTypeForLambdaArgument.fir.kt @@ -26,7 +26,7 @@ fun testParam() { } fun testParamCall() { - callParam { + callParam { param -> param() } } diff --git a/compiler/testData/diagnostics/tests/inference/publicApproximation/intersectionLocations.fir.kt b/compiler/testData/diagnostics/tests/inference/publicApproximation/intersectionLocations.fir.kt index e78d7d6fcfc..1e3dbbf9a9f 100644 --- a/compiler/testData/diagnostics/tests/inference/publicApproximation/intersectionLocations.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/publicApproximation/intersectionLocations.fir.kt @@ -37,7 +37,7 @@ fun testStarProjection() = BiParam( intersect(First, Second), makeStarProjection() ) -fun testErrorType() = BiParam( +fun testErrorType() = BiParam( intersect(First, Second), unresolved ) diff --git a/compiler/testData/diagnostics/tests/inference/recursiveCalls/kt23531.fir.kt b/compiler/testData/diagnostics/tests/inference/recursiveCalls/kt23531.fir.kt index a8edbf93795..68c66797f5d 100644 --- a/compiler/testData/diagnostics/tests/inference/recursiveCalls/kt23531.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/recursiveCalls/kt23531.fir.kt @@ -12,7 +12,7 @@ fun insideJob1() = doTheJob1() suspend fun insideJob2() = doTheJob2() suspend fun insideJob3() = doTheJob3() -fun doTheJob0() = simpleAsync0 { insideJob0() } -fun doTheJob1() = simpleAsync1 { insideJob1() } -suspend fun doTheJob2() = simpleAsync2 { insideJob2() } -suspend fun doTheJob3() = simpleAsync3 { insideJob3() } +fun doTheJob0() = simpleAsync0 { insideJob0() } +fun doTheJob1() = simpleAsync1 { insideJob1() } +suspend fun doTheJob2() = simpleAsync2 { insideJob2() } +suspend fun doTheJob3() = simpleAsync3 { insideJob3() } diff --git a/compiler/testData/diagnostics/tests/inference/recursiveLocalFuns/selfCall.fir.kt b/compiler/testData/diagnostics/tests/inference/recursiveLocalFuns/selfCall.fir.kt index 0e7c9cdcffb..903e4dcceca 100644 --- a/compiler/testData/diagnostics/tests/inference/recursiveLocalFuns/selfCall.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/recursiveLocalFuns/selfCall.fir.kt @@ -2,7 +2,7 @@ fun foo() { fun bar1() = bar1() fun bar2() = 1 + bar2() - fun bar3() = id(bar3()) + fun bar3() = id(bar3()) } fun id(x: T) = x diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2741.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2741.fir.kt index 8d3108ac992..97b1f4020cf 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2741.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2741.fir.kt @@ -8,5 +8,5 @@ fun _arrayList(vararg values: T) : List = throw Exception() class _Pair(val a: A) fun test() { - _arrayList(_Pair(1))._sortBy { it -> xxx } + _arrayList(_Pair(1))._sortBy { it -> xxx } } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2841.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2841.fir.kt deleted file mode 100644 index d2592a45178..00000000000 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2841.fir.kt +++ /dev/null @@ -1,16 +0,0 @@ - -package a - -interface Closeable {} -class C : Closeable {} - -public inline fun T.use1(block: (T)-> R) : R { - return block(this) -} - -fun main() { - C().use1 { - w -> // ERROR here - x - } -} diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2841.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2841.kt index 696c4baf97a..93caa3348aa 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2841.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2841.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL package a diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2841_it.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2841_it.fir.kt deleted file mode 100644 index d666e87a910..00000000000 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2841_it.fir.kt +++ /dev/null @@ -1,19 +0,0 @@ - -package a - -interface Closeable { - fun close() {} -} - -class C : Closeable - -public inline fun T.use(block: (t: T)-> R) : R { - return block(this) -} - -fun test() { - C().use { - it.close() - x - } -} diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2841_it.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2841_it.kt index 5bf8d23f720..e9a727f9896 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2841_it.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2841_it.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL package a diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2841_it_this.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2841_it_this.fir.kt deleted file mode 100644 index 17a9ab38e86..00000000000 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2841_it_this.fir.kt +++ /dev/null @@ -1,20 +0,0 @@ - -package a - -interface Closeable { - fun close() {} -} - -class C : Closeable - -public inline fun use(t: T, block: T.(T)-> R) : R { - return t.block(t) -} - -fun test() { - use(C()) { - this.close() - it.close() - xx - } -} diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2841_it_this.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2841_it_this.kt index d9456233fc7..72a24418130 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2841_it_this.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2841_it_this.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL package a diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2841_this.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2841_this.fir.kt deleted file mode 100644 index 24297bc3fe0..00000000000 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2841_this.fir.kt +++ /dev/null @@ -1,19 +0,0 @@ - -package a - -interface Closeable { - fun close() {} -} - -class C : Closeable - -public inline fun T.use(block: T.()-> R) : R { - return this.block() -} - -fun test() { - C().use { - this.close() - x - } -} diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2841_this.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2841_this.kt index 872d1bd28e0..16659e404bf 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2841_this.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2841_this.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL package a diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt36342.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt36342.fir.kt index 40603374034..9d7cf27c4e6 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt36342.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt36342.fir.kt @@ -18,7 +18,7 @@ fun test() { id(unresolved) when { - true -> id(unresolved) + true -> id(unresolved) } id(unresolved) ?: id(unresolved) } diff --git a/compiler/testData/diagnostics/tests/inference/reportingImprovements/NoAmbiguityForDifferentFunctionTypes.fir.kt b/compiler/testData/diagnostics/tests/inference/reportingImprovements/NoAmbiguityForDifferentFunctionTypes.fir.kt deleted file mode 100644 index e6f48449227..00000000000 --- a/compiler/testData/diagnostics/tests/inference/reportingImprovements/NoAmbiguityForDifferentFunctionTypes.fir.kt +++ /dev/null @@ -1,16 +0,0 @@ - -package a - -interface Closeable {} -class C : Closeable {} - -fun T.foo(block: (T)-> R) = block - -fun T.foo(block: (T, T)-> R) = block - -fun main() { - C().foo { // no ambiguity here - www -> - xs - } -} diff --git a/compiler/testData/diagnostics/tests/inference/reportingImprovements/NoAmbiguityForDifferentFunctionTypes.kt b/compiler/testData/diagnostics/tests/inference/reportingImprovements/NoAmbiguityForDifferentFunctionTypes.kt index e5898ffe2ab..d39627236a9 100644 --- a/compiler/testData/diagnostics/tests/inference/reportingImprovements/NoAmbiguityForDifferentFunctionTypes.kt +++ b/compiler/testData/diagnostics/tests/inference/reportingImprovements/NoAmbiguityForDifferentFunctionTypes.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL package a diff --git a/compiler/testData/diagnostics/tests/inference/reportingImprovements/inferTypeFromUnresolvedArgument.fir.kt b/compiler/testData/diagnostics/tests/inference/reportingImprovements/inferTypeFromUnresolvedArgument.fir.kt index d40a568d783..6ac0bd03b9b 100644 --- a/compiler/testData/diagnostics/tests/inference/reportingImprovements/inferTypeFromUnresolvedArgument.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/reportingImprovements/inferTypeFromUnresolvedArgument.fir.kt @@ -4,7 +4,7 @@ fun id2(x: K, s: String): K = x fun ret(s: String): K = TODO() fun test() { - id2(unresolved, "foo") + id2(unresolved, "foo") id2(unresolved, 42) ret("foo") diff --git a/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/recursiveGetter.fir.kt b/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/recursiveGetter.fir.kt index 6a598b0ef17..fb06ef4c5fe 100644 --- a/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/recursiveGetter.fir.kt +++ b/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/recursiveGetter.fir.kt @@ -9,8 +9,8 @@ class A { val a get() = b val b get() = a - val z1 get() = id(z1) - val z2 get() = l(z2) + val z1 get() = id(z1) + val z2 get() = l(z2) val u get() = field } diff --git a/compiler/testData/diagnostics/testsWithStdLib/labelClashes.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/labelClashes.fir.kt index 1e81b2c8ec2..cf663176767 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/labelClashes.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/labelClashes.fir.kt @@ -1,13 +1,13 @@ // !RENDER_DIAGNOSTICS_FULL_TEXT fun Int.with() { - with("") { + with("") { this@with.inc() } } fun Int.bar() { - with("") bar@{ + with("") bar@{ this@bar.inc() } } @@ -16,11 +16,11 @@ fun foo(f: with.() -> Unit) {} class with { fun foo() { - with("") { + with("") { this@with.foo() } - with("") with@{ + with("") with@{ this@with.foo() }