From 0e84bf20532bbf218b53af5a62ec9c52211f4015 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Wed, 9 Nov 2022 12:43:43 +0200 Subject: [PATCH] [FIR] Don't report ARGUMENT_TYPE_MISMATCH on error types --- .../innerDeclarationsResolve/class.fir.txt | 2 +- .../diagnostics/instanceAccessBeforeSuperCall.kt | 2 +- .../kotlin/fir/resolve/calls/Arguments.kt | 15 +++++++++------ .../cli/jvm/instanceAccessBeforeSuperCall.out | 3 --- .../tests/cast/bare/NullableAsNotEnough.fir.kt | 9 --------- .../tests/cast/bare/NullableAsNotEnough.kt | 1 + .../tests/cast/bare/UnrelatedAs.fir.kt | 9 --------- .../diagnostics/tests/cast/bare/UnrelatedAs.kt | 1 + .../inference/genericMethods.fir.kt | 2 +- .../propertyDefferedType.fir.kt | 2 +- .../conflictingWithDifferentOrder.fir.kt | 2 +- .../extensionMemberInClassObject.fir.kt | 4 ++-- ...ionWithAnonymousFunctionsAndUnresolved.fir.kt | 4 ++-- .../completeInferenceIfManyFailed.fir.kt | 2 +- .../constraints/errorUpperBoundConstraint.fir.kt | 2 +- .../emptyIntersectionTypes/kt52393.fir.kt | 6 +++--- .../inference/hasErrorInConstrainingTypes.fir.kt | 4 ++-- ...unctionalExpectedTypeForLambdaArgument.fir.kt | 6 +++--- .../intersectionLocations.fir.kt | 4 ++-- .../inference/recursiveCalls/kt23531.fir.kt | 8 ++++---- .../inference/recursiveLocalFuns/selfCall.fir.kt | 2 +- .../tests/inference/regressions/kt2741.fir.kt | 2 +- .../tests/inference/regressions/kt2841.fir.kt | 4 ++-- .../tests/inference/regressions/kt2841_it.fir.kt | 4 ++-- .../inference/regressions/kt2841_it_this.fir.kt | 4 ++-- .../inference/regressions/kt2841_this.fir.kt | 4 ++-- .../tests/inference/regressions/kt36342.fir.kt | 14 +++++++------- .../tests/inference/regressions/kt36342_2.fir.kt | 2 +- .../FunctionPlaceholder.fir.kt | 2 +- .../NoAmbiguityForDifferentFunctionTypes.fir.kt | 4 ++-- .../inferTypeFromUnresolvedArgument.fir.kt | 4 ++-- .../inferenceFromGetters/objectExpression.fir.kt | 2 +- .../inferenceFromGetters/recursiveGetter.fir.kt | 4 ++-- .../diagnostics/tests/regressions/kt30245.fir.kt | 2 +- .../diagnostics/testsWithStdLib/kt9078.fir.kt | 4 ++-- .../testsWithStdLib/labelClashes.fir.kt | 16 ++++++++-------- .../p-1/neg/2.3.fir.kt | 8 ++++---- .../p-1/neg/2.4.fir.kt | 12 ++++++------ 38 files changed, 83 insertions(+), 99 deletions(-) delete mode 100644 compiler/testData/diagnostics/tests/cast/bare/NullableAsNotEnough.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/cast/bare/UnrelatedAs.fir.kt diff --git a/analysis/low-level-api-fir/testdata/innerDeclarationsResolve/class.fir.txt b/analysis/low-level-api-fir/testdata/innerDeclarationsResolve/class.fir.txt index 758555369e7..df37eea52fd 100644 --- a/analysis/low-level-api-fir/testdata/innerDeclarationsResolve/class.fir.txt +++ b/analysis/low-level-api-fir/testdata/innerDeclarationsResolve/class.fir.txt @@ -11,7 +11,7 @@ FILE: class.kt private [BODY_RESOLVE] get(): public final [BODY_RESOLVE] fun foo([BODY_RESOLVE] a: ): { - ^foo #(R|/a|, = [BODY_RESOLVE] with@fun .(): { + ^foo #(R|/a|, = [BODY_RESOLVE] with@fun .(): { ^ #(String(a), this@R|/B|.R|/B.y|) } ) diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/instanceAccessBeforeSuperCall.kt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/instanceAccessBeforeSuperCall.kt index 529f0673e09..938fb425acb 100644 --- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/instanceAccessBeforeSuperCall.kt +++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/instanceAccessBeforeSuperCall.kt @@ -9,7 +9,7 @@ class B(other: B = this) class C() { constructor(x: Int) : this({ val a = 10 - this + this }) {} } 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 74ee6d954ed..3ac0ae906d1 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 @@ -362,18 +362,19 @@ 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 { + fun tryGetConeTypeThatCompatibleWithKtType(type: ConeKotlinType): ConeKotlinType? { + if (type is ConeErrorType) return null if (type is ConeTypeVariableType) { val lookupTag = type.lookupTag - val constraints = (csBuilder as VariableFixationFinder.Context).notFixedTypeVariables[lookupTag]?.constraints + val constraints = csBuilder.currentStorage().notFixedTypeVariables[lookupTag]?.constraints val constraintTypes = constraints?.mapNotNull { it.type as? ConeKotlinType } - if (constraintTypes != null && constraintTypes.isNotEmpty()) { + if (!constraintTypes.isNullOrEmpty()) { return ConeTypeIntersector.intersectTypes(context.session.typeContext, constraintTypes) } @@ -389,9 +390,11 @@ private fun checkApplicabilityForArgumentType( return type } + val preparedExpectedType = tryGetConeTypeThatCompatibleWithKtType(actualExpectedType) ?: return null + val preparedActualType = tryGetConeTypeThatCompatibleWithKtType(argumentType) ?: return null return ArgumentTypeMismatch( - tryGetConeTypeThatCompatibleWithKtType(actualExpectedType), - tryGetConeTypeThatCompatibleWithKtType(argumentType), + preparedExpectedType, + preparedActualType, argument, // Reaching here means argument types mismatch, and we want to record whether it's due to the nullability by checking a subtype // relation with nullable expected type. diff --git a/compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.out b/compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.out index c5a74d7b293..9750e0ee284 100644 --- a/compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.out +++ b/compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.out @@ -16,9 +16,6 @@ class B(other: B = this) compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.kt:10:32: error: argument type mismatch: actual type is kotlin/Function0'' before the instance has been initialized> but kotlin/Int was expected constructor(x: Int) : this({ ^ -compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.kt:12:9: error: argument type mismatch: actual type is ERROR CLASS: Cannot access '''' before the instance has been initialized but ERROR CLASS: Unknown return lambda parameter type was expected - this - ^ compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.kt:12:9: error: cannot access '' before the instance has been initialized this ^ diff --git a/compiler/testData/diagnostics/tests/cast/bare/NullableAsNotEnough.fir.kt b/compiler/testData/diagnostics/tests/cast/bare/NullableAsNotEnough.fir.kt deleted file mode 100644 index d60e629c112..00000000000 --- a/compiler/testData/diagnostics/tests/cast/bare/NullableAsNotEnough.fir.kt +++ /dev/null @@ -1,9 +0,0 @@ -// !CHECK_TYPE - -interface Tr -interface G - -fun test(tr: Tr?) { - val v = tr as G - checkSubtype>(v) -} diff --git a/compiler/testData/diagnostics/tests/cast/bare/NullableAsNotEnough.kt b/compiler/testData/diagnostics/tests/cast/bare/NullableAsNotEnough.kt index a2bd99fae2f..84b9bc93555 100644 --- a/compiler/testData/diagnostics/tests/cast/bare/NullableAsNotEnough.kt +++ b/compiler/testData/diagnostics/tests/cast/bare/NullableAsNotEnough.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CHECK_TYPE interface Tr diff --git a/compiler/testData/diagnostics/tests/cast/bare/UnrelatedAs.fir.kt b/compiler/testData/diagnostics/tests/cast/bare/UnrelatedAs.fir.kt deleted file mode 100644 index 10897001912..00000000000 --- a/compiler/testData/diagnostics/tests/cast/bare/UnrelatedAs.fir.kt +++ /dev/null @@ -1,9 +0,0 @@ -// !CHECK_TYPE - -interface Tr -interface G - -fun test(tr: Tr) { - val v = tr as G - checkSubtype>(v) -} diff --git a/compiler/testData/diagnostics/tests/cast/bare/UnrelatedAs.kt b/compiler/testData/diagnostics/tests/cast/bare/UnrelatedAs.kt index 4fee2d2b298..922f6bc988f 100644 --- a/compiler/testData/diagnostics/tests/cast/bare/UnrelatedAs.kt +++ b/compiler/testData/diagnostics/tests/cast/bare/UnrelatedAs.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CHECK_TYPE interface Tr diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethods.fir.kt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethods.fir.kt index b2c23e6e69f..a76f63ac11f 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 4e31f63ea74..c91c433a199 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/extensions/contextReceivers/conflictingWithDifferentOrder.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/conflictingWithDifferentOrder.fir.kt index 510b8dab927..15f3bd79b60 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/conflictingWithDifferentOrder.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/conflictingWithDifferentOrder.fir.kt @@ -12,7 +12,7 @@ fun f(): Unit = TODO() fun test(a: A, b: B) { with(a) { with(b) { - f() + f() } } } diff --git a/compiler/testData/diagnostics/tests/extensions/extensionMemberInClassObject.fir.kt b/compiler/testData/diagnostics/tests/extensions/extensionMemberInClassObject.fir.kt index 98c13e9b600..a3e0ed7428e 100644 --- a/compiler/testData/diagnostics/tests/extensions/extensionMemberInClassObject.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/extensionMemberInClassObject.fir.kt @@ -9,8 +9,8 @@ class Foo { } fun main() { - with("", { - Foo.findByName("") + with("", { + Foo.findByName("") }) with(Foo) { findByName("") diff --git a/compiler/testData/diagnostics/tests/inference/coercionToUnit/coersionWithAnonymousFunctionsAndUnresolved.fir.kt b/compiler/testData/diagnostics/tests/inference/coercionToUnit/coersionWithAnonymousFunctionsAndUnresolved.fir.kt index 23c919efea0..4a9c459f612 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() @@ -65,7 +65,7 @@ fun testParameter() { takeFnToParameter(fun(): Unit { return Unit }) takeFnToParameter(fun() { if (true) return }) takeFnToParameter(fun() { if (true) return Unit }) - takeFnToParameter(fun() = unresolved()) + takeFnToParameter(fun() = unresolved()) takeFnToParameter(fun() { unresolved() }) takeFnToParameter(fun(): Unit { unresolved() }) takeFnToParameter(fun() { return unresolved() }) diff --git a/compiler/testData/diagnostics/tests/inference/completeInferenceIfManyFailed.fir.kt b/compiler/testData/diagnostics/tests/inference/completeInferenceIfManyFailed.fir.kt index 9c629901919..4af5d4b1d12 100644 --- a/compiler/testData/diagnostics/tests/inference/completeInferenceIfManyFailed.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/completeInferenceIfManyFailed.fir.kt @@ -14,5 +14,5 @@ fun joinT(x: Comparable<*>, y: T): T? { fun test() { val x2 = joinT(Unit, "2") - checkSubtype(x2) + checkSubtype(x2) } diff --git a/compiler/testData/diagnostics/tests/inference/constraints/errorUpperBoundConstraint.fir.kt b/compiler/testData/diagnostics/tests/inference/constraints/errorUpperBoundConstraint.fir.kt index 611279cf803..e0d4c6f5d1a 100644 --- a/compiler/testData/diagnostics/tests/inference/constraints/errorUpperBoundConstraint.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/constraints/errorUpperBoundConstraint.fir.kt @@ -20,6 +20,6 @@ public class Foo { fun test(e: ErrorType) { Foo.foo { - Sam.Result.create(e) + Sam.Result.create(e) } } diff --git a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt52393.fir.kt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt52393.fir.kt index a13efaa4aed..d050bf3dd5d 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()) { - wrapper greaterEq number + with (WrapperFunctions()) { + wrapper greaterEq number } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/inference/hasErrorInConstrainingTypes.fir.kt b/compiler/testData/diagnostics/tests/inference/hasErrorInConstrainingTypes.fir.kt index 1186903faf0..54978edd32c 100644 --- a/compiler/testData/diagnostics/tests/inference/hasErrorInConstrainingTypes.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/hasErrorInConstrainingTypes.fir.kt @@ -4,5 +4,5 @@ fun foo(t: T, t1: T) {} fun test() { //no type inference error - foo(aaab, bbb) -} \ No newline at end of file + foo(aaab, bbb) +} diff --git a/compiler/testData/diagnostics/tests/inference/nonFunctionalExpectedTypeForLambdaArgument.fir.kt b/compiler/testData/diagnostics/tests/inference/nonFunctionalExpectedTypeForLambdaArgument.fir.kt index 759395e7b1e..92fd990d740 100644 --- a/compiler/testData/diagnostics/tests/inference/nonFunctionalExpectedTypeForLambdaArgument.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/nonFunctionalExpectedTypeForLambdaArgument.fir.kt @@ -15,7 +15,7 @@ fun testAny() { fun testAnyCall() { callAny { - error -> error() + error -> error() } } @@ -26,8 +26,8 @@ fun testParam() { } fun testParamCall() { - callParam { - param -> param() + 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 076b3032060..e78d7d6fcfc 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 + unresolved ) diff --git a/compiler/testData/diagnostics/tests/inference/recursiveCalls/kt23531.fir.kt b/compiler/testData/diagnostics/tests/inference/recursiveCalls/kt23531.fir.kt index b3bb186223b..a8edbf93795 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 31e9ab5759b..e34d8a69e51 100644 --- a/compiler/testData/diagnostics/tests/inference/recursiveLocalFuns/selfCall.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/recursiveLocalFuns/selfCall.fir.kt @@ -3,7 +3,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 c1b96c11e6b..8d3108ac992 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 index fdc075d5f4d..d2592a45178 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2841.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2841.fir.kt @@ -9,8 +9,8 @@ public inline fun T.use1(block: (T)-> R) : R { } fun main() { - C().use1 { + C().use1 { w -> // ERROR here - x + x } } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2841_it.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2841_it.fir.kt index 11e02319aa8..d666e87a910 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2841_it.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2841_it.fir.kt @@ -12,8 +12,8 @@ public inline fun T.use(block: (t: T)-> R) : R { } fun test() { - C().use { + C().use { it.close() - x + x } } 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 index 71b58d2df18..17a9ab38e86 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2841_it_this.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2841_it_this.fir.kt @@ -12,9 +12,9 @@ public inline fun use(t: T, block: T.(T)-> R) : R { } fun test() { - use(C()) { + use(C()) { this.close() it.close() - xx + xx } } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2841_this.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2841_this.fir.kt index d316ef728b8..24297bc3fe0 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2841_this.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2841_this.fir.kt @@ -12,8 +12,8 @@ public inline fun T.use(block: T.()-> R) : R { } fun test() { - C().use { + C().use { this.close() - x + x } } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt36342.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt36342.fir.kt index 4dda2caa7d2..40603374034 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt36342.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt36342.fir.kt @@ -4,21 +4,21 @@ import java.lang.Exception fun id(arg: K): K = arg fun test() { - id(unresolved)!! + 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) + 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 508c3a8bd1b..acc169754a2 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt36342_2.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt36342_2.fir.kt @@ -4,7 +4,7 @@ fun materialize(): M = TODO() fun test(b: Boolean) { id(if (b) { - id(unresolved) + id(unresolved) } else { id( materialize() diff --git a/compiler/testData/diagnostics/tests/inference/reportingImprovements/FunctionPlaceholder.fir.kt b/compiler/testData/diagnostics/tests/inference/reportingImprovements/FunctionPlaceholder.fir.kt index 2fa0b22eb32..8ca23055289 100644 --- a/compiler/testData/diagnostics/tests/inference/reportingImprovements/FunctionPlaceholder.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/reportingImprovements/FunctionPlaceholder.fir.kt @@ -6,7 +6,7 @@ fun foo(a: A) = a fun bar(f: (T) -> R) = f fun test() { - foo { it } + foo { it } foo { x -> x} foo { x: Int -> x} diff --git a/compiler/testData/diagnostics/tests/inference/reportingImprovements/NoAmbiguityForDifferentFunctionTypes.fir.kt b/compiler/testData/diagnostics/tests/inference/reportingImprovements/NoAmbiguityForDifferentFunctionTypes.fir.kt index 22d96ff0c70..e6f48449227 100644 --- a/compiler/testData/diagnostics/tests/inference/reportingImprovements/NoAmbiguityForDifferentFunctionTypes.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/reportingImprovements/NoAmbiguityForDifferentFunctionTypes.fir.kt @@ -9,8 +9,8 @@ fun T.foo(block: (T)-> R) = block fun T.foo(block: (T, T)-> R) = block fun main() { - C().foo { // no ambiguity here + C().foo { // no ambiguity here www -> - xs + xs } } diff --git a/compiler/testData/diagnostics/tests/inference/reportingImprovements/inferTypeFromUnresolvedArgument.fir.kt b/compiler/testData/diagnostics/tests/inference/reportingImprovements/inferTypeFromUnresolvedArgument.fir.kt index a835794c0b3..d40a568d783 100644 --- a/compiler/testData/diagnostics/tests/inference/reportingImprovements/inferTypeFromUnresolvedArgument.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/reportingImprovements/inferTypeFromUnresolvedArgument.fir.kt @@ -4,8 +4,8 @@ fun id2(x: K, s: String): K = x fun ret(s: String): K = TODO() fun test() { - id2(unresolved, "foo") - id2(unresolved, 42) + id2(unresolved, "foo") + id2(unresolved, 42) ret("foo") ret(42) diff --git a/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/objectExpression.fir.kt b/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/objectExpression.fir.kt index c15cf4e8951..8abbf6a3ca5 100644 --- a/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/objectExpression.fir.kt +++ b/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/objectExpression.fir.kt @@ -6,7 +6,7 @@ object Outer { get() = 0 override fun get(index: Int): Char { - checkSubtype(x) + checkSubtype(x) return ' ' } diff --git a/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/recursiveGetter.fir.kt b/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/recursiveGetter.fir.kt index e46dcbebb55..6a598b0ef17 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/tests/regressions/kt30245.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt30245.fir.kt index 87309d23cb3..27942150941 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt30245.fir.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt30245.fir.kt @@ -83,7 +83,7 @@ fun test2() { // to extension lambda 1 val i27a: E1 = when (e) { E.VALUE -> { s -> this + s.length } } // oi+ ni+ val w28 = W2 { i: Int, s -> i + s.length } // oi- ni- - val i28: E1 = id { i: Int, s -> i + s.length } // oi- ni- + val i28: E1 = id { i: Int, s -> i + s.length } // oi- ni- val w29 = W2 { i: Int, s: String -> i + s.length } // oi- ni- val i29: E1 = id { i: Int, s: String -> i + s.length } // oi+ ni+ diff --git a/compiler/testData/diagnostics/testsWithStdLib/kt9078.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/kt9078.fir.kt index dd0bf410807..27ba075a9ad 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/kt9078.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/kt9078.fir.kt @@ -3,10 +3,10 @@ abstract class KFunctionKt9005WorkAround(private val _functionInsta private val _reflectedFunction: kotlin.reflect.KFunction = _functionInstance.reflect() ?: throw IllegalStateException("") private val _parameters: List = run { - _functionInstance.javaClass.methods.first().parameters.map { + _functionInstance.javaClass.methods.first().parameters.map { object : kotlin.reflect.KParameter { override val index: Int = 0 } - } + } } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/labelClashes.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/labelClashes.fir.kt index eb27632a72e..1e81b2c8ec2 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/labelClashes.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/labelClashes.fir.kt @@ -1,14 +1,14 @@ // !RENDER_DIAGNOSTICS_FULL_TEXT fun Int.with() { - with("") { - this@with.inc() + with("") { + this@with.inc() } } fun Int.bar() { - with("") bar@{ - this@bar.inc() + with("") bar@{ + this@bar.inc() } } @@ -16,12 +16,12 @@ fun foo(f: with.() -> Unit) {} class with { fun foo() { - with("") { - this@with.foo() + with("") { + this@with.foo() } - with("") with@{ - this@with.foo() + with("") with@{ + this@with.foo() } with("") other@{ diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.3.fir.kt index e9d21205e03..190e7ef89ce 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.3.fir.kt @@ -101,10 +101,10 @@ fun case_5() { // TESTCASE NUMBER: 6 fun case_6() { - checkSubtype(-100000000000000000000000000000000) - checkSubtype(-100000000000000000000000000000000) - checkSubtype(-100000000000000000000000000000000) - checkSubtype(-100000000000000000000000000000000) + checkSubtype(-100000000000000000000000000000000) + checkSubtype(-100000000000000000000000000000000) + checkSubtype(-100000000000000000000000000000000) + checkSubtype(-100000000000000000000000000000000) -100000000000000000000000000000000 checkType { check() } -100000000000000000000000000000000 checkType { check() } -100000000000000000000000000000000 checkType { check() } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.4.fir.kt index db1a340dd04..6360a28099a 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.4.fir.kt @@ -2,24 +2,24 @@ // TESTCASE NUMBER: 1 fun case_1() { - checkSubtype(-9223372036854775808L) + checkSubtype(-9223372036854775808L) -9223372036854775808L checkType { check() } - checkSubtype(9223372036854775808L) + checkSubtype(9223372036854775808L) 9223372036854775808L checkType { check() } } // TESTCASE NUMBER: 2 fun case_2() { - checkSubtype(100000000000000000000000000000000L) + checkSubtype(100000000000000000000000000000000L) 100000000000000000000000000000000L checkType { check() } - checkSubtype(100000000000000000000000000000000l) + checkSubtype(100000000000000000000000000000000l) 100000000000000000000000000000000l checkType { check() } - checkSubtype(-100000000000000000000000000000000L) + checkSubtype(-100000000000000000000000000000000L) -100000000000000000000000000000000L checkType { check() } - checkSubtype(-100000000000000000000000000000000l) + checkSubtype(-100000000000000000000000000000000l) -100000000000000000000000000000000l checkType { check() } }