From dac9d7b17a5b74e8d50624f3d9dee5386d72727f Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Mon, 24 May 2021 13:01:57 +0300 Subject: [PATCH] FIR: Mark a pack of tests (53) as FIR_IDENTICAL --- ...ctionTypeOverloadWithWrongParameter.fir.kt | 18 ----- ...ersectionTypeOverloadWithWrongParameter.kt | 1 + .../arrayAccessSetTooManyArgs.fir.kt | 10 --- .../arrayAccessSetTooManyArgs.kt | 1 + .../tests/controlFlowAnalysis/kt10805.fir.kt | 12 ---- .../tests/controlFlowAnalysis/kt10805.kt | 1 + .../ifInResultOfLambda.fir.kt | 9 --- .../controlStructures/ifInResultOfLambda.kt | 1 + .../lambdasInExclExclAndElvis.fir.kt | 15 ----- .../lambdasInExclExclAndElvis.kt | 1 + .../whenInResultOfLambda.fir.kt | 18 ----- .../controlStructures/whenInResultOfLambda.kt | 1 + .../inference/extensionProperty.fir.kt | 21 ------ .../inference/extensionProperty.kt | 1 + .../inference/manyIncompleteCandidates.fir.kt | 25 ------- .../inference/manyIncompleteCandidates.kt | 1 + .../inferenceFromReceiver1.fir.kt | 14 ---- .../provideDelegate/inferenceFromReceiver1.kt | 1 + .../LabeledFunctionLiterals.fir.kt | 15 ----- .../LabeledFunctionLiterals.kt | 1 + .../return/NoCommonSystem.fir.kt | 18 ----- .../functionLiterals/return/NoCommonSystem.kt | 1 + .../returnNullWithReturn.fir.kt | 10 --- .../functionLiterals/returnNullWithReturn.kt | 1 + .../generics/nullability/useAsReceiver.fir.kt | 26 ------- .../generics/nullability/useAsReceiver.kt | 1 + .../tests/implicitNestedIntersection.fir.kt | 23 ------- .../tests/implicitNestedIntersection.kt | 1 + .../cannotCompleteResolveAmbiguity.fir.kt | 8 --- .../cannotCompleteResolveAmbiguity.kt | 1 + ...ompleteResolveFunctionLiteralsNoUse.fir.kt | 6 -- ...notCompleteResolveFunctionLiteralsNoUse.kt | 1 + ...otCompleteResolveNoInfoForParameter.fir.kt | 10 --- ...cannotCompleteResolveNoInfoForParameter.kt | 1 + ...CompleteResolveWithFunctionLiterals.fir.kt | 10 --- ...nnotCompleteResolveWithFunctionLiterals.kt | 1 + .../inference/commonSystem/kt32818.fir.kt | 7 -- .../tests/inference/commonSystem/kt32818.kt | 1 + .../inference/conflictingSubstitutions.fir.kt | 19 ------ .../inference/conflictingSubstitutions.kt | 1 + ...RecursiveFlexibleTypesWithWildcards.fir.kt | 31 --------- ...ueToRecursiveFlexibleTypesWithWildcards.kt | 1 + .../fixationOrderForProperConstraints.fir.kt | 6 -- .../fixationOrderForProperConstraints.kt | 1 + ...vokeExtensionWithFunctionalArgument.fir.kt | 28 -------- ...itInvokeExtensionWithFunctionalArgument.kt | 1 + .../lambdaNothingAndExpectedType.fir.kt | 11 --- .../lambdaNothingAndExpectedType.kt | 1 + .../publicApproximation/chainedLambdas.fir.kt | 33 --------- .../publicApproximation/chainedLambdas.kt | 1 + ...CastInLambdaReturnAfterIntersection.fir.kt | 21 ------ ...martCastInLambdaReturnAfterIntersection.kt | 1 + .../twoIntersections.fir.kt | 24 ------- .../publicApproximation/twoIntersections.kt | 1 + .../tests/inference/regressions/kt2838.fir.kt | 18 ----- .../tests/inference/regressions/kt2838.kt | 1 + .../upperBounds/intersectUpperBounds.fir.kt | 34 ---------- .../upperBounds/intersectUpperBounds.kt | 1 + .../j+k/genericConstructor/recursive.fir.kt | 11 --- .../tests/j+k/genericConstructor/recursive.kt | 1 + .../tests/j+k/wrongVarianceInJava.fir.kt | 23 ------- .../tests/j+k/wrongVarianceInJava.kt | 1 + .../diagnostics/tests/overload/kt2493.fir.kt | 19 ------ .../diagnostics/tests/overload/kt2493.kt | 1 + .../platformTypes/rawTypes/samRaw.fir.kt | 27 -------- .../tests/platformTypes/rawTypes/samRaw.kt | 1 + .../tests/regressions/kt11979.fir.kt | 25 ------- .../diagnostics/tests/regressions/kt11979.kt | 1 + .../invoke/errors/ambiguityForInvoke.fir.kt | 10 --- .../invoke/errors/ambiguityForInvoke.kt | 1 + .../extensionValueAsNonExtension.fir.kt | 22 ------ .../invoke/extensionValueAsNonExtension.kt | 1 + .../diagnostics/tests/resolve/kt36264.fir.kt | 18 ----- .../diagnostics/tests/resolve/kt36264.kt | 1 + ...eInferenceForNestedInNoneApplicable.fir.kt | 10 --- ...eTypeInferenceForNestedInNoneApplicable.kt | 1 + .../nestedCalls/twoTypeParameters.fir.kt | 16 ----- .../resolve/nestedCalls/twoTypeParameters.kt | 1 + .../overloadConflicts/genericClash.fir.kt | 19 ------ .../resolve/overloadConflicts/genericClash.kt | 1 + .../resolve/overloadConflicts/kt10640.fir.kt | 9 --- .../resolve/overloadConflicts/kt10640.kt | 1 + .../resolve/overloadConflicts/kt31670.fir.kt | 15 ----- .../resolve/overloadConflicts/kt31670.kt | 1 + .../resolve/overloadConflicts/kt31758.fir.kt | 25 ------- .../resolve/overloadConflicts/kt31758.kt | 1 + ...ionOnNullableContravariantParameter.fir.kt | 23 ------- ...olutionOnNullableContravariantParameter.kt | 1 + .../multipleSuperClasses.fir.kt | 28 -------- .../multipleSuperClasses.kt | 1 + .../tests/smartCasts/elvis/impossible.fir.kt | 40 ----------- .../tests/smartCasts/elvis/impossible.kt | 1 + .../varnotnull/initialization.fir.kt | 7 -- .../smartCasts/varnotnull/initialization.kt | 1 + ...nForOverloadResolutionWithAmbiguity.fir.kt | 18 ----- ...utionForOverloadResolutionWithAmbiguity.kt | 1 + ...eArgumentsInferenceWithNestedCalls2.fir.kt | 40 ----------- ...rTypeArgumentsInferenceWithNestedCalls2.kt | 1 + ...eArgumentsInferenceWithPhantomTypes.fir.kt | 16 ----- ...rTypeArgumentsInferenceWithPhantomTypes.kt | 1 + .../diagnostics/tests/when/kt10809.fir.kt | 67 ------------------- .../diagnostics/tests/when/kt10809.kt | 1 + .../when/whenWithNothingAndLambdas.fir.kt | 50 -------------- .../tests/when/whenWithNothingAndLambdas.kt | 1 + .../coroutines/inference/kt36220.fir.kt | 19 ------ .../coroutines/inference/kt36220.kt | 1 + 106 files changed, 53 insertions(+), 1057 deletions(-) delete mode 100644 compiler/testData/diagnostics/tests/callableReference/resolve/intersectionTypeOverloadWithWrongParameter.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/checkArguments/arrayAccessSetTooManyArgs.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/controlFlowAnalysis/kt10805.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/controlStructures/ifInResultOfLambda.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/controlStructures/lambdasInExclExclAndElvis.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/controlStructures/whenInResultOfLambda.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionProperty.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/delegatedProperty/inference/manyIncompleteCandidates.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/inferenceFromReceiver1.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/functionLiterals/LabeledFunctionLiterals.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/functionLiterals/return/NoCommonSystem.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/functionLiterals/returnNullWithReturn.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/generics/nullability/useAsReceiver.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/implicitNestedIntersection.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/inference/cannotCompleteResolveAmbiguity.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/inference/cannotCompleteResolveFunctionLiteralsNoUse.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/inference/cannotCompleteResolveNoInfoForParameter.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/inference/cannotCompleteResolveWithFunctionLiterals.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/inference/commonSystem/kt32818.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/inference/conflictingSubstitutions.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/inference/constraints/manyConstraintsDueToRecursiveFlexibleTypesWithWildcards.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/inference/fixationOrderForProperConstraints.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/inference/implicitInvokeExtensionWithFunctionalArgument.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/inference/nothingType/lambdaNothingAndExpectedType.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/inference/publicApproximation/chainedLambdas.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/inference/publicApproximation/smartCastInLambdaReturnAfterIntersection.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/inference/publicApproximation/twoIntersections.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/inference/regressions/kt2838.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/inference/upperBounds/intersectUpperBounds.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/j+k/genericConstructor/recursive.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/j+k/wrongVarianceInJava.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/overload/kt2493.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/platformTypes/rawTypes/samRaw.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/regressions/kt11979.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/resolve/invoke/errors/ambiguityForInvoke.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/resolve/invoke/extensionValueAsNonExtension.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/resolve/kt36264.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/resolve/nestedCalls/completeTypeInferenceForNestedInNoneApplicable.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/resolve/nestedCalls/twoTypeParameters.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/resolve/overloadConflicts/genericClash.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt10640.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31670.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31758.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/resolve/overloadConflicts/overloadResolutionOnNullableContravariantParameter.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/resolve/specialConstructions/multipleSuperClasses.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/smartCasts/elvis/impossible.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/smartCasts/varnotnull/initialization.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/substitutions/upperBoundsSubstitutionForOverloadResolutionWithAmbiguity.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInferenceWithNestedCalls2.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInferenceWithPhantomTypes.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/when/kt10809.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/when/whenWithNothingAndLambdas.fir.kt delete mode 100644 compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt36220.fir.kt diff --git a/compiler/testData/diagnostics/tests/callableReference/resolve/intersectionTypeOverloadWithWrongParameter.fir.kt b/compiler/testData/diagnostics/tests/callableReference/resolve/intersectionTypeOverloadWithWrongParameter.fir.kt deleted file mode 100644 index 88eb11bc693..00000000000 --- a/compiler/testData/diagnostics/tests/callableReference/resolve/intersectionTypeOverloadWithWrongParameter.fir.kt +++ /dev/null @@ -1,18 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER - -import kotlin.reflect.KCallable - -class Foo { - fun installRoute(handler: T) where T : (String) -> Any?, T : KCallable<*> { - } - - fun installRoute(handler: T) where T : () -> Any?, T : KCallable<*> { - } - - fun foo() { - installRoute(::route) - } - -} - -fun route(s: String): Any? = null diff --git a/compiler/testData/diagnostics/tests/callableReference/resolve/intersectionTypeOverloadWithWrongParameter.kt b/compiler/testData/diagnostics/tests/callableReference/resolve/intersectionTypeOverloadWithWrongParameter.kt index 88eb11bc693..6d242f67ddb 100644 --- a/compiler/testData/diagnostics/tests/callableReference/resolve/intersectionTypeOverloadWithWrongParameter.kt +++ b/compiler/testData/diagnostics/tests/callableReference/resolve/intersectionTypeOverloadWithWrongParameter.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER import kotlin.reflect.KCallable diff --git a/compiler/testData/diagnostics/tests/checkArguments/arrayAccessSetTooManyArgs.fir.kt b/compiler/testData/diagnostics/tests/checkArguments/arrayAccessSetTooManyArgs.fir.kt deleted file mode 100644 index 0625de65475..00000000000 --- a/compiler/testData/diagnostics/tests/checkArguments/arrayAccessSetTooManyArgs.fir.kt +++ /dev/null @@ -1,10 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER - -class A { - operator fun get(x: Int) {} - operator fun set(x: String, value: Int) {} - - fun d(x: Int) { - this["", 1] = 1 - } -} diff --git a/compiler/testData/diagnostics/tests/checkArguments/arrayAccessSetTooManyArgs.kt b/compiler/testData/diagnostics/tests/checkArguments/arrayAccessSetTooManyArgs.kt index 0625de65475..eee55287e52 100644 --- a/compiler/testData/diagnostics/tests/checkArguments/arrayAccessSetTooManyArgs.kt +++ b/compiler/testData/diagnostics/tests/checkArguments/arrayAccessSetTooManyArgs.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER class A { diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt10805.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt10805.fir.kt deleted file mode 100644 index 3e6469769df..00000000000 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt10805.fir.kt +++ /dev/null @@ -1,12 +0,0 @@ -// AssertionError for nested ifs with lambdas and Nothing as results -// NI_EXPECTED_FILE - -val fn = if (true) { - { true } -} -else if (true) { - { true } -} -else { - null!! -} diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt10805.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt10805.kt index a3d63d00812..ee32a69961e 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt10805.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt10805.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // AssertionError for nested ifs with lambdas and Nothing as results // NI_EXPECTED_FILE diff --git a/compiler/testData/diagnostics/tests/controlStructures/ifInResultOfLambda.fir.kt b/compiler/testData/diagnostics/tests/controlStructures/ifInResultOfLambda.fir.kt deleted file mode 100644 index 08d46d81584..00000000000 --- a/compiler/testData/diagnostics/tests/controlStructures/ifInResultOfLambda.fir.kt +++ /dev/null @@ -1,9 +0,0 @@ -// NI_EXPECTED_FILE - -val test1 = { if (true) 1 else "" } - -val test2 = { { if (true) 1 else "" } } - -val test3: (Boolean) -> Any = { if (it) 1 else "" } - -val test4: (Boolean) -> Any? = { if (it) 1 else "" } diff --git a/compiler/testData/diagnostics/tests/controlStructures/ifInResultOfLambda.kt b/compiler/testData/diagnostics/tests/controlStructures/ifInResultOfLambda.kt index 08d46d81584..3171883e5ab 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/ifInResultOfLambda.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/ifInResultOfLambda.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // NI_EXPECTED_FILE val test1 = { if (true) 1 else "" } diff --git a/compiler/testData/diagnostics/tests/controlStructures/lambdasInExclExclAndElvis.fir.kt b/compiler/testData/diagnostics/tests/controlStructures/lambdasInExclExclAndElvis.fir.kt deleted file mode 100644 index 0a7e678e8d7..00000000000 --- a/compiler/testData/diagnostics/tests/controlStructures/lambdasInExclExclAndElvis.fir.kt +++ /dev/null @@ -1,15 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_EXPRESSION - -fun use(a: Any?) = a - -fun test() { - { }!! - use({ }!!); - - // KT-KT-9070 - { } ?: 1 - use({ 2 } ?: 1); - - 1 ?: { } - use(1 ?: { }) -} diff --git a/compiler/testData/diagnostics/tests/controlStructures/lambdasInExclExclAndElvis.kt b/compiler/testData/diagnostics/tests/controlStructures/lambdasInExclExclAndElvis.kt index 0a7e678e8d7..c715da186b0 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/lambdasInExclExclAndElvis.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/lambdasInExclExclAndElvis.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_EXPRESSION fun use(a: Any?) = a diff --git a/compiler/testData/diagnostics/tests/controlStructures/whenInResultOfLambda.fir.kt b/compiler/testData/diagnostics/tests/controlStructures/whenInResultOfLambda.fir.kt deleted file mode 100644 index 6091bb406eb..00000000000 --- a/compiler/testData/diagnostics/tests/controlStructures/whenInResultOfLambda.fir.kt +++ /dev/null @@ -1,18 +0,0 @@ -// NI_EXPECTED_FILE - -val test1 = { when (true) { true -> 1; else -> "" } } - -val test2 = { { when (true) { true -> 1; else -> "" } } } - -val test3: (Boolean) -> Any = { when (true) { true -> 1; else -> "" } } - -val test4: (Boolean) -> Any? = { when (true) { true -> 1; else -> "" } } - -fun println() {} - -val test5 = { - when (true) { - true -> println() - else -> println() - } -} diff --git a/compiler/testData/diagnostics/tests/controlStructures/whenInResultOfLambda.kt b/compiler/testData/diagnostics/tests/controlStructures/whenInResultOfLambda.kt index 6091bb406eb..4c4cb5a12e4 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/whenInResultOfLambda.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/whenInResultOfLambda.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // NI_EXPECTED_FILE val test1 = { when (true) { true -> 1; else -> "" } } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionProperty.fir.kt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionProperty.fir.kt deleted file mode 100644 index b2dffbb0989..00000000000 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionProperty.fir.kt +++ /dev/null @@ -1,21 +0,0 @@ -package foo - -import kotlin.reflect.KProperty - -open class A { - val B.w: Int by MyProperty() -} - -val B.r: Int by MyProperty() - -val A.e: Int by MyProperty() - -class B { - val A.f: Int by MyProperty() -} - -class MyProperty { - operator fun getValue(thisRef: R, desc: KProperty<*>): T { - throw Exception("$thisRef $desc") - } -} diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionProperty.kt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionProperty.kt index b2dffbb0989..c6817731b4f 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionProperty.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionProperty.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL package foo import kotlin.reflect.KProperty diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/manyIncompleteCandidates.fir.kt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/manyIncompleteCandidates.fir.kt deleted file mode 100644 index 1e9bfcf10c3..00000000000 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/manyIncompleteCandidates.fir.kt +++ /dev/null @@ -1,25 +0,0 @@ -// FILE: main.kt -package test - -import first.* -import second.* - -val a12 by A() - -// FILE: first.kt -package first - -import kotlin.reflect.KProperty - -class A - -public operator fun A.getValue(thisRef: Any?, property: KProperty<*>): T = null!! - - -// FILE: second.kt -package second - -import first.A -import kotlin.reflect.KProperty - -public operator fun A.getValue(thisRef: Any?, property: KProperty<*>): T = null!! diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/manyIncompleteCandidates.kt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/manyIncompleteCandidates.kt index 1e9bfcf10c3..7bc05b85461 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/manyIncompleteCandidates.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/manyIncompleteCandidates.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // FILE: main.kt package test diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/inferenceFromReceiver1.fir.kt b/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/inferenceFromReceiver1.fir.kt deleted file mode 100644 index 5732f1daa4e..00000000000 --- a/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/inferenceFromReceiver1.fir.kt +++ /dev/null @@ -1,14 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER - -object Inference1 { - interface Foo - - fun delegate(): Foo = TODO() - - operator fun Foo.getValue(receiver: T, p: Any?): String = TODO() - - // not working because resulting descriptor for getValue contains type `???` instead of `T` - val test1: String by delegate() - - val test2: String by delegate() -} diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/inferenceFromReceiver1.kt b/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/inferenceFromReceiver1.kt index 5732f1daa4e..56641fba50d 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/inferenceFromReceiver1.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/inferenceFromReceiver1.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER object Inference1 { diff --git a/compiler/testData/diagnostics/tests/functionLiterals/LabeledFunctionLiterals.fir.kt b/compiler/testData/diagnostics/tests/functionLiterals/LabeledFunctionLiterals.fir.kt deleted file mode 100644 index 4bcde82e60e..00000000000 --- a/compiler/testData/diagnostics/tests/functionLiterals/LabeledFunctionLiterals.fir.kt +++ /dev/null @@ -1,15 +0,0 @@ -package h - -//traits to make ambiguity with function literal as an argument -interface A -interface B -interface C: A, B - -fun foo(a: A, f: () -> T): T = f() -fun foo(b: B, f: () -> T): T = f() - -fun test(c: C) { - foo(c) f@ { - c!! - } -} diff --git a/compiler/testData/diagnostics/tests/functionLiterals/LabeledFunctionLiterals.kt b/compiler/testData/diagnostics/tests/functionLiterals/LabeledFunctionLiterals.kt index 4bcde82e60e..dd9e6d237f0 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/LabeledFunctionLiterals.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/LabeledFunctionLiterals.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL package h //traits to make ambiguity with function literal as an argument diff --git a/compiler/testData/diagnostics/tests/functionLiterals/return/NoCommonSystem.fir.kt b/compiler/testData/diagnostics/tests/functionLiterals/return/NoCommonSystem.fir.kt deleted file mode 100644 index e86df822f8d..00000000000 --- a/compiler/testData/diagnostics/tests/functionLiterals/return/NoCommonSystem.fir.kt +++ /dev/null @@ -1,18 +0,0 @@ -fun Iterable.map(transform: (T) -> R): List = null!! -fun listOf(): List = null!! -fun listOf(vararg values: T): List = null!! - -fun commonSystemFailed(a: List) { - a.map { - if (it == 0) return@map listOf(it) - listOf() - } - a.map { - if (it == 0) return@map listOf() - listOf(it) - } - a.map { - if (it == 0) listOf() - else listOf(it) - } -} diff --git a/compiler/testData/diagnostics/tests/functionLiterals/return/NoCommonSystem.kt b/compiler/testData/diagnostics/tests/functionLiterals/return/NoCommonSystem.kt index e86df822f8d..22ce691130d 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/return/NoCommonSystem.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/return/NoCommonSystem.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL fun Iterable.map(transform: (T) -> R): List = null!! fun listOf(): List = null!! fun listOf(vararg values: T): List = null!! diff --git a/compiler/testData/diagnostics/tests/functionLiterals/returnNullWithReturn.fir.kt b/compiler/testData/diagnostics/tests/functionLiterals/returnNullWithReturn.fir.kt deleted file mode 100644 index 966e4961a6f..00000000000 --- a/compiler/testData/diagnostics/tests/functionLiterals/returnNullWithReturn.fir.kt +++ /dev/null @@ -1,10 +0,0 @@ -package m - -interface Element - -fun test(handlers: MapUnit>) { - - handlers.getOrElse("name", l@ { return@l null }) -} - -fun Map.getOrElse(key: K, defaultValue: ()-> V) : V = throw Exception("$key $defaultValue") diff --git a/compiler/testData/diagnostics/tests/functionLiterals/returnNullWithReturn.kt b/compiler/testData/diagnostics/tests/functionLiterals/returnNullWithReturn.kt index 966e4961a6f..3b37368e9e7 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/returnNullWithReturn.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/returnNullWithReturn.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL package m interface Element diff --git a/compiler/testData/diagnostics/tests/generics/nullability/useAsReceiver.fir.kt b/compiler/testData/diagnostics/tests/generics/nullability/useAsReceiver.fir.kt deleted file mode 100644 index 38d6b9d8ad3..00000000000 --- a/compiler/testData/diagnostics/tests/generics/nullability/useAsReceiver.fir.kt +++ /dev/null @@ -1,26 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_EXPRESSION,-UNUSED_VARIABLE - -fun T.bar1() {} -fun CharSequence?.bar2() {} - -fun T.bar3() {} - -fun foo(x: T) { - x.length - x?.length - - if (1 == 1) { - x!!.length - } - - - x.bar1() - x.bar2() - - x?.bar1() - x?.bar2() - - x.bar3() - - x?.let { it.length } -} diff --git a/compiler/testData/diagnostics/tests/generics/nullability/useAsReceiver.kt b/compiler/testData/diagnostics/tests/generics/nullability/useAsReceiver.kt index 38d6b9d8ad3..0528925b598 100644 --- a/compiler/testData/diagnostics/tests/generics/nullability/useAsReceiver.kt +++ b/compiler/testData/diagnostics/tests/generics/nullability/useAsReceiver.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_EXPRESSION,-UNUSED_VARIABLE fun T.bar1() {} diff --git a/compiler/testData/diagnostics/tests/implicitNestedIntersection.fir.kt b/compiler/testData/diagnostics/tests/implicitNestedIntersection.fir.kt deleted file mode 100644 index 589b23dff7e..00000000000 --- a/compiler/testData/diagnostics/tests/implicitNestedIntersection.fir.kt +++ /dev/null @@ -1,23 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -// NI_EXPECTED_FILE - -interface In -open class A : In -open class B : In - -fun select(x: T, y: T) = x - -fun foo2() = select(A(), B()) // Type "In" is prohibited in return position - - - -open class C : In -open class D : In -open class E : In -open class F : In -open class G : In -open class H : In - -fun select8(a: S, b: S, c: S, d: S, e: S, f: S, g: S, h: S) = a - -fun foo8() = select8(A(), B(), C(), D(), E(), F(), G(), H()) diff --git a/compiler/testData/diagnostics/tests/implicitNestedIntersection.kt b/compiler/testData/diagnostics/tests/implicitNestedIntersection.kt index 589b23dff7e..0ff3d5970e1 100644 --- a/compiler/testData/diagnostics/tests/implicitNestedIntersection.kt +++ b/compiler/testData/diagnostics/tests/implicitNestedIntersection.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER // NI_EXPECTED_FILE diff --git a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveAmbiguity.fir.kt b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveAmbiguity.fir.kt deleted file mode 100644 index 1ee62f30377..00000000000 --- a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveAmbiguity.fir.kt +++ /dev/null @@ -1,8 +0,0 @@ -package f - -fun g(i: Int, a: Any): List {throw Exception()} -fun g(a: Any, i: Int): Collection {throw Exception()} - -fun test() { - val c: List = g(1, 1) -} diff --git a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveAmbiguity.kt b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveAmbiguity.kt index 1ee62f30377..e87f0f53b29 100644 --- a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveAmbiguity.kt +++ b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveAmbiguity.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL package f fun g(i: Int, a: Any): List {throw Exception()} diff --git a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveFunctionLiteralsNoUse.fir.kt b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveFunctionLiteralsNoUse.fir.kt deleted file mode 100644 index c90d9f55e36..00000000000 --- a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveFunctionLiteralsNoUse.fir.kt +++ /dev/null @@ -1,6 +0,0 @@ -package f - -fun h(i: Int, a: Any, r: R, f: (Boolean) -> Int) = 1 -fun h(a: Any, i: Int, r: R, f: (Boolean) -> Int) = 1 - -fun test() = h(1, 1, 1, { b -> 42 }) diff --git a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveFunctionLiteralsNoUse.kt b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveFunctionLiteralsNoUse.kt index c90d9f55e36..5609e7b262e 100644 --- a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveFunctionLiteralsNoUse.kt +++ b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveFunctionLiteralsNoUse.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL package f fun h(i: Int, a: Any, r: R, f: (Boolean) -> Int) = 1 diff --git a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveNoInfoForParameter.fir.kt b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveNoInfoForParameter.fir.kt deleted file mode 100644 index c2116e2279b..00000000000 --- a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveNoInfoForParameter.fir.kt +++ /dev/null @@ -1,10 +0,0 @@ -package f - -fun f(i: Int, c: Collection): List {throw Exception()} -fun f(a: Any, l: List): Collection {throw Exception()} - -fun test(l: List) { - f(1, emptyList()) -} - -fun emptyList(): List {throw Exception()} diff --git a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveNoInfoForParameter.kt b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveNoInfoForParameter.kt index c2116e2279b..f5976fbc9ae 100644 --- a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveNoInfoForParameter.kt +++ b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveNoInfoForParameter.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL package f fun f(i: Int, c: Collection): List {throw Exception()} diff --git a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveWithFunctionLiterals.fir.kt b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveWithFunctionLiterals.fir.kt deleted file mode 100644 index 4d3a16f128c..00000000000 --- a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveWithFunctionLiterals.fir.kt +++ /dev/null @@ -1,10 +0,0 @@ -// !DIAGNOSTICS: -CONFLICTING_JVM_DECLARATIONS -package f - -fun h(f: (Boolean) -> R) = 1 -fun h(f: (String) -> R) = 2 - -fun test() = h{ i -> getAnswer() } - -fun getAnswer() = 42 - diff --git a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveWithFunctionLiterals.kt b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveWithFunctionLiterals.kt index 4f7d4791c23..5900439683f 100644 --- a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveWithFunctionLiterals.kt +++ b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveWithFunctionLiterals.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -CONFLICTING_JVM_DECLARATIONS package f diff --git a/compiler/testData/diagnostics/tests/inference/commonSystem/kt32818.fir.kt b/compiler/testData/diagnostics/tests/inference/commonSystem/kt32818.fir.kt deleted file mode 100644 index 62771517349..00000000000 --- a/compiler/testData/diagnostics/tests/inference/commonSystem/kt32818.fir.kt +++ /dev/null @@ -1,7 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE - -fun nullable(): T? = null - -fun test() { - val value = nullable() ?: nullable() -} diff --git a/compiler/testData/diagnostics/tests/inference/commonSystem/kt32818.kt b/compiler/testData/diagnostics/tests/inference/commonSystem/kt32818.kt index 62771517349..7e6a49e86f8 100644 --- a/compiler/testData/diagnostics/tests/inference/commonSystem/kt32818.kt +++ b/compiler/testData/diagnostics/tests/inference/commonSystem/kt32818.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE fun nullable(): T? = null diff --git a/compiler/testData/diagnostics/tests/inference/conflictingSubstitutions.fir.kt b/compiler/testData/diagnostics/tests/inference/conflictingSubstitutions.fir.kt deleted file mode 100644 index 7041d68261b..00000000000 --- a/compiler/testData/diagnostics/tests/inference/conflictingSubstitutions.fir.kt +++ /dev/null @@ -1,19 +0,0 @@ -package conflictingSubstitutions -//+JDK - -import java.util.* - -fun elemAndList(r: R, t: MutableList): R = r -fun R.elemAndListWithReceiver(r: R, t: MutableList): R = r - -fun test() { - val s = elemAndList(11, list("72")) - - val u = 11.elemAndListWithReceiver(4, list("7")) -} - -fun list(value: T) : ArrayList { - val list = ArrayList() - list.add(value) - return list -} diff --git a/compiler/testData/diagnostics/tests/inference/conflictingSubstitutions.kt b/compiler/testData/diagnostics/tests/inference/conflictingSubstitutions.kt index 7041d68261b..2d4b3cc2acc 100644 --- a/compiler/testData/diagnostics/tests/inference/conflictingSubstitutions.kt +++ b/compiler/testData/diagnostics/tests/inference/conflictingSubstitutions.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL package conflictingSubstitutions //+JDK diff --git a/compiler/testData/diagnostics/tests/inference/constraints/manyConstraintsDueToRecursiveFlexibleTypesWithWildcards.fir.kt b/compiler/testData/diagnostics/tests/inference/constraints/manyConstraintsDueToRecursiveFlexibleTypesWithWildcards.fir.kt deleted file mode 100644 index b83edc82577..00000000000 --- a/compiler/testData/diagnostics/tests/inference/constraints/manyConstraintsDueToRecursiveFlexibleTypesWithWildcards.fir.kt +++ /dev/null @@ -1,31 +0,0 @@ -// SKIP_JAVAC - -// FILE: MySettings.java - -import java.util.Collection - -class MySettings< - SS extends MySettings, - PS extends MyComparableSettings, - L extends MySettingsListener - > -{ - public Collection getLinkedProjectsSettings() { - return null; - } - - public static MySettings getSettings() { - return null; - } -} - -abstract class MyComparableSettings implements Comparable {} -abstract class MySettingsListener {} - -// FILE: test.kt - -fun test() { - val a = MySettings.getSettings() - a.getLinkedProjectsSettings() - a.linkedProjectsSettings -} diff --git a/compiler/testData/diagnostics/tests/inference/constraints/manyConstraintsDueToRecursiveFlexibleTypesWithWildcards.kt b/compiler/testData/diagnostics/tests/inference/constraints/manyConstraintsDueToRecursiveFlexibleTypesWithWildcards.kt index b83edc82577..131e803076d 100644 --- a/compiler/testData/diagnostics/tests/inference/constraints/manyConstraintsDueToRecursiveFlexibleTypesWithWildcards.kt +++ b/compiler/testData/diagnostics/tests/inference/constraints/manyConstraintsDueToRecursiveFlexibleTypesWithWildcards.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // SKIP_JAVAC // FILE: MySettings.java diff --git a/compiler/testData/diagnostics/tests/inference/fixationOrderForProperConstraints.fir.kt b/compiler/testData/diagnostics/tests/inference/fixationOrderForProperConstraints.fir.kt deleted file mode 100644 index 17dbcf48d09..00000000000 --- a/compiler/testData/diagnostics/tests/inference/fixationOrderForProperConstraints.fir.kt +++ /dev/null @@ -1,6 +0,0 @@ -// NI_EXPECTED_FILE -fun foo(f: (Y) -> Z, g: (X) -> Y, x: X): Z = f(g(x)) - -// TODO: Actually, this is a bug and will work when new inference is enabled -// see ([NI] Select variable with proper non-trivial constraint first) for more details -fun test() = foo({ it + 1 }, { it.length }, "") diff --git a/compiler/testData/diagnostics/tests/inference/fixationOrderForProperConstraints.kt b/compiler/testData/diagnostics/tests/inference/fixationOrderForProperConstraints.kt index 17dbcf48d09..2a6edcd290f 100644 --- a/compiler/testData/diagnostics/tests/inference/fixationOrderForProperConstraints.kt +++ b/compiler/testData/diagnostics/tests/inference/fixationOrderForProperConstraints.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // NI_EXPECTED_FILE fun foo(f: (Y) -> Z, g: (X) -> Y, x: X): Z = f(g(x)) diff --git a/compiler/testData/diagnostics/tests/inference/implicitInvokeExtensionWithFunctionalArgument.fir.kt b/compiler/testData/diagnostics/tests/inference/implicitInvokeExtensionWithFunctionalArgument.fir.kt deleted file mode 100644 index 1d68322817f..00000000000 --- a/compiler/testData/diagnostics/tests/inference/implicitInvokeExtensionWithFunctionalArgument.fir.kt +++ /dev/null @@ -1,28 +0,0 @@ -// !CHECK_TYPE -// !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_VARIABLE - -class AbstractSelector -class SelectorFor - -inline operator fun SelectorFor.invoke(f: S.() -> I): AbstractSelector = TODO() - -class State(val p1: Double, val p2: () -> Int, val p3: String?) - -fun test(s: SelectorFor): Double { - val a = s { p1 } - a checkType { _>() } - - val b = s { p2 } - b checkType { _ Int>>()} - - val c = s { p3 } - c checkType { _>() } - - val d = s { } - d checkType { _>() } - - val e = s { return p1 } - e checkType { _>() } - - return null!! -} diff --git a/compiler/testData/diagnostics/tests/inference/implicitInvokeExtensionWithFunctionalArgument.kt b/compiler/testData/diagnostics/tests/inference/implicitInvokeExtensionWithFunctionalArgument.kt index 1d68322817f..107e82baaa3 100644 --- a/compiler/testData/diagnostics/tests/inference/implicitInvokeExtensionWithFunctionalArgument.kt +++ b/compiler/testData/diagnostics/tests/inference/implicitInvokeExtensionWithFunctionalArgument.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CHECK_TYPE // !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_VARIABLE diff --git a/compiler/testData/diagnostics/tests/inference/nothingType/lambdaNothingAndExpectedType.fir.kt b/compiler/testData/diagnostics/tests/inference/nothingType/lambdaNothingAndExpectedType.fir.kt deleted file mode 100644 index d4537af5218..00000000000 --- a/compiler/testData/diagnostics/tests/inference/nothingType/lambdaNothingAndExpectedType.fir.kt +++ /dev/null @@ -1,11 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE - -fun select2(x: K, y: K): K = TODO() -fun select3(x: K, y: K, z: K): K = TODO() - -fun test2(f: ((String) -> Int)?) { - val a0: ((Int) -> Int)? = select2({ it -> it }, null) - val b0: ((Nothing) -> Unit)? = select2({ it -> it }, null) - - select3({ it.length }, f, null) -} diff --git a/compiler/testData/diagnostics/tests/inference/nothingType/lambdaNothingAndExpectedType.kt b/compiler/testData/diagnostics/tests/inference/nothingType/lambdaNothingAndExpectedType.kt index d4537af5218..587f53c585c 100644 --- a/compiler/testData/diagnostics/tests/inference/nothingType/lambdaNothingAndExpectedType.kt +++ b/compiler/testData/diagnostics/tests/inference/nothingType/lambdaNothingAndExpectedType.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE fun select2(x: K, y: K): K = TODO() diff --git a/compiler/testData/diagnostics/tests/inference/publicApproximation/chainedLambdas.fir.kt b/compiler/testData/diagnostics/tests/inference/publicApproximation/chainedLambdas.fir.kt deleted file mode 100644 index f38d9cfd30b..00000000000 --- a/compiler/testData/diagnostics/tests/inference/publicApproximation/chainedLambdas.fir.kt +++ /dev/null @@ -1,33 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -// NI_EXPECTED_FILE - -interface First { - fun first() {} -} -interface Second -interface Third -interface Fourth - -fun chained1(arg: First) = run { - if (arg !is Second) throw Exception() - arg -}.let { third -> - if (third !is Third) throw Exception() - third -} - -fun chained2(arg: First) = run { - if (arg !is Second) throw Exception() - arg -}.let { third -> - if (third !is Third) throw Exception() - third -}.let { fourth -> - if (fourth !is Fourth) throw Exception() - fourth -} - -fun test(arg: First) { - chained1(arg).first() - chained2(arg).first() -} diff --git a/compiler/testData/diagnostics/tests/inference/publicApproximation/chainedLambdas.kt b/compiler/testData/diagnostics/tests/inference/publicApproximation/chainedLambdas.kt index f38d9cfd30b..0d20db885c4 100644 --- a/compiler/testData/diagnostics/tests/inference/publicApproximation/chainedLambdas.kt +++ b/compiler/testData/diagnostics/tests/inference/publicApproximation/chainedLambdas.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER // NI_EXPECTED_FILE diff --git a/compiler/testData/diagnostics/tests/inference/publicApproximation/smartCastInLambdaReturnAfterIntersection.fir.kt b/compiler/testData/diagnostics/tests/inference/publicApproximation/smartCastInLambdaReturnAfterIntersection.fir.kt deleted file mode 100644 index d0bc3b701a7..00000000000 --- a/compiler/testData/diagnostics/tests/inference/publicApproximation/smartCastInLambdaReturnAfterIntersection.fir.kt +++ /dev/null @@ -1,21 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -// NI_EXPECTED_FILE - -interface Base { - fun base() {} -} -interface Base2 -interface One : Base, Base2 -interface Two : Base, Base2 - -fun intersectNullable(vararg elements: S): S? = TODO() - -fun smartCastAfterIntersection(a: One, b: Two) = run { - val v = intersectNullable(a, b) - if (v == null) throw Exception() - v -} - -fun test(one: One, two: Two) { - smartCastAfterIntersection(one, two)?.base() -} diff --git a/compiler/testData/diagnostics/tests/inference/publicApproximation/smartCastInLambdaReturnAfterIntersection.kt b/compiler/testData/diagnostics/tests/inference/publicApproximation/smartCastInLambdaReturnAfterIntersection.kt index d0bc3b701a7..46e590ac2eb 100644 --- a/compiler/testData/diagnostics/tests/inference/publicApproximation/smartCastInLambdaReturnAfterIntersection.kt +++ b/compiler/testData/diagnostics/tests/inference/publicApproximation/smartCastInLambdaReturnAfterIntersection.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER // NI_EXPECTED_FILE diff --git a/compiler/testData/diagnostics/tests/inference/publicApproximation/twoIntersections.fir.kt b/compiler/testData/diagnostics/tests/inference/publicApproximation/twoIntersections.fir.kt deleted file mode 100644 index ec9ec9090d1..00000000000 --- a/compiler/testData/diagnostics/tests/inference/publicApproximation/twoIntersections.fir.kt +++ /dev/null @@ -1,24 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -// NI_EXPECTED_FILE - -interface Base { - fun base() {} -} -interface Base2 : Base3 -interface Base3 -interface One : Base, Base2 -interface Two : Base, Base2 -interface Three : Base, Base3 - -object O1 : One -object O2 : Two -object O3 : Three - -fun intersect(vararg elements: S): S = TODO() -fun intersectNoBound(vararg elements: S): S = TODO() - -fun some(a: One, b: Two, c: Three) = intersectNoBound(intersect(a, b), c) - -fun test(arg: Base, arg2: Base) { - some(O1, O2, O3).base() -} diff --git a/compiler/testData/diagnostics/tests/inference/publicApproximation/twoIntersections.kt b/compiler/testData/diagnostics/tests/inference/publicApproximation/twoIntersections.kt index ec9ec9090d1..d9f5a515b55 100644 --- a/compiler/testData/diagnostics/tests/inference/publicApproximation/twoIntersections.kt +++ b/compiler/testData/diagnostics/tests/inference/publicApproximation/twoIntersections.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER // NI_EXPECTED_FILE diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2838.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2838.fir.kt deleted file mode 100644 index 88f5b5daf04..00000000000 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2838.fir.kt +++ /dev/null @@ -1,18 +0,0 @@ -// !DIAGNOSTICS: -UNREACHABLE_CODE -//KT-2838 Type inference failed on passing null as a nullable argument -package a - -fun foo(a: T, b: Map?) = b?.get(a) -fun bar(a: T, b: Map) = b.get(a) - -fun test(a: Int) { - foo(a, null) - bar(a, null) -} -fun test1(a: Int) { - foo(a, throw Exception()) -} - -fun test2(a: Int) { - bar(a, throw Exception()) -} diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2838.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2838.kt index 88f5b5daf04..2a8603e9b62 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2838.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2838.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNREACHABLE_CODE //KT-2838 Type inference failed on passing null as a nullable argument package a diff --git a/compiler/testData/diagnostics/tests/inference/upperBounds/intersectUpperBounds.fir.kt b/compiler/testData/diagnostics/tests/inference/upperBounds/intersectUpperBounds.fir.kt deleted file mode 100644 index 2307f85ecdd..00000000000 --- a/compiler/testData/diagnostics/tests/inference/upperBounds/intersectUpperBounds.fir.kt +++ /dev/null @@ -1,34 +0,0 @@ -// !CHECK_TYPE - -package s - -import checkSubtype - -interface In - -interface A -interface B -interface C: A, B - -fun foo(in1: In, in2: In): T = throw Exception("$in1 $in2") - -fun test(inA: In, inB: In, inC: In) { - - foo(inA, inB) - - val r = foo(inA, inC) - checkSubtype(r) - - val c: C = foo(inA, inB) - - use(c) -} - -fun bar(in1: In): T = throw Exception("$in1") - -fun test(inA: In) { - val r = bar(inA) - checkSubtype(r) -} - -fun use(vararg a: Any?) = a diff --git a/compiler/testData/diagnostics/tests/inference/upperBounds/intersectUpperBounds.kt b/compiler/testData/diagnostics/tests/inference/upperBounds/intersectUpperBounds.kt index 2307f85ecdd..bcb57a2ba35 100644 --- a/compiler/testData/diagnostics/tests/inference/upperBounds/intersectUpperBounds.kt +++ b/compiler/testData/diagnostics/tests/inference/upperBounds/intersectUpperBounds.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CHECK_TYPE package s diff --git a/compiler/testData/diagnostics/tests/j+k/genericConstructor/recursive.fir.kt b/compiler/testData/diagnostics/tests/j+k/genericConstructor/recursive.fir.kt deleted file mode 100644 index 86affa593ef..00000000000 --- a/compiler/testData/diagnostics/tests/j+k/genericConstructor/recursive.fir.kt +++ /dev/null @@ -1,11 +0,0 @@ -// FILE: C.java - -// See KT-10410 -public class C { - public C(T t) { - } -} - -// FILE: main.kt - -fun foo() = C() diff --git a/compiler/testData/diagnostics/tests/j+k/genericConstructor/recursive.kt b/compiler/testData/diagnostics/tests/j+k/genericConstructor/recursive.kt index 86affa593ef..34464b86d40 100644 --- a/compiler/testData/diagnostics/tests/j+k/genericConstructor/recursive.kt +++ b/compiler/testData/diagnostics/tests/j+k/genericConstructor/recursive.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // FILE: C.java // See KT-10410 diff --git a/compiler/testData/diagnostics/tests/j+k/wrongVarianceInJava.fir.kt b/compiler/testData/diagnostics/tests/j+k/wrongVarianceInJava.fir.kt deleted file mode 100644 index 70543008bc0..00000000000 --- a/compiler/testData/diagnostics/tests/j+k/wrongVarianceInJava.fir.kt +++ /dev/null @@ -1,23 +0,0 @@ -// !CHECK_TYPE -// !DIAGNOSTICS: -UNUSED_PARAMETER -// FILE: A.java - -public class A { - public static Out foo() { return null; } - public static In bar() { return null; } -} - -// FILE: main.kt - -class Out { - fun x(): E = null!! -} - -class In { - fun y(f: F) {} -} - -fun test() { - A.foo().x() checkType { _() } - A.bar().y(null) -} diff --git a/compiler/testData/diagnostics/tests/j+k/wrongVarianceInJava.kt b/compiler/testData/diagnostics/tests/j+k/wrongVarianceInJava.kt index 70543008bc0..0b1f9a5c515 100644 --- a/compiler/testData/diagnostics/tests/j+k/wrongVarianceInJava.kt +++ b/compiler/testData/diagnostics/tests/j+k/wrongVarianceInJava.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CHECK_TYPE // !DIAGNOSTICS: -UNUSED_PARAMETER // FILE: A.java diff --git a/compiler/testData/diagnostics/tests/overload/kt2493.fir.kt b/compiler/testData/diagnostics/tests/overload/kt2493.fir.kt deleted file mode 100644 index 6e72ebd2b2e..00000000000 --- a/compiler/testData/diagnostics/tests/overload/kt2493.fir.kt +++ /dev/null @@ -1,19 +0,0 @@ -interface A -interface B - -fun R.f() { -} - -fun R.f() { -} - -class AImpl: A -class BImpl: B - -class C: A, B - -fun main() { - AImpl().f() - BImpl().f() - C().f() -} diff --git a/compiler/testData/diagnostics/tests/overload/kt2493.kt b/compiler/testData/diagnostics/tests/overload/kt2493.kt index 6e72ebd2b2e..086c1375dac 100644 --- a/compiler/testData/diagnostics/tests/overload/kt2493.kt +++ b/compiler/testData/diagnostics/tests/overload/kt2493.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL interface A interface B diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/samRaw.fir.kt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/samRaw.fir.kt deleted file mode 100644 index c0f9db1c7b8..00000000000 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/samRaw.fir.kt +++ /dev/null @@ -1,27 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE -// FILE: A.java - -import java.util.List; - -public interface A { - boolean value(T t); -} - -// FILE: B.java - -class B { - void foo(Runnable runnable, A x); - - static A bar() {} -} - -// FILE: main.kt - -fun main() { - fun println() {} - // All parameters in SAM adapter of `foo` have functional types - B().foo({ println() }, B.bar()) - // So you should use SAM constructors when you want to use mix lambdas and Java objects - B().foo(Runnable { println() }, B.bar()) - B().foo({ println() }, { it: Any? -> it == null } ) -} diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/samRaw.kt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/samRaw.kt index c0f9db1c7b8..2bd75c1ae34 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/samRaw.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/samRaw.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE // FILE: A.java diff --git a/compiler/testData/diagnostics/tests/regressions/kt11979.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt11979.fir.kt deleted file mode 100644 index 4d137bb0afe..00000000000 --- a/compiler/testData/diagnostics/tests/regressions/kt11979.fir.kt +++ /dev/null @@ -1,25 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER - - -interface Bar { - val t: T -} - -class MyBar(override val t: T) : Bar - -class BarR : Bar { - override val t: BarR get() = this -} - -class Foo>(val f: F) - -fun id(t1: T, t2: T) = t2 - -fun test(foo: Foo<*>, g: Bar<*>) { - id(foo.f, g).t.t -} - -fun main() { - val foo = Foo(BarR()) - test(foo, MyBar(2)) -} diff --git a/compiler/testData/diagnostics/tests/regressions/kt11979.kt b/compiler/testData/diagnostics/tests/regressions/kt11979.kt index 4d137bb0afe..f95083089a0 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt11979.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt11979.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/errors/ambiguityForInvoke.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/errors/ambiguityForInvoke.fir.kt deleted file mode 100644 index f7f25bfef65..00000000000 --- a/compiler/testData/diagnostics/tests/resolve/invoke/errors/ambiguityForInvoke.fir.kt +++ /dev/null @@ -1,10 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER - -fun Int.invoke(i: Int, a: Any) {} -fun Int.invoke(a: Any, i: Int) {} - -fun foo(i: Int) { - i(1, 1) - - 5(1, 2) -} diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/errors/ambiguityForInvoke.kt b/compiler/testData/diagnostics/tests/resolve/invoke/errors/ambiguityForInvoke.kt index 58f7aadd45c..4259277142d 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/errors/ambiguityForInvoke.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/errors/ambiguityForInvoke.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER fun Int.invoke(i: Int, a: Any) {} diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/extensionValueAsNonExtension.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/extensionValueAsNonExtension.fir.kt deleted file mode 100644 index acc7042275d..00000000000 --- a/compiler/testData/diagnostics/tests/resolve/invoke/extensionValueAsNonExtension.fir.kt +++ /dev/null @@ -1,22 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -class A - -fun test(foo: A.() -> Int, a: A) { - val b: Int = foo(a) - val c: Int = (foo)(a) -} - -class B { - val foo: A.() -> Int = null!! - - init { - val b: Int = foo(A()) - } -} - -fun foo(): A.() -> Int { - val b: Int = foo()(A()) - val c: Int = (foo())(A()) - - return null!! -} diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/extensionValueAsNonExtension.kt b/compiler/testData/diagnostics/tests/resolve/invoke/extensionValueAsNonExtension.kt index acc7042275d..d7dae292233 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/extensionValueAsNonExtension.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/extensionValueAsNonExtension.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE class A diff --git a/compiler/testData/diagnostics/tests/resolve/kt36264.fir.kt b/compiler/testData/diagnostics/tests/resolve/kt36264.fir.kt deleted file mode 100644 index ab4ec9489f7..00000000000 --- a/compiler/testData/diagnostics/tests/resolve/kt36264.fir.kt +++ /dev/null @@ -1,18 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER - -interface A -class B : A - -val String.ext: A - get() = TODO() - -class Cls { - fun take(arg: B) {} - - fun test(s: String) { - if (s.ext is B) - take(s.ext) - } -} - -fun take(arg: Any) {} diff --git a/compiler/testData/diagnostics/tests/resolve/kt36264.kt b/compiler/testData/diagnostics/tests/resolve/kt36264.kt index ab4ec9489f7..5d95c1a65ad 100644 --- a/compiler/testData/diagnostics/tests/resolve/kt36264.kt +++ b/compiler/testData/diagnostics/tests/resolve/kt36264.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER interface A diff --git a/compiler/testData/diagnostics/tests/resolve/nestedCalls/completeTypeInferenceForNestedInNoneApplicable.fir.kt b/compiler/testData/diagnostics/tests/resolve/nestedCalls/completeTypeInferenceForNestedInNoneApplicable.fir.kt deleted file mode 100644 index 0a6893c8b7d..00000000000 --- a/compiler/testData/diagnostics/tests/resolve/nestedCalls/completeTypeInferenceForNestedInNoneApplicable.fir.kt +++ /dev/null @@ -1,10 +0,0 @@ -package h - -fun foo(i: Int) = i -fun foo(s: String) = s - -fun test() { - foo(emptyList()) -} - -fun emptyList(): List {throw Exception()} diff --git a/compiler/testData/diagnostics/tests/resolve/nestedCalls/completeTypeInferenceForNestedInNoneApplicable.kt b/compiler/testData/diagnostics/tests/resolve/nestedCalls/completeTypeInferenceForNestedInNoneApplicable.kt index 0a6893c8b7d..556ddc8351f 100644 --- a/compiler/testData/diagnostics/tests/resolve/nestedCalls/completeTypeInferenceForNestedInNoneApplicable.kt +++ b/compiler/testData/diagnostics/tests/resolve/nestedCalls/completeTypeInferenceForNestedInNoneApplicable.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL package h fun foo(i: Int) = i diff --git a/compiler/testData/diagnostics/tests/resolve/nestedCalls/twoTypeParameters.fir.kt b/compiler/testData/diagnostics/tests/resolve/nestedCalls/twoTypeParameters.fir.kt deleted file mode 100644 index 74b8670b80a..00000000000 --- a/compiler/testData/diagnostics/tests/resolve/nestedCalls/twoTypeParameters.fir.kt +++ /dev/null @@ -1,16 +0,0 @@ -class ResolutionCandidate - -class ResolutionTask(val candidate: ResolutionCandidate) - -fun List>.bar(t: ResolutionTask) = t - -public class ResolutionTaskHolder { - fun test(candidate: ResolutionCandidate, tasks: MutableList>) { - tasks.bar(ResolutionTask(candidate)) - tasks.add(ResolutionTask(candidate)) - - //todo the problem is the type of ResolutionTask is inferred as ResolutionTask too early - tasks.bar(ResolutionTask(candidate)) - tasks.add(ResolutionTask(candidate)) - } -} diff --git a/compiler/testData/diagnostics/tests/resolve/nestedCalls/twoTypeParameters.kt b/compiler/testData/diagnostics/tests/resolve/nestedCalls/twoTypeParameters.kt index 74b8670b80a..f38fc6811bf 100644 --- a/compiler/testData/diagnostics/tests/resolve/nestedCalls/twoTypeParameters.kt +++ b/compiler/testData/diagnostics/tests/resolve/nestedCalls/twoTypeParameters.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL class ResolutionCandidate class ResolutionTask(val candidate: ResolutionCandidate) diff --git a/compiler/testData/diagnostics/tests/resolve/overloadConflicts/genericClash.fir.kt b/compiler/testData/diagnostics/tests/resolve/overloadConflicts/genericClash.fir.kt deleted file mode 100644 index bfcf957196d..00000000000 --- a/compiler/testData/diagnostics/tests/resolve/overloadConflicts/genericClash.fir.kt +++ /dev/null @@ -1,19 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER - -interface A { - fun foo(x: T) - fun foo(x: String) - - fun baz(x: E, y: String) - fun baz(x: String, y: E) -} - -fun baz(x: E, y: String) {} -fun baz(x: String, y: E) {} - -fun bar(x: A) { - x.foo("") - - x.baz("", "") - baz("", "") -} diff --git a/compiler/testData/diagnostics/tests/resolve/overloadConflicts/genericClash.kt b/compiler/testData/diagnostics/tests/resolve/overloadConflicts/genericClash.kt index bfcf957196d..50b9f09b620 100644 --- a/compiler/testData/diagnostics/tests/resolve/overloadConflicts/genericClash.kt +++ b/compiler/testData/diagnostics/tests/resolve/overloadConflicts/genericClash.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER interface A { diff --git a/compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt10640.fir.kt b/compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt10640.fir.kt deleted file mode 100644 index 520acd5367f..00000000000 --- a/compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt10640.fir.kt +++ /dev/null @@ -1,9 +0,0 @@ -interface AutoCloseable -interface Closeable : AutoCloseable - -fun T1.myUse(f: (T1) -> R1): R1 = f(this) -fun T2.myUse(f: (T2) -> R2): R2 = f(this) - -fun test1(x: Closeable) = x.myUse { 42 } -fun test2(x: Closeable) = x.myUse { 42 } -fun test3(x: Closeable) = x.myUse { 42 } // TODO KT-10681 diff --git a/compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt10640.kt b/compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt10640.kt index 520acd5367f..2d4c741dfb5 100644 --- a/compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt10640.kt +++ b/compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt10640.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL interface AutoCloseable interface Closeable : AutoCloseable diff --git a/compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31670.fir.kt b/compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31670.fir.kt deleted file mode 100644 index bf767d349d9..00000000000 --- a/compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31670.fir.kt +++ /dev/null @@ -1,15 +0,0 @@ -// !CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION: CONSTRAINT_SYSTEM_FOR_NEW_INFERENCE - -open class A(val value: T) -class B(value: T) : A(value) - -fun A.foo(block: (T?) -> Unit) { - block(value) -} -fun B.foo(block: (T) -> Unit) { - block(value) -} - -fun main() { - B("string").foo { } -} diff --git a/compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31670.kt b/compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31670.kt index bf767d349d9..6d0e9e7093c 100644 --- a/compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31670.kt +++ b/compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31670.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION: CONSTRAINT_SYSTEM_FOR_NEW_INFERENCE open class A(val value: T) diff --git a/compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31758.fir.kt b/compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31758.fir.kt deleted file mode 100644 index 7f99d37bbde..00000000000 --- a/compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31758.fir.kt +++ /dev/null @@ -1,25 +0,0 @@ -// !CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION: CONSTRAINT_SYSTEM_FOR_NEW_INFERENCE -// !DIAGNOSTICS: -UNUSED_PARAMETER - -// FILE: a.kt - -package a - -enum class A { A1 } - -fun > foo(arg: T.() -> Unit) = 1 - -// FILE: b.kt - -package b - -fun foo(arg: T.() -> Unit) = 2 - -// FILE: test.kt - -import a.* -import b.* - -fun test() { - foo { } -} diff --git a/compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31758.kt b/compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31758.kt index 7f99d37bbde..df3c692342b 100644 --- a/compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31758.kt +++ b/compiler/testData/diagnostics/tests/resolve/overloadConflicts/kt31758.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION: CONSTRAINT_SYSTEM_FOR_NEW_INFERENCE // !DIAGNOSTICS: -UNUSED_PARAMETER diff --git a/compiler/testData/diagnostics/tests/resolve/overloadConflicts/overloadResolutionOnNullableContravariantParameter.fir.kt b/compiler/testData/diagnostics/tests/resolve/overloadConflicts/overloadResolutionOnNullableContravariantParameter.fir.kt deleted file mode 100644 index a9b8e646898..00000000000 --- a/compiler/testData/diagnostics/tests/resolve/overloadConflicts/overloadResolutionOnNullableContravariantParameter.fir.kt +++ /dev/null @@ -1,23 +0,0 @@ -// !CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION: CONSTRAINT_SYSTEM_FOR_NEW_INFERENCE -// !DIAGNOSTICS: -UNUSED_PARAMETER - -// FILE: a.kt - -package a - -fun foo(block: (T?) -> Unit) {} - -// FILE: b.kt - -package b - -fun foo(block: (K) -> Unit) {} - -// FILE: test.kt - -import a.* -import b.* - -fun main() { - foo { } -} diff --git a/compiler/testData/diagnostics/tests/resolve/overloadConflicts/overloadResolutionOnNullableContravariantParameter.kt b/compiler/testData/diagnostics/tests/resolve/overloadConflicts/overloadResolutionOnNullableContravariantParameter.kt index a9b8e646898..1b7425de03c 100644 --- a/compiler/testData/diagnostics/tests/resolve/overloadConflicts/overloadResolutionOnNullableContravariantParameter.kt +++ b/compiler/testData/diagnostics/tests/resolve/overloadConflicts/overloadResolutionOnNullableContravariantParameter.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION: CONSTRAINT_SYSTEM_FOR_NEW_INFERENCE // !DIAGNOSTICS: -UNUSED_PARAMETER diff --git a/compiler/testData/diagnostics/tests/resolve/specialConstructions/multipleSuperClasses.fir.kt b/compiler/testData/diagnostics/tests/resolve/specialConstructions/multipleSuperClasses.fir.kt deleted file mode 100644 index d552ecf374c..00000000000 --- a/compiler/testData/diagnostics/tests/resolve/specialConstructions/multipleSuperClasses.fir.kt +++ /dev/null @@ -1,28 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_VARIABLE - -interface A -interface B - -interface C: A, B -interface D: A, B -interface E: A, B - -fun foo(c: C?, d: D?, e: E?) { - val test1: A? = c ?: d ?: e - - val test2: B? = if (false) if (true) c else d else e - - val test3: A? = when { - true -> c - else -> when { - true -> d - else -> e - } - } - - val test4: B? = when (1) { - 1 -> c - 2 -> d - else -> e - } -} diff --git a/compiler/testData/diagnostics/tests/resolve/specialConstructions/multipleSuperClasses.kt b/compiler/testData/diagnostics/tests/resolve/specialConstructions/multipleSuperClasses.kt index d552ecf374c..496900f7cc0 100644 --- a/compiler/testData/diagnostics/tests/resolve/specialConstructions/multipleSuperClasses.kt +++ b/compiler/testData/diagnostics/tests/resolve/specialConstructions/multipleSuperClasses.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE interface A diff --git a/compiler/testData/diagnostics/tests/smartCasts/elvis/impossible.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/elvis/impossible.fir.kt deleted file mode 100644 index dd4184904de..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/elvis/impossible.fir.kt +++ /dev/null @@ -1,40 +0,0 @@ -// !LANGUAGE: +BooleanElvisBoundSmartCasts -// See KT-20752 - -class Unstable { - val first: String? get() = null -} - -class StringList { - fun remove(s: String) = s -} - -fun StringList.remove(s: String?) = s ?: "" - -fun String.isEmpty() = this == "" - -fun foo(list: StringList, arg: Unstable) { - list.remove(arg.first) - if (arg.first?.isEmpty() ?: false) { - // Should be still resolved to extension, without smart cast or smart cast impossible - list.remove(arg.first) - } -} - -class UnstableBoolean { - val first: Boolean? get() = null -} - -class BooleanList { - fun remove(b: Boolean) = b -} - -fun BooleanList.remove(b: Boolean?) = b ?: false - -fun bar(list: BooleanList, arg: UnstableBoolean) { - list.remove(arg.first) - if (arg.first ?: false) { - // Should be still resolved to extension, without smart cast or smart cast impossible - list.remove(arg.first) - } -} diff --git a/compiler/testData/diagnostics/tests/smartCasts/elvis/impossible.kt b/compiler/testData/diagnostics/tests/smartCasts/elvis/impossible.kt index dd4184904de..4e9851a8869 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/elvis/impossible.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/elvis/impossible.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +BooleanElvisBoundSmartCasts // See KT-20752 diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/initialization.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/initialization.fir.kt deleted file mode 100644 index b1bbc823964..00000000000 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/initialization.fir.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun foo() { - var v: String? = "xyz" - // It is possible in principle to provide smart cast here - v.length - v = null - v.length -} diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/initialization.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/initialization.kt index b1bbc823964..d1e300bf188 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/initialization.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/initialization.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL fun foo() { var v: String? = "xyz" // It is possible in principle to provide smart cast here diff --git a/compiler/testData/diagnostics/tests/substitutions/upperBoundsSubstitutionForOverloadResolutionWithAmbiguity.fir.kt b/compiler/testData/diagnostics/tests/substitutions/upperBoundsSubstitutionForOverloadResolutionWithAmbiguity.fir.kt deleted file mode 100644 index b381cd916ee..00000000000 --- a/compiler/testData/diagnostics/tests/substitutions/upperBoundsSubstitutionForOverloadResolutionWithAmbiguity.fir.kt +++ /dev/null @@ -1,18 +0,0 @@ -// FILE: foo.kt -package foo - -fun f(l: List) {} - -// FILE: bar.kt -package bar - -fun f(l: List) {} - -// FILE: main.kt - -import foo.* -import bar.* - -fun test(l: List) { - f(l) -} diff --git a/compiler/testData/diagnostics/tests/substitutions/upperBoundsSubstitutionForOverloadResolutionWithAmbiguity.kt b/compiler/testData/diagnostics/tests/substitutions/upperBoundsSubstitutionForOverloadResolutionWithAmbiguity.kt index b381cd916ee..7f6a17a0783 100644 --- a/compiler/testData/diagnostics/tests/substitutions/upperBoundsSubstitutionForOverloadResolutionWithAmbiguity.kt +++ b/compiler/testData/diagnostics/tests/substitutions/upperBoundsSubstitutionForOverloadResolutionWithAmbiguity.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // FILE: foo.kt package foo diff --git a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInferenceWithNestedCalls2.fir.kt b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInferenceWithNestedCalls2.fir.kt deleted file mode 100644 index 3f0becf950c..00000000000 --- a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInferenceWithNestedCalls2.fir.kt +++ /dev/null @@ -1,40 +0,0 @@ -// NI_EXPECTED_FILE - -interface Ref { - var x: T -} - -class LateInitNumRef() : Ref { - constructor(x: NN) : this() { this.x = x } - - private var xx: NN? = null - - override var x: NN - get() = xx!! - set(value) { - xx = value - } -} - -typealias LateNR = LateInitNumRef - -fun > update(r: R, v: V): R { - r.x = v - return r -} - -val r1 = update(LateInitNumRef(), 1) -val r1a = update(LateNR(), 1) -val r2 = update(LateInitNumRef(1), 1) -val r2a = update(LateNR(1), 1) -val r3 = LateInitNumRef(1) -val r3a = LateNR(1) - -fun test() { - r1.x = r1.x - r1a.x = r1a.x - r2.x = r2.x - r2a.x = r2a.x - r3.x = r3.x - r3a.x = r3a.x -} diff --git a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInferenceWithNestedCalls2.kt b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInferenceWithNestedCalls2.kt index 3f0becf950c..94f08e90129 100644 --- a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInferenceWithNestedCalls2.kt +++ b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInferenceWithNestedCalls2.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // NI_EXPECTED_FILE interface Ref { diff --git a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInferenceWithPhantomTypes.fir.kt b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInferenceWithPhantomTypes.fir.kt deleted file mode 100644 index fff41b71315..00000000000 --- a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInferenceWithPhantomTypes.fir.kt +++ /dev/null @@ -1,16 +0,0 @@ -// NI_EXPECTED_FILE - -class Foo -class Bar - -class Hr(val a: A, val b: B) - -typealias Test = Hr, Bar> - -val test1 = Test(1, "") -val test2 = Test(1, 2) - - -typealias Bas = Hr, Bar> - -val test3 = Bas(1, 1) diff --git a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInferenceWithPhantomTypes.kt b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInferenceWithPhantomTypes.kt index fff41b71315..665157a42e0 100644 --- a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInferenceWithPhantomTypes.kt +++ b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInferenceWithPhantomTypes.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // NI_EXPECTED_FILE class Foo diff --git a/compiler/testData/diagnostics/tests/when/kt10809.fir.kt b/compiler/testData/diagnostics/tests/when/kt10809.fir.kt deleted file mode 100644 index 8003826d118..00000000000 --- a/compiler/testData/diagnostics/tests/when/kt10809.fir.kt +++ /dev/null @@ -1,67 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -DEBUG_INFO_SMARTCAST -// NI_EXPECTED_FILE -/* - * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - * - * SPEC VERSION: 0.1-152 - * PRIMARY LINKS: expressions, when-expression -> paragraph 5 -> sentence 1 - * expressions, when-expression -> paragraph 6 -> sentence 1 - * expressions, when-expression -> paragraph 2 -> sentence 1 - * expressions, when-expression -> paragraph 9 -> sentence 1 - * expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 1 - * expressions, conditional-expression -> paragraph 4 -> sentence 1 - * declarations, function-declaration -> paragraph 7 -> sentence 1 - * type-inference, smart-casts, smart-cast-types -> paragraph 9 -> sentence 1 - * type-system, type-kinds, type-parameters -> paragraph 4 -> sentence 1 - * type-inference, local-type-inference -> paragraph 8 -> sentence 1 - * type-inference, local-type-inference -> paragraph 2 -> sentence 1 - */ - -interface Data -interface Item -class FlagData(val value: Boolean) : Data -class ListData(val list: List) : Data - -fun listOf(vararg items: T): List = null!! - -fun test1(o: Any) = when (o) { - is List<*> -> - ListData(listOf()) - is Int -> when { - o < 0 -> - FlagData(true) - else -> - null - } - else -> - null -} - -fun test1x(o: Any): Data? = when (o) { - is List<*> -> - ListData(listOf()) - is Int -> when { - o < 0 -> - FlagData(true) - else -> - null - } - else -> - null -} - -fun test2() = - if (true) - ListData(listOf()) - else - FlagData(true) - -fun test2x(): Data = - if (true) ListData(listOf()) else FlagData(true) - -fun test2y(): Any = - if (true) ListData(listOf()) else FlagData(true) - -fun test2z(): Any = - run { if (true) ListData(listOf()) else FlagData(true) } - diff --git a/compiler/testData/diagnostics/tests/when/kt10809.kt b/compiler/testData/diagnostics/tests/when/kt10809.kt index 29c1db2bf3a..744180850b2 100644 --- a/compiler/testData/diagnostics/tests/when/kt10809.kt +++ b/compiler/testData/diagnostics/tests/when/kt10809.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER -DEBUG_INFO_SMARTCAST // NI_EXPECTED_FILE /* diff --git a/compiler/testData/diagnostics/tests/when/whenWithNothingAndLambdas.fir.kt b/compiler/testData/diagnostics/tests/when/whenWithNothingAndLambdas.fir.kt deleted file mode 100644 index 9ed176bd000..00000000000 --- a/compiler/testData/diagnostics/tests/when/whenWithNothingAndLambdas.fir.kt +++ /dev/null @@ -1,50 +0,0 @@ -// NI_EXPECTED_FILE -/* - * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - * - * SPEC VERSION: 0.1-152 - * PRIMARY LINKS: expressions, when-expression -> paragraph 2 -> sentence 1 - * expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 1 - * declarations, function-declaration -> paragraph 7 -> sentence 1 - * declarations, function-declaration -> paragraph 7 -> sentence 2 - * declarations, function-declaration -> paragraph 8 -> sentence 1 - * overload-resolution, determining-function-applicability-for-a-specific-call, description -> paragraph 1 -> sentence 3 - */ - -val test1 = when { - true -> { { true } } - else -> TODO() -} - -val test1a: () -> Boolean = when { - true -> { { true } } - else -> TODO() -} - -val test2 = when { - true -> { { true } } - else -> when { - true -> { { true } } - else -> TODO() - } -} - -val test2a: () -> Boolean = when { - true -> { { true } } - else -> when { - true -> { { true } } // TODO - else -> TODO() - } -} - -val test3 = when { - true -> { { true } } - true -> { { true } } - else -> TODO() -} - -val test3a: () -> Boolean = when { - true -> { { true } } - true -> { { true } } - else -> TODO() -} diff --git a/compiler/testData/diagnostics/tests/when/whenWithNothingAndLambdas.kt b/compiler/testData/diagnostics/tests/when/whenWithNothingAndLambdas.kt index 9ed176bd000..fa9d6c6f356 100644 --- a/compiler/testData/diagnostics/tests/when/whenWithNothingAndLambdas.kt +++ b/compiler/testData/diagnostics/tests/when/whenWithNothingAndLambdas.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // NI_EXPECTED_FILE /* * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt36220.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt36220.fir.kt deleted file mode 100644 index f6cbc1ccaf2..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt36220.fir.kt +++ /dev/null @@ -1,19 +0,0 @@ -// !USE_EXPERIMENTAL: kotlin.RequiresOptIn -// !DIAGNOSTICS: -UNUSED_PARAMETER - -import kotlin.experimental.ExperimentalTypeInference - -class TypeDefinition { - fun parse(parser: (serializedValue: String) -> KotlinType?): Unit = TODO() - fun serialize(parser: (value: KotlinType) -> Any?): Unit = TODO() -} - -@OptIn(ExperimentalTypeInference::class) -fun defineType(@BuilderInference definition: TypeDefinition.() -> Unit): Unit = TODO() - -fun main() { - defineType { - parse { it.toInt() } - serialize { it.toString() } - } -} diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt36220.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt36220.kt index f6cbc1ccaf2..52193949bfe 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt36220.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt36220.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_PARAMETER