From fcd3e4f4c520b9b58d91e14f0a27f8df6bb6a2e2 Mon Sep 17 00:00:00 2001 From: Nikolay Lunyak Date: Fri, 23 Sep 2022 12:20:09 +0300 Subject: [PATCH] [FIR JS] KT-51740: Alter positioning of `NO_VALUE_FOR_PARAMETER` --- .../arguments/argumentsOfAnnotations.kt | 2 +- .../testData/resolve/arguments/default.kt | 4 +- .../resolve/arguments/defaultFromOverrides.kt | 4 +- .../testData/resolve/arguments/lambda.kt | 10 ++--- .../resolve/arguments/noParameterForName.kt | 2 +- .../testData/resolve/arguments/simple.kt | 6 +-- .../testData/resolve/arguments/vararg.kt | 2 +- ...ypeInitializedWithoutPrimaryConstructor.kt | 2 +- .../LightTreePositioningStrategies.kt | 29 ++++++++++--- .../diagnostics/PositioningStrategies.kt | 21 +++++++++- .../tests/ConstructorsOfPrimitives.fir.kt | 14 +++---- .../tests/FunctionCalleeExpressions.fir.kt | 8 ++-- .../tests/FunctionCalleeExpressions.kt | 6 +-- .../tests/annotations/ConstructorCall.fir.kt | 2 +- .../tests/annotations/ConstructorCall.kt | 2 +- ...annotationOnParameterInFunctionType.fir.kt | 2 +- .../annotationOnParameterInFunctionType.kt | 2 +- .../annotations/parameters/expressions/not.kt | 2 +- .../tests/annotations/typeAnnotations.fir.kt | 4 +- .../tests/annotations/typeAnnotations.kt | 4 +- .../property/memberFromTopLevel.fir.kt | 2 +- .../property/memberFromTopLevel.kt | 2 +- .../checkArguments/twoLambdasFunction.fir.kt | 13 ------ .../checkArguments/twoLambdasFunction.kt | 1 + .../tests/delegation/kt44843.fir.kt | 4 +- .../dynamicTypes/withInvisibleSynthesized.kt | 4 +- .../constructorWithDefaultParametersOnly.kt | 2 +- .../extensions/ExtensionFunctions.fir.kt | 2 +- .../tests/extensions/ExtensionFunctions.kt | 2 +- .../extensions/ExtensionsCalledOnSuper.fir.kt | 2 +- .../fromKEEP/autoCloseScope.fir.kt | 34 +++++++++++++++ .../fromKEEP/autoCloseScope.kt | 3 +- .../tests/extensions/variableInvoke.fir.kt | 2 +- .../tests/extensions/variableInvoke.kt | 2 +- .../higherOrderCallMissingParameters.fir.kt | 10 ++--- .../higherOrderCallMissingParameters.kt | 8 ++-- .../postponedArgumentsAnalysis/basic.fir.kt | 4 +- .../postponedArgumentsAnalysis/basic.kt | 4 +- .../inference/invokeLambdaAsFunction.fir.kt | 2 +- .../tests/inference/invokeLambdaAsFunction.kt | 2 +- .../tests/inference/regressions/kt2057.fir.kt | 4 +- .../tests/inference/regressions/kt2057.kt | 4 +- ...gArgumentPassedToLocalExtensionFunction.kt | 2 +- .../specialCallsWithCallableReferences.fir.kt | 42 +++++++++---------- ...omQualifiersWithIrrelevantCandidate.fir.kt | 6 +-- ...rsFromQualifiersWithIrrelevantCandidate.kt | 6 +-- .../j+k/genericConstructor/recursive.fir.kt | 11 +++++ .../tests/j+k/genericConstructor/recursive.kt | 3 +- .../testData/diagnostics/tests/kt435.fir.kt | 2 +- compiler/testData/diagnostics/tests/kt435.kt | 2 +- .../disallowForJavaMethods.fir.kt | 2 +- .../namedArguments/disallowForJavaMethods.kt | 2 +- .../mixedNamedPosition/disabledFeature.fir.kt | 4 +- .../mixedNamedPosition/disabledFeature.kt | 10 ++--- .../mixedNamedPosition/oldInference.fir.kt | 4 +- .../mixedNamedPosition/oldInference.kt | 4 +- .../mixedNamedPosition/simple.fir.kt | 4 +- .../mixedNamedPosition/simple.kt | 4 +- .../mixedNamedPosition/varargs.fir.kt | 14 +++---- .../mixedNamedPosition/varargs.kt | 14 +++---- .../namedArgumentsAndDefaultValues.fir.kt | 8 ++-- .../namedArgumentsAndDefaultValues.kt | 8 ++-- .../diagnostics/tests/objects/Objects.fir.kt | 6 +-- .../invokeInFunctionClass.fir.kt | 16 +++---- .../parameterNames/invokeInFunctionClass.kt | 16 +++---- .../diagnostics/tests/regressions/kt10633.kt | 2 +- .../diagnostics/tests/regressions/kt5362.kt | 2 +- .../incompleteConstructorInvocation.fir.kt | 4 +- .../receiverPresenceErrorForInvoke.fir.kt | 4 +- .../errors/receiverPresenceErrorForInvoke.kt | 6 +-- .../wrongReceiverForInvokeOnExpression.fir.kt | 2 +- ...tionExpectedWhenSeveralInvokesExist.fir.kt | 2 +- .../resolve/invoke/invokeAndSmartCast.fir.kt | 4 +- .../resolve/invoke/invokeAndSmartCast.kt | 4 +- ...OnVariableWithExtensionFunctionType.fir.kt | 8 ++-- ...vokeOnVariableWithExtensionFunctionType.kt | 4 +- .../tests/resolve/invoke/kt9805.fir.kt | 17 ++++++++ .../tests/resolve/invoke/kt9805.kt | 3 +- .../nestedCalls/completeUnmappedArguments.kt | 4 +- .../tests/resolve/newLineLambda.fir.kt | 6 +-- .../tests/resolve/newLineLambda.kt | 6 +-- .../protectedVisibility/constructors.fir.kt | 2 +- ...tializerOfDestructuringDeclarationOnce.kts | 2 +- .../errorsOnEmptyDelegationCall.kt | 2 +- .../noPrimaryConstructor.fir.kt | 6 +++ .../noPrimaryConstructor.kt | 3 +- .../typealiasesAsConstructors.fir.kt | 2 +- .../apiVersion/typealiasesAsConstructors.kt | 4 +- .../tests/typealias/privateInFile.fir.kt | 4 +- .../callDefaultConstructorOfUnsignedType.kt | 2 +- .../dynamicTypes/namedArguments.kt | 2 +- .../defaultArguments/constructor.kt | 4 +- .../defaultArguments/function.kt | 16 +++---- .../annotationParameters/valueArray.kt | 2 +- .../testsWithStdLib/inference/kt11266.fir.kt | 3 ++ .../testsWithStdLib/inference/kt11266.kt | 3 +- .../testsWithStdLib/inference/kt1558.fir.kt | 8 ++-- .../testsWithStdLib/inference/kt1558.kt | 8 ++-- .../regression/ea70880_illegalJvmName.fir.kt | 2 +- .../regression/ea70880_illegalJvmName.kt | 2 +- .../diagnostics/notLinked/dfa/neg/5.fir.kt | 2 +- 101 files changed, 340 insertions(+), 248 deletions(-) delete mode 100644 compiler/testData/diagnostics/tests/checkArguments/twoLambdasFunction.fir.kt create mode 100644 compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/autoCloseScope.fir.kt create mode 100644 compiler/testData/diagnostics/tests/j+k/genericConstructor/recursive.fir.kt create mode 100644 compiler/testData/diagnostics/tests/resolve/invoke/kt9805.fir.kt create mode 100644 compiler/testData/diagnostics/tests/secondaryConstructors/noPrimaryConstructor.fir.kt create mode 100644 compiler/testData/diagnostics/testsWithStdLib/inference/kt11266.fir.kt diff --git a/compiler/fir/analysis-tests/testData/resolve/arguments/argumentsOfAnnotations.kt b/compiler/fir/analysis-tests/testData/resolve/arguments/argumentsOfAnnotations.kt index 97efb6d29e9..011caf4c598 100644 --- a/compiler/fir/analysis-tests/testData/resolve/arguments/argumentsOfAnnotations.kt +++ b/compiler/fir/analysis-tests/testData/resolve/arguments/argumentsOfAnnotations.kt @@ -5,5 +5,5 @@ class A annotation class AnnVarargs(val x: Int, vararg val y: String, val z: Int) -@AnnVarargs(1, "a", "b", "c", 2) +@AnnVarargs(1, "a", "b", "c", 2) class B diff --git a/compiler/fir/analysis-tests/testData/resolve/arguments/default.kt b/compiler/fir/analysis-tests/testData/resolve/arguments/default.kt index a107b117ea9..8c66abec707 100644 --- a/compiler/fir/analysis-tests/testData/resolve/arguments/default.kt +++ b/compiler/fir/analysis-tests/testData/resolve/arguments/default.kt @@ -8,14 +8,14 @@ fun test() { foo(1, 2.0, true) foo(1, third = true) - foo() + foo() foo(0, 0.0, false, "") bar(1, third = true) bar(1, 2.0, true) bar(1, 2.0, true, "my") - bar(1, true) + bar(1, true) baz(1) baz(1, "my", "yours") diff --git a/compiler/fir/analysis-tests/testData/resolve/arguments/defaultFromOverrides.kt b/compiler/fir/analysis-tests/testData/resolve/arguments/defaultFromOverrides.kt index ec2ce34c183..f8766fe9b1f 100644 --- a/compiler/fir/analysis-tests/testData/resolve/arguments/defaultFromOverrides.kt +++ b/compiler/fir/analysis-tests/testData/resolve/arguments/defaultFromOverrides.kt @@ -15,8 +15,8 @@ fun foo(a: A) { a.foo() a.foo(1) - a.bar() - a.bar("") + a.bar() + a.bar("") a.bar(y = 1) a.bar("", 2) } diff --git a/compiler/fir/analysis-tests/testData/resolve/arguments/lambda.kt b/compiler/fir/analysis-tests/testData/resolve/arguments/lambda.kt index 60aa8e6fc51..1079808b0de 100644 --- a/compiler/fir/analysis-tests/testData/resolve/arguments/lambda.kt +++ b/compiler/fir/analysis-tests/testData/resolve/arguments/lambda.kt @@ -20,15 +20,15 @@ fun test() { bar(x = 1, f = {}) // Bad - bar {} - bar({}) + bar {} + bar({}) // OK baz(other = false, f = {}) baz({}, false) // Bad - baz {} - baz() {} - baz(other = false) {} + baz {} + baz() {} + baz(other = false) {} } diff --git a/compiler/fir/analysis-tests/testData/resolve/arguments/noParameterForName.kt b/compiler/fir/analysis-tests/testData/resolve/arguments/noParameterForName.kt index 379178e5804..3672d921727 100644 --- a/compiler/fir/analysis-tests/testData/resolve/arguments/noParameterForName.kt +++ b/compiler/fir/analysis-tests/testData/resolve/arguments/noParameterForName.kt @@ -1,5 +1,5 @@ fun foo(x: Int) {} fun bar() { - foo(y = 1) + foo(y = 1) } diff --git a/compiler/fir/analysis-tests/testData/resolve/arguments/simple.kt b/compiler/fir/analysis-tests/testData/resolve/arguments/simple.kt index 18bbb53cdd8..c425dce5d72 100644 --- a/compiler/fir/analysis-tests/testData/resolve/arguments/simple.kt +++ b/compiler/fir/analysis-tests/testData/resolve/arguments/simple.kt @@ -7,11 +7,11 @@ fun test() { foo(1, second = 3.14, third = false, fourth = "!?") foo(third = false, second = 2.71, fourth = "?!", first = 0) - foo() + foo() foo(0.0, false, 0, "") foo(1, 2.0, third = true, "") - foo(second = 0.0, first = 0, fourth = "") + foo(second = 0.0, first = 0, fourth = "") foo(first = 0.0, second = 0, third = "", fourth = false) foo(first = 0, second = 0.0, third = false, fourth = "", first = 1) - foo(0, 0.0, false, foth = "") + foo(0, 0.0, false, foth = "") } diff --git a/compiler/fir/analysis-tests/testData/resolve/arguments/vararg.kt b/compiler/fir/analysis-tests/testData/resolve/arguments/vararg.kt index 08450469081..57da9476ce9 100644 --- a/compiler/fir/analysis-tests/testData/resolve/arguments/vararg.kt +++ b/compiler/fir/analysis-tests/testData/resolve/arguments/vararg.kt @@ -13,6 +13,6 @@ fun test() { bar(1, z = true, y = *arrayOf("my", "yours")) bar(0, z = false, y = "", y = "other") - bar(0, "", true) + bar(0, "", true) bar(0, z = false, y = "", y = "other", y = "yet other") } diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/supertypeInitializedWithoutPrimaryConstructor.kt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/supertypeInitializedWithoutPrimaryConstructor.kt index 6eb46ff8fb9..3d2860aba24 100644 --- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/supertypeInitializedWithoutPrimaryConstructor.kt +++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/supertypeInitializedWithoutPrimaryConstructor.kt @@ -2,7 +2,7 @@ open class A class B : A open class C(x: Int) -class D : C +class D : C class E : C(10) class F() : C(10) diff --git a/compiler/frontend.common-psi/src/org/jetbrains/kotlin/diagnostics/LightTreePositioningStrategies.kt b/compiler/frontend.common-psi/src/org/jetbrains/kotlin/diagnostics/LightTreePositioningStrategies.kt index 451d82813dd..f27d2fe0145 100644 --- a/compiler/frontend.common-psi/src/org/jetbrains/kotlin/diagnostics/LightTreePositioningStrategies.kt +++ b/compiler/frontend.common-psi/src/org/jetbrains/kotlin/diagnostics/LightTreePositioningStrategies.kt @@ -17,6 +17,8 @@ import org.jetbrains.kotlin.KtSourceElement import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.lexer.KtTokens.* import org.jetbrains.kotlin.psi.KtParameter.VAL_VAR_TOKEN_SET +import org.jetbrains.kotlin.psi.KtValueArgument +import org.jetbrains.kotlin.psi.stubs.elements.KtClassElementType import org.jetbrains.kotlin.psi.stubs.elements.KtConstantExpressionElementType import org.jetbrains.kotlin.psi.stubs.elements.KtStringTemplateExpressionElementType import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes @@ -542,14 +544,31 @@ object LightTreePositioningStrategies { } } val nodeToStart = when (node.tokenType) { - in KtTokens.QUALIFIED_ACCESS -> tree.findLastChildByType(node, KtNodeTypes.CALL_EXPRESSION) ?: node + in QUALIFIED_ACCESS -> tree.findLastChildByType(node, KtNodeTypes.CALL_EXPRESSION) ?: node + KtNodeTypes.CLASS -> tree.findLastChildByType(node, KtNodeTypes.SUPER_TYPE_LIST) ?: node else -> node } - return tree.findDescendantByType(nodeToStart, KtNodeTypes.VALUE_ARGUMENT_LIST)?.let { valueArgumentList -> - tree.findLastChildByType(valueArgumentList, KtTokens.RPAR)?.let { rpar -> - markElement(rpar, startOffset, endOffset, tree, node) + val argumentList = nodeToStart.takeIf { nodeToStart.tokenType == KtNodeTypes.VALUE_ARGUMENT_LIST } + ?: tree.findChildByType(nodeToStart, KtNodeTypes.VALUE_ARGUMENT_LIST) + return when { + argumentList != null -> { + val rightParenthesis = tree.findLastChildByType(argumentList, RPAR) + ?: return markElement(nodeToStart, startOffset, endOffset, tree, node) + val lastArgument = tree.findLastChildByType(argumentList, KtNodeTypes.VALUE_ARGUMENT) + if (lastArgument != null) { + markRange(lastArgument, rightParenthesis, startOffset, endOffset, tree, node) + } else { + markRange(nodeToStart, rightParenthesis, startOffset, endOffset, tree, node) + } } - } ?: markElement(nodeToStart, startOffset, endOffset, tree, node) + + nodeToStart.tokenType == KtNodeTypes.CALL_EXPRESSION -> markElement( + tree.findChildByType(nodeToStart, KtNodeTypes.REFERENCE_EXPRESSION) ?: nodeToStart, + startOffset, endOffset, tree, node, + ) + + else -> markElement(nodeToStart, startOffset, endOffset, tree, node) + } } } diff --git a/compiler/frontend.common-psi/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt b/compiler/frontend.common-psi/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt index 9e4f16ca553..aa97215f037 100644 --- a/compiler/frontend.common-psi/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt +++ b/compiler/frontend.common-psi/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt @@ -644,9 +644,28 @@ object PositioningStrategies { } val qualifiedAccess = when (element) { is KtQualifiedExpression -> element.selectorExpression ?: element + is KtClassOrObject -> element.getSuperTypeList() ?: element else -> element } - return markElement(qualifiedAccess.findDescendantOfType()?.rightParenthesis ?: qualifiedAccess) + val argumentList = qualifiedAccess as? KtValueArgumentList + ?: qualifiedAccess.getChildOfType() + return when { + argumentList != null -> { + val rightParenthesis = argumentList.rightParenthesis ?: return markElement(qualifiedAccess) + val lastArgument = argumentList.children.findLast { it is KtValueArgument } + if (lastArgument != null) { + markRange(lastArgument, rightParenthesis) + } else { + markRange(qualifiedAccess, rightParenthesis) + } + } + + qualifiedAccess is KtCallExpression -> markElement( + qualifiedAccess.getChildOfType() ?: qualifiedAccess + ) + + else -> markElement(qualifiedAccess) + } } } diff --git a/compiler/testData/diagnostics/tests/ConstructorsOfPrimitives.fir.kt b/compiler/testData/diagnostics/tests/ConstructorsOfPrimitives.fir.kt index 5ee10638fe2..c44df05e35c 100644 --- a/compiler/testData/diagnostics/tests/ConstructorsOfPrimitives.fir.kt +++ b/compiler/testData/diagnostics/tests/ConstructorsOfPrimitives.fir.kt @@ -1,10 +1,10 @@ fun test() { - Double() - Float() - Long() - Int() - Short() - Byte() + Double() + Float() + Long() + Int() + Short() + Byte() Char() - Boolean() + Boolean() } diff --git a/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.fir.kt b/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.fir.kt index 5c8fb1bbd09..aefedb622d4 100644 --- a/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.fir.kt +++ b/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.fir.kt @@ -28,8 +28,8 @@ fun fooT2() : (t : T) -> T { fun main(args : Array) { args.foo()() - args.foo1()() - a.foo1()() + args.foo1()() + a.foo1()() a.foo1()(a) args.foo1()(1) @@ -76,8 +76,8 @@ fun main1() { } fun test() { - {x : Int -> 1}(); - (fun Int.() = 1)() + {x : Int -> 1}(); + (fun Int.() = 1)() "sd".(fun Int.() = 1)() val i : Int? = null i.(fun Int.() = 1)(); diff --git a/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.kt b/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.kt index 03c630f7405..85869a9e79e 100644 --- a/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.kt +++ b/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.kt @@ -28,7 +28,7 @@ fun fooT2() : (t : T) -> T { fun main(args : Array) { args.foo()() - args.foo1()() + args.foo1()() a.foo1()() a.foo1()(a) @@ -76,8 +76,8 @@ fun main1() { } fun test() { - {x : Int -> 1}(); - (fun Int.() = 1)() + {x : Int -> 1}(); + (fun Int.() = 1)() "sd".(fun Int.() = 1)() val i : Int? = null i.(fun Int.() = 1)(); diff --git a/compiler/testData/diagnostics/tests/annotations/ConstructorCall.fir.kt b/compiler/testData/diagnostics/tests/annotations/ConstructorCall.fir.kt index c3d66cd2adb..68436ec1f0f 100644 --- a/compiler/testData/diagnostics/tests/annotations/ConstructorCall.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/ConstructorCall.fir.kt @@ -17,7 +17,7 @@ fun foo() { Ann() val a = Ann() - Ann1() + Ann1() Ann1(1) bar(Ann()) bar(a = Ann()) diff --git a/compiler/testData/diagnostics/tests/annotations/ConstructorCall.kt b/compiler/testData/diagnostics/tests/annotations/ConstructorCall.kt index 84909803e70..f1585e0c5cc 100644 --- a/compiler/testData/diagnostics/tests/annotations/ConstructorCall.kt +++ b/compiler/testData/diagnostics/tests/annotations/ConstructorCall.kt @@ -17,7 +17,7 @@ fun foo() { Ann() val a = Ann() - Ann1() + Ann1() Ann1(1) bar(Ann()) bar(a = Ann()) diff --git a/compiler/testData/diagnostics/tests/annotations/annotationOnParameterInFunctionType.fir.kt b/compiler/testData/diagnostics/tests/annotations/annotationOnParameterInFunctionType.fir.kt index fccca04c458..d3d97bf937f 100644 --- a/compiler/testData/diagnostics/tests/annotations/annotationOnParameterInFunctionType.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/annotationOnParameterInFunctionType.fir.kt @@ -31,7 +31,7 @@ fun (@TypeAnn A).extFun(@Ann a: @TypeAnn A): @TypeAnn A? = null @Target(AnnotationTarget.TYPE) annotation class TypeAnnWithArg(val arg: String) -fun badArgs(a: (@TypeAnnWithArg(unresolved = "") Int) -> Unit) {} +fun badArgs(a: (@TypeAnnWithArg(unresolved = "") Int) -> Unit) {} typealias BadArgsInTypeAlias = (@TypeAnnWithArg Int) -> Unit fun badArgsInTypeAlias(a: BadArgsInTypeAlias) {} diff --git a/compiler/testData/diagnostics/tests/annotations/annotationOnParameterInFunctionType.kt b/compiler/testData/diagnostics/tests/annotations/annotationOnParameterInFunctionType.kt index 70180573b2f..40b059b4ffe 100644 --- a/compiler/testData/diagnostics/tests/annotations/annotationOnParameterInFunctionType.kt +++ b/compiler/testData/diagnostics/tests/annotations/annotationOnParameterInFunctionType.kt @@ -31,7 +31,7 @@ fun (@TypeAnn A).extFun(@Ann a: @TypeAnn A): @TypeAnn A? = null @Target(AnnotationTarget.TYPE) annotation class TypeAnnWithArg(val arg: String) -fun badArgs(a: (@TypeAnnWithArg(unresolved = "") Int) -> Unit) {} +fun badArgs(a: (@TypeAnnWithArg(unresolved = "") Int) -> Unit) {} typealias BadArgsInTypeAlias = (@TypeAnnWithArg Int) -> Unit fun badArgsInTypeAlias(a: BadArgsInTypeAlias) {} diff --git a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/not.kt b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/not.kt index 2f69c8cf743..7910490b2c8 100644 --- a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/not.kt +++ b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/not.kt @@ -8,6 +8,6 @@ annotation class Ann( val b3: Boolean ) -@Ann(!true, !false) class MyClass +@Ann(!true, !false) class MyClass // EXPECTED: @Ann(b1 = false, b2 = true) diff --git a/compiler/testData/diagnostics/tests/annotations/typeAnnotations.fir.kt b/compiler/testData/diagnostics/tests/annotations/typeAnnotations.fir.kt index 8a38e14befe..11ced1d6401 100644 --- a/compiler/testData/diagnostics/tests/annotations/typeAnnotations.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/typeAnnotations.fir.kt @@ -17,8 +17,8 @@ val @x List<@x T>.f: Int get() = 42 @Target(AnnotationTarget.TYPE) annotation class TypeAnnWithArg(val arg: String) -fun badArgs(a: List<@TypeAnnWithArg(unresolved = "") Int>) {} -fun badArgsWithProjection(a: Arrayunresolved = "") Int>) {} +fun badArgs(a: List<@TypeAnnWithArg(unresolved = "") Int>) {} +fun badArgsWithProjection(a: Arrayunresolved = "") Int>) {} typealias BadArgsInTypeAlias = List<@TypeAnnWithArg Int> fun badArgsInTypeAlias(a: BadArgsInTypeAlias) {} diff --git a/compiler/testData/diagnostics/tests/annotations/typeAnnotations.kt b/compiler/testData/diagnostics/tests/annotations/typeAnnotations.kt index 89ab2823bfe..8ce2e4916bc 100644 --- a/compiler/testData/diagnostics/tests/annotations/typeAnnotations.kt +++ b/compiler/testData/diagnostics/tests/annotations/typeAnnotations.kt @@ -17,8 +17,8 @@ val @x List<@x T>.f: Int get() = 42 @Target(AnnotationTarget.TYPE) annotation class TypeAnnWithArg(val arg: String) -fun badArgs(a: List<@TypeAnnWithArg(unresolved = "") Int>) {} -fun badArgsWithProjection(a: Arrayunresolved = "") Int>) {} +fun badArgs(a: List<@TypeAnnWithArg(unresolved = "") Int>) {} +fun badArgsWithProjection(a: Arrayunresolved = "") Int>) {} typealias BadArgsInTypeAlias = List<@TypeAnnWithArg Int> fun badArgsInTypeAlias(a: BadArgsInTypeAlias) {} diff --git a/compiler/testData/diagnostics/tests/callableReference/property/memberFromTopLevel.fir.kt b/compiler/testData/diagnostics/tests/callableReference/property/memberFromTopLevel.fir.kt index 7f8ed220694..13c4963dc2d 100644 --- a/compiler/testData/diagnostics/tests/callableReference/property/memberFromTopLevel.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/property/memberFromTopLevel.fir.kt @@ -13,7 +13,7 @@ fun test() { checkSubtype>(p) checkSubtype>(p) checkSubtype(p.get(A())) - p.get() + p.get() p.set(A(), 239) val q = A::bar diff --git a/compiler/testData/diagnostics/tests/callableReference/property/memberFromTopLevel.kt b/compiler/testData/diagnostics/tests/callableReference/property/memberFromTopLevel.kt index 0afa68cc50a..15f1469fd47 100644 --- a/compiler/testData/diagnostics/tests/callableReference/property/memberFromTopLevel.kt +++ b/compiler/testData/diagnostics/tests/callableReference/property/memberFromTopLevel.kt @@ -13,7 +13,7 @@ fun test() { checkSubtype>(p) checkSubtype>(p) checkSubtype(p.get(A())) - p.get() + p.get() p.set(A(), 239) val q = A::bar diff --git a/compiler/testData/diagnostics/tests/checkArguments/twoLambdasFunction.fir.kt b/compiler/testData/diagnostics/tests/checkArguments/twoLambdasFunction.fir.kt deleted file mode 100644 index 02e6782430c..00000000000 --- a/compiler/testData/diagnostics/tests/checkArguments/twoLambdasFunction.fir.kt +++ /dev/null @@ -1,13 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER - -fun test(x: () -> Unit, y: () -> Unit) { - -} - -fun main() { - test { - 1 - } { - 2 - } -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/checkArguments/twoLambdasFunction.kt b/compiler/testData/diagnostics/tests/checkArguments/twoLambdasFunction.kt index 9248c467a62..898b4c48cb6 100644 --- a/compiler/testData/diagnostics/tests/checkArguments/twoLambdasFunction.kt +++ b/compiler/testData/diagnostics/tests/checkArguments/twoLambdasFunction.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER fun test(x: () -> Unit, y: () -> Unit) { diff --git a/compiler/testData/diagnostics/tests/delegation/kt44843.fir.kt b/compiler/testData/diagnostics/tests/delegation/kt44843.fir.kt index 42fa89052bf..2e7b1057521 100644 --- a/compiler/testData/diagnostics/tests/delegation/kt44843.fir.kt +++ b/compiler/testData/diagnostics/tests/delegation/kt44843.fir.kt @@ -1,13 +1,13 @@ // WITH_STDLIB // FILE: test.kt -val bar2 by bar2() +val bar2 by bar2() // FILE: lt/neworld/compiler/Foo.kt package lt.neworld.compiler class Foo { - val bar by bar() + val bar by bar() } // FILE: lt/neworld/compiler/bar/Bar.kt diff --git a/compiler/testData/diagnostics/tests/dynamicTypes/withInvisibleSynthesized.kt b/compiler/testData/diagnostics/tests/dynamicTypes/withInvisibleSynthesized.kt index 0cf6063c8de..f07d1aa122d 100644 --- a/compiler/testData/diagnostics/tests/dynamicTypes/withInvisibleSynthesized.kt +++ b/compiler/testData/diagnostics/tests/dynamicTypes/withInvisibleSynthesized.kt @@ -24,8 +24,8 @@ class K: J.C() { sam(null) sam( name = null, - name = null - ) + name = null + ) } fun test() { diff --git a/compiler/testData/diagnostics/tests/enum/constructorWithDefaultParametersOnly.kt b/compiler/testData/diagnostics/tests/enum/constructorWithDefaultParametersOnly.kt index 3c5286d1bba..21770721694 100644 --- a/compiler/testData/diagnostics/tests/enum/constructorWithDefaultParametersOnly.kt +++ b/compiler/testData/diagnostics/tests/enum/constructorWithDefaultParametersOnly.kt @@ -6,7 +6,7 @@ enum class TestOk(val x: String = "OK") { enum class TestErrors(val x: String) { TEST1, - TEST2(), + TEST2(), TEST3("Hello") } diff --git a/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.fir.kt b/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.fir.kt index a9b5aef4c75..8db9d5de988 100644 --- a/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.fir.kt @@ -19,7 +19,7 @@ class A infix operator fun A.plus(a : Any) { 1.foo() - true.foo() + true.foo() 1 } diff --git a/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.kt b/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.kt index 507b6089e85..e9553c88462 100644 --- a/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.kt +++ b/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.kt @@ -19,7 +19,7 @@ class A infix operator fun A.plus(a : Any) { 1.foo() - true.foo() + true.foo() 1 } diff --git a/compiler/testData/diagnostics/tests/extensions/ExtensionsCalledOnSuper.fir.kt b/compiler/testData/diagnostics/tests/extensions/ExtensionsCalledOnSuper.fir.kt index c4eaa5dceb9..65048ca9df0 100644 --- a/compiler/testData/diagnostics/tests/extensions/ExtensionsCalledOnSuper.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/ExtensionsCalledOnSuper.fir.kt @@ -16,7 +16,7 @@ class C : T { super.foo() // OK super.bar() // Error super.buzz() // OK, resolved to a member - super.buzz1() // Resolved to an extension + super.buzz1() // Resolved to an extension super.buzz1("") // Resolved to a member } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/autoCloseScope.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/autoCloseScope.fir.kt new file mode 100644 index 00000000000..e22fd6dfc14 --- /dev/null +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/autoCloseScope.fir.kt @@ -0,0 +1,34 @@ +// !LANGUAGE: +ContextReceivers + +class File(name: String) +interface InputStream + +interface AutoCloseScope { + fun defer(closeBlock: () -> Unit) + fun close() +} +class AutoCloseScopeImpl : AutoCloseScope { + override fun defer(closeBlock: () -> Unit) = TODO() + override fun close() = TODO() +} + +context(AutoCloseScope) +fun File.open(): InputStream = TODO() + +fun withAutoClose(block: context(AutoCloseScope) () -> Unit) { + val scope = AutoCloseScopeImpl() // Not shown here + try { + with(scope) { block() } + } finally { + scope.close() + } +} + +fun test() { + withAutoClose { + val input = File("input.txt").open() + val config = File("config.txt").open() + // Work + // All files are closed at the end + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/autoCloseScope.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/autoCloseScope.kt index 82e746dbbdf..45b6e5e7243 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/autoCloseScope.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/autoCloseScope.kt @@ -1,4 +1,3 @@ -// FIR_IDENTICAL // !LANGUAGE: +ContextReceivers class File(name: String) @@ -19,7 +18,7 @@ fun File.open(): InputStream = TODO() fun withAutoClose(block: context(AutoCloseScope) () -> Unit) { val scope = AutoCloseScopeImpl() // Not shown here try { - with(scope) { block() } + with(scope) { block() } } finally { scope.close() } diff --git a/compiler/testData/diagnostics/tests/extensions/variableInvoke.fir.kt b/compiler/testData/diagnostics/tests/extensions/variableInvoke.fir.kt index 8783f3069f7..a940855855a 100644 --- a/compiler/testData/diagnostics/tests/extensions/variableInvoke.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/variableInvoke.fir.kt @@ -6,6 +6,6 @@ class A(foo: Int.() -> Unit) { fun test(foo: Int.(String) -> Unit) { 4.foo("") - 4.foo(p1 = "") + 4.foo(p1 = "") 4.foo(p2 = "") } diff --git a/compiler/testData/diagnostics/tests/extensions/variableInvoke.kt b/compiler/testData/diagnostics/tests/extensions/variableInvoke.kt index 40c84b89314..837a7d3814e 100644 --- a/compiler/testData/diagnostics/tests/extensions/variableInvoke.kt +++ b/compiler/testData/diagnostics/tests/extensions/variableInvoke.kt @@ -6,6 +6,6 @@ class A(foo: Int.() -> Unit) { fun test(foo: Int.(String) -> Unit) { 4.foo("") - 4.foo(p1 = "") + 4.foo(p1 = "") 4.foo(p2 = "") } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/functionLiterals/higherOrderCallMissingParameters.fir.kt b/compiler/testData/diagnostics/tests/functionLiterals/higherOrderCallMissingParameters.fir.kt index 2d6edf9f350..cac4dd0e83b 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/higherOrderCallMissingParameters.fir.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/higherOrderCallMissingParameters.fir.kt @@ -2,15 +2,15 @@ fun foo(p: (Int, () -> Int) -> Unit) { // Errors except last call - p { 1 } - p() { 2 } + p { 1 } + p() { 2 } p(3) { 4 } } fun bar(p: (String, Any, () -> String) -> Unit) { // Errors except last call - p { "" } - p() { "x" } - p("y") { "z" } + p { "" } + p() { "x" } + p("y") { "z" } p("v", Any()) { "w" } } diff --git a/compiler/testData/diagnostics/tests/functionLiterals/higherOrderCallMissingParameters.kt b/compiler/testData/diagnostics/tests/functionLiterals/higherOrderCallMissingParameters.kt index 94939d8d40c..319480596d2 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/higherOrderCallMissingParameters.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/higherOrderCallMissingParameters.kt @@ -3,14 +3,14 @@ fun foo(p: (Int, () -> Int) -> Unit) { // Errors except last call p { 1 } - p() { 2 } + p() { 2 } p(3) { 4 } } fun bar(p: (String, Any, () -> String) -> Unit) { // Errors except last call p { "" } - p() { "x" } - p("y") { "z" } + p() { "x" } + p("y") { "z" } p("v", Any()) { "w" } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/basic.fir.kt b/compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/basic.fir.kt index e70e84fe24c..d2bdb11904a 100644 --- a/compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/basic.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/basic.fir.kt @@ -119,8 +119,8 @@ fun main() { * K <: (A) -> Unit -> TypeVariable(_RP1) >: A * K >: (C) -> TypeVariable(_R) -> TypeVariable(_RP1) <: C */ - val x12 = selectC(id { it }, id { x: B -> }) - val x13 = selectA(id { it }, id { x: C -> }) + val x12 = selectC(id { it }, id { x: B -> }) + val x13 = selectA(id { it }, id { x: C -> }) val x14 = selectC(id { it }, id { x: A -> }, { x -> x }) val x15 = selectC(id { it }, { x: A -> }, id { x -> x }) /* diff --git a/compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/basic.kt b/compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/basic.kt index 5d643c914a0..3741b612314 100644 --- a/compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/basic.kt +++ b/compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/basic.kt @@ -119,8 +119,8 @@ fun main() { * K <: (A) -> Unit -> TypeVariable(_RP1) >: A * K >: (C) -> TypeVariable(_R) -> TypeVariable(_RP1) <: C */ - val x12 = selectC(id { it }, id { x: B -> }) - val x13 = selectA(id { it }, id { x: C -> }) + val x12 = selectC(id { it }, id { x: B -> }) + val x13 = selectA(id { it }, id { x: C -> }) val x14 = selectC(id { it }, id { x: A -> }, { x -> x }) val x15 = selectC(id { it }, { x: A -> }, id { x -> x }) /* diff --git a/compiler/testData/diagnostics/tests/inference/invokeLambdaAsFunction.fir.kt b/compiler/testData/diagnostics/tests/inference/invokeLambdaAsFunction.fir.kt index 3a895c91a0e..7a426fba8fc 100644 --- a/compiler/testData/diagnostics/tests/inference/invokeLambdaAsFunction.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/invokeLambdaAsFunction.fir.kt @@ -2,6 +2,6 @@ fun test1(i: Int) = { i -> i }(i) -fun test2() = { i -> i }() +fun test2() = { i -> i }() fun test3() = { i -> i }(1) diff --git a/compiler/testData/diagnostics/tests/inference/invokeLambdaAsFunction.kt b/compiler/testData/diagnostics/tests/inference/invokeLambdaAsFunction.kt index 530a77d2e05..c08903547a1 100644 --- a/compiler/testData/diagnostics/tests/inference/invokeLambdaAsFunction.kt +++ b/compiler/testData/diagnostics/tests/inference/invokeLambdaAsFunction.kt @@ -2,6 +2,6 @@ fun test1(i: Int) = { i -> i }(i) -fun test2() = { i -> i }() +fun test2() = { i -> i }() fun test3() = { i -> i }(1) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2057.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2057.fir.kt index c5880c7b3e5..87a7e22d0ab 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2057.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2057.fir.kt @@ -8,5 +8,5 @@ fun foo(a : T, b : Collection, c : Int) { fun arrayListOf(vararg values: T): ArrayList = throw Exception("$values") -val bar = foo("", arrayListOf(), ) -val bar2 = foo("", arrayListOf(), ) +val bar = foo("", arrayListOf(), ) +val bar2 = foo("", arrayListOf(), ) diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2057.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2057.kt index 0a8b50415f2..cc1eb18716e 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2057.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2057.kt @@ -8,5 +8,5 @@ fun foo(a : T, b : Collection, c : Int) { fun arrayListOf(vararg values: T): ArrayList = throw Exception("$values") -val bar = foo("", arrayListOf(), ) -val bar2 = foo("", arrayListOf(), ) \ No newline at end of file +val bar = foo("", arrayListOf(), ) +val bar2 = foo("", arrayListOf(), ) diff --git a/compiler/testData/diagnostics/tests/inference/reportingImprovements/wrongArgumentPassedToLocalExtensionFunction.kt b/compiler/testData/diagnostics/tests/inference/reportingImprovements/wrongArgumentPassedToLocalExtensionFunction.kt index 250cbb5d28c..18698646d30 100644 --- a/compiler/testData/diagnostics/tests/inference/reportingImprovements/wrongArgumentPassedToLocalExtensionFunction.kt +++ b/compiler/testData/diagnostics/tests/inference/reportingImprovements/wrongArgumentPassedToLocalExtensionFunction.kt @@ -12,7 +12,7 @@ fun test(f: Runnable.(Int) -> Unit, runnable: Runnable) { fun Int.test(f: String.(Int) -> Unit) { f("", 0) - f("") + f("") with("") { f(0) f(0.0) diff --git a/compiler/testData/diagnostics/tests/inference/specialCallsWithCallableReferences.fir.kt b/compiler/testData/diagnostics/tests/inference/specialCallsWithCallableReferences.fir.kt index 7a04c59804f..7e06083c8ca 100644 --- a/compiler/testData/diagnostics/tests/inference/specialCallsWithCallableReferences.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/specialCallsWithCallableReferences.fir.kt @@ -35,7 +35,7 @@ fun poll11(flag: Boolean) { fun poll12(flag: Boolean) { val inv = if (flag) { ::bar3 } else { ::foo3 } - inv() + inv() } fun poll13(flag: Boolean) { @@ -45,12 +45,12 @@ fun poll13(flag: Boolean) { fun poll14(flag: Boolean) { val inv = if (flag) { ::bar4 } else { ::foo4 } - inv() + inv() } fun poll15(flag: Boolean) { val inv = if (flag) { ::bar5 } else { ::foo5 } - inv() + inv() } fun poll16(flag: Boolean) { @@ -65,7 +65,7 @@ fun poll17(flag: Boolean) { fun poll2(flag: Boolean) { val inv = when (flag) { true -> ::bar else -> ::foo } - inv() + inv() } fun poll21(flag: Boolean) { @@ -75,12 +75,12 @@ fun poll21(flag: Boolean) { fun poll22(flag: Boolean) { val inv = when (flag) { true -> ::bar3 else -> ::foo3 } - inv() + inv() } fun poll23(flag: Boolean) { val inv = when (flag) { true -> ::bar4 else -> ::foo4 } - inv() + inv() } fun poll24(flag: Boolean) { @@ -100,7 +100,7 @@ fun poll26(flag: Boolean) { fun poll3(flag: Boolean) { val inv = when (flag) { true -> ::bar false -> ::foo } - inv() + inv() } fun poll31(flag: Boolean) { @@ -110,12 +110,12 @@ fun poll31(flag: Boolean) { fun poll32(flag: Boolean) { val inv = when (flag) { true -> ::bar3 false -> ::foo3 } - inv() + inv() } fun poll33(flag: Boolean) { val inv = when (flag) { true -> ::bar4 false -> ::foo4 } - inv() + inv() } fun poll34(flag: Boolean) { @@ -135,7 +135,7 @@ fun poll36(flag: Boolean) { fun poll4() { val inv = try { ::bar } finally { ::foo } - inv() + inv() } fun poll41() { @@ -145,17 +145,17 @@ fun poll41() { fun poll42() { val inv = try { ::bar3 } finally { ::foo3 } - inv() + inv() } fun poll43() { val inv = try { ::bar4 } finally { ::foo4 } - inv() + inv() } fun poll44() { val inv = try { ::bar5 } finally { ::foo5 } - inv() + inv() } fun poll45() { @@ -170,7 +170,7 @@ fun poll46() { fun poll5() { val inv = try { ::bar } catch (e: Exception) { ::foo } finally { ::foo } - inv() + inv() } fun poll51() { @@ -180,17 +180,17 @@ fun poll51() { fun poll52() { val inv = try { ::bar3 } catch (e: Exception) { ::foo3 } finally { ::foo3 } - inv() + inv() } fun poll53() { val inv = try { ::bar4 } catch (e: Exception) { ::foo4 } finally { ::foo4 } - inv() + inv() } fun poll54() { val inv = try { ::bar5 } catch (e: Exception) { ::foo5 } finally { ::foo5 } - inv() + inv() } fun poll55() { @@ -240,7 +240,7 @@ fun poll66() { fun poll7() { val inv = ::bar!! - inv() + inv() } fun poll71() { @@ -250,7 +250,7 @@ fun poll71() { fun poll72() { val inv = ::bar3!! - inv() + inv() } fun poll73() { @@ -275,7 +275,7 @@ fun poll76() { fun poll8() { val inv = ::bar in setOf(::foo) - inv() + inv() } fun poll81() { @@ -285,7 +285,7 @@ fun poll81() { fun poll82() { val inv = ::bar3 in setOf(::foo3) - inv() + inv() } fun poll83() { diff --git a/compiler/testData/diagnostics/tests/inner/innerConstructorsFromQualifiersWithIrrelevantCandidate.fir.kt b/compiler/testData/diagnostics/tests/inner/innerConstructorsFromQualifiersWithIrrelevantCandidate.fir.kt index 666dfade84a..2adf29dd94d 100644 --- a/compiler/testData/diagnostics/tests/inner/innerConstructorsFromQualifiersWithIrrelevantCandidate.fir.kt +++ b/compiler/testData/diagnostics/tests/inner/innerConstructorsFromQualifiersWithIrrelevantCandidate.fir.kt @@ -12,7 +12,7 @@ class Outer { fun baz() { // Diagnostic here could be better (why can't I call the constructor above?) - Inner() + Inner() Inner(1) Inner("") } @@ -20,7 +20,7 @@ class Outer { } fun foo() { - Outer.Inner() + Outer.Inner() Outer.Inner(1) Outer.Inner("") } @@ -31,7 +31,7 @@ import abc.Outer.Inner import abc.Outer.Companion.Inner fun bar() { - Inner() + Inner() Inner(1) Inner("") diff --git a/compiler/testData/diagnostics/tests/inner/innerConstructorsFromQualifiersWithIrrelevantCandidate.kt b/compiler/testData/diagnostics/tests/inner/innerConstructorsFromQualifiersWithIrrelevantCandidate.kt index 5c504d553c4..777ff417e2d 100644 --- a/compiler/testData/diagnostics/tests/inner/innerConstructorsFromQualifiersWithIrrelevantCandidate.kt +++ b/compiler/testData/diagnostics/tests/inner/innerConstructorsFromQualifiersWithIrrelevantCandidate.kt @@ -12,7 +12,7 @@ class Outer { fun baz() { // Diagnostic here could be better (why can't I call the constructor above?) - Inner() + Inner() Inner(1) Inner("") } @@ -20,7 +20,7 @@ class Outer { } fun foo() { - Outer.Inner() + Outer.Inner() Outer.Inner(1) Outer.Inner("") } @@ -31,7 +31,7 @@ import abc.Outer.Inner import abc.Outer.Companion.Inner fun bar() { - Inner() + Inner() Inner(1) Inner("") diff --git a/compiler/testData/diagnostics/tests/j+k/genericConstructor/recursive.fir.kt b/compiler/testData/diagnostics/tests/j+k/genericConstructor/recursive.fir.kt new file mode 100644 index 00000000000..ca052faecd4 --- /dev/null +++ b/compiler/testData/diagnostics/tests/j+k/genericConstructor/recursive.fir.kt @@ -0,0 +1,11 @@ +// 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 34464b86d40..65a22ee4dfd 100644 --- a/compiler/testData/diagnostics/tests/j+k/genericConstructor/recursive.kt +++ b/compiler/testData/diagnostics/tests/j+k/genericConstructor/recursive.kt @@ -1,4 +1,3 @@ -// FIR_IDENTICAL // FILE: C.java // See KT-10410 @@ -9,4 +8,4 @@ public class C { // FILE: main.kt -fun foo() = C() +fun foo() = C() diff --git a/compiler/testData/diagnostics/tests/kt435.fir.kt b/compiler/testData/diagnostics/tests/kt435.fir.kt index 6634c3633d6..e61c2300bd7 100644 --- a/compiler/testData/diagnostics/tests/kt435.fir.kt +++ b/compiler/testData/diagnostics/tests/kt435.fir.kt @@ -4,5 +4,5 @@ fun Any.foo1() : (i : Int) -> Unit { } fun test(a : Any) { - a.foo1()() + a.foo1()() } diff --git a/compiler/testData/diagnostics/tests/kt435.kt b/compiler/testData/diagnostics/tests/kt435.kt index 04121f0ab04..be3b10e2332 100644 --- a/compiler/testData/diagnostics/tests/kt435.kt +++ b/compiler/testData/diagnostics/tests/kt435.kt @@ -4,5 +4,5 @@ fun Any.foo1() : (i : Int) -> Unit { } fun test(a : Any) { - a.foo1()() + a.foo1()() } diff --git a/compiler/testData/diagnostics/tests/namedArguments/disallowForJavaMethods.fir.kt b/compiler/testData/diagnostics/tests/namedArguments/disallowForJavaMethods.fir.kt index ab444f95a92..08e4e4f5075 100644 --- a/compiler/testData/diagnostics/tests/namedArguments/disallowForJavaMethods.fir.kt +++ b/compiler/testData/diagnostics/tests/namedArguments/disallowForJavaMethods.fir.kt @@ -21,7 +21,7 @@ class KotlinSubSubClass : KotlinSubClass() { fun viaRealOverride() = KotlinSubSubClass().foo(kotlinName = 3) -fun unresolvedParameter() = JavaSuperClass().foo(nonexistentName = 4) +fun unresolvedParameter() = JavaSuperClass().foo(nonexistentName = 4) fun multipleParameters() = JavaSuperClass().multipleParameters(first = 1, second = 2L, third = "3") diff --git a/compiler/testData/diagnostics/tests/namedArguments/disallowForJavaMethods.kt b/compiler/testData/diagnostics/tests/namedArguments/disallowForJavaMethods.kt index 64e32ae0524..79047c5ef7d 100644 --- a/compiler/testData/diagnostics/tests/namedArguments/disallowForJavaMethods.kt +++ b/compiler/testData/diagnostics/tests/namedArguments/disallowForJavaMethods.kt @@ -21,7 +21,7 @@ class KotlinSubSubClass : KotlinSubClass() { fun viaRealOverride() = KotlinSubSubClass().foo(kotlinName = 3) -fun unresolvedParameter() = JavaSuperClass().foo(nonexistentName = 4) +fun unresolvedParameter() = JavaSuperClass().foo(nonexistentName = 4) fun multipleParameters() = JavaSuperClass().multipleParameters(first = 1, second = 2L, third = "3") diff --git a/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/disabledFeature.fir.kt b/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/disabledFeature.fir.kt index 8189f7558ec..ec83ccf28ee 100644 --- a/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/disabledFeature.fir.kt +++ b/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/disabledFeature.fir.kt @@ -15,6 +15,6 @@ fun main() { foo(p1 = 1, p2 = "2", 3.0) - foo(1, p3 = 2.0, "") - foo(1, p3 = 2.0, 3.0) + foo(1, p3 = 2.0, "") + foo(1, p3 = 2.0, 3.0) } diff --git a/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/disabledFeature.kt b/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/disabledFeature.kt index 6603a2813ef..cbdf55b9601 100644 --- a/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/disabledFeature.kt +++ b/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/disabledFeature.kt @@ -9,12 +9,12 @@ fun foo( ) {} fun main() { - foo(p1 = 1, "2", 3.0) - foo(1, p2 = "2", 3.0) + foo(p1 = 1, "2", 3.0) + foo(1, p2 = "2", 3.0) foo(1, "2", p3 = 3.0) - foo(p1 = 1, p2 = "2", 3.0) + foo(p1 = 1, p2 = "2", 3.0) - foo(1, p3 = 2.0, "") - foo(1, p3 = 2.0, 3.0) + foo(1, p3 = 2.0, "") + foo(1, p3 = 2.0, 3.0) } diff --git a/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/oldInference.fir.kt b/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/oldInference.fir.kt index cd60b295afd..7bd73267eb1 100644 --- a/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/oldInference.fir.kt +++ b/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/oldInference.fir.kt @@ -15,6 +15,6 @@ fun main() { foo(p1 = 1, p2 = "2", 3.0) - foo(1, p3 = 2.0, "") - foo(1, p3 = 2.0, 3.0) + foo(1, p3 = 2.0, "") + foo(1, p3 = 2.0, 3.0) } diff --git a/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/oldInference.kt b/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/oldInference.kt index 938023d9d9b..8b593e5f1ea 100644 --- a/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/oldInference.kt +++ b/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/oldInference.kt @@ -15,6 +15,6 @@ fun main() { foo(p1 = 1, p2 = "2", 3.0) - foo(1, p3 = 2.0, "") - foo(1, p3 = 2.0, 3.0) + foo(1, p3 = 2.0, "") + foo(1, p3 = 2.0, 3.0) } diff --git a/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/simple.fir.kt b/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/simple.fir.kt index cd60b295afd..7bd73267eb1 100644 --- a/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/simple.fir.kt +++ b/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/simple.fir.kt @@ -15,6 +15,6 @@ fun main() { foo(p1 = 1, p2 = "2", 3.0) - foo(1, p3 = 2.0, "") - foo(1, p3 = 2.0, 3.0) + foo(1, p3 = 2.0, "") + foo(1, p3 = 2.0, 3.0) } diff --git a/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/simple.kt b/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/simple.kt index 938023d9d9b..8b593e5f1ea 100644 --- a/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/simple.kt +++ b/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/simple.kt @@ -15,6 +15,6 @@ fun main() { foo(p1 = 1, p2 = "2", 3.0) - foo(1, p3 = 2.0, "") - foo(1, p3 = 2.0, 3.0) + foo(1, p3 = 2.0, "") + foo(1, p3 = 2.0, 3.0) } diff --git a/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/varargs.fir.kt b/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/varargs.fir.kt index ee89378bd7a..9bc92f82569 100644 --- a/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/varargs.fir.kt +++ b/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/varargs.fir.kt @@ -28,10 +28,10 @@ fun foo4( ) {} fun main() { - foo1(1, 2, p2 = "3", 4.0) + foo1(1, 2, p2 = "3", 4.0) foo1(p1 = intArrayOf(1, 2), "3", p3 = 4.0) - foo1(p2 = "3", 4.0) + foo1(p2 = "3", 4.0) foo2(p1 = 1, "2", "3", p3 = 4.0) foo2(1, p2 = arrayOf("2", "3"), 4.0) @@ -40,11 +40,11 @@ fun main() { foo3(p1 = 1, "2", 3.0, 4.0) foo3(p1 = 1, "2", p3 = doubleArrayOf(3.0, 4.0)) - foo4(p1 = 1, "2", "3", p3 = 4.0, 5) - foo4(1, "2", "3", p3 = 4.0, 5) - foo4(1, p3 = 4.0, 5) + foo4(p1 = 1, "2", "3", p3 = 4.0, 5) + foo4(1, "2", "3", p3 = 4.0, 5) + foo4(1, p3 = 4.0, 5) - foo1(1, 2, p3 = 3.0, "4") + foo1(1, 2, p3 = 3.0, "4") foo1(1, 2, p3 = 3.0, p2 = "4") foo1(*intArrayOf(1, 2), p3 = 3.0, p2 = "4") @@ -52,6 +52,6 @@ fun main() { foo2(1, p3 = 2.0, *arrayOf("3", "4")) foo2(1, p3 = 2.0, p2 = arrayOf("3", "4")) - foo3(1, p3 = doubleArrayOf(2.0, 3.0), "4") + foo3(1, p3 = doubleArrayOf(2.0, 3.0), "4") foo3(1, p3 = doubleArrayOf(2.0, 3.0), p2 = "4") } diff --git a/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/varargs.kt b/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/varargs.kt index 59fce610a0e..4f3bc78ed85 100644 --- a/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/varargs.kt +++ b/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/varargs.kt @@ -28,10 +28,10 @@ fun foo4( ) {} fun main() { - foo1(1, 2, p2 = "3", 4.0) + foo1(1, 2, p2 = "3", 4.0) foo1(p1 = intArrayOf(1, 2), "3", p3 = 4.0) - foo1(p2 = "3", 4.0) + foo1(p2 = "3", 4.0) foo2(p1 = 1, "2", "3", p3 = 4.0) foo2(1, p2 = arrayOf("2", "3"), 4.0) @@ -40,11 +40,11 @@ fun main() { foo3(p1 = 1, "2", 3.0, 4.0) foo3(p1 = 1, "2", p3 = doubleArrayOf(3.0, 4.0)) - foo4(p1 = 1, "2", "3", p3 = 4.0, 5) - foo4(1, "2", "3", p3 = 4.0, 5) - foo4(1, p3 = 4.0, 5) + foo4(p1 = 1, "2", "3", p3 = 4.0, 5) + foo4(1, "2", "3", p3 = 4.0, 5) + foo4(1, p3 = 4.0, 5) - foo1(1, 2, p3 = 3.0, "4") + foo1(1, 2, p3 = 3.0, "4") foo1(1, 2, p3 = 3.0, p2 = "4") foo1(*intArrayOf(1, 2), p3 = 3.0, p2 = "4") @@ -52,6 +52,6 @@ fun main() { foo2(1, p3 = 2.0, *arrayOf("3", "4")) foo2(1, p3 = 2.0, p2 = arrayOf("3", "4")) - foo3(1, p3 = doubleArrayOf(2.0, 3.0), "4") + foo3(1, p3 = doubleArrayOf(2.0, 3.0), "4") foo3(1, p3 = doubleArrayOf(2.0, 3.0), p2 = "4") } diff --git a/compiler/testData/diagnostics/tests/namedArguments/namedArgumentsAndDefaultValues.fir.kt b/compiler/testData/diagnostics/tests/namedArguments/namedArgumentsAndDefaultValues.fir.kt index 8b524aee227..4dca2c8100e 100644 --- a/compiler/testData/diagnostics/tests/namedArguments/namedArgumentsAndDefaultValues.fir.kt +++ b/compiler/testData/diagnostics/tests/namedArguments/namedArgumentsAndDefaultValues.fir.kt @@ -14,14 +14,14 @@ fun test() { foo(1, "", "") bar(z = "") - bar() - bar("") + bar() + bar("") bar(1, 1, "") bar(1, 1, "") bar(1, z = "") bar(1, z = "", y = 2) bar(z = "", 1) bar(1, zz = "", - zz.foo - ) + zz.foo + ) } diff --git a/compiler/testData/diagnostics/tests/namedArguments/namedArgumentsAndDefaultValues.kt b/compiler/testData/diagnostics/tests/namedArguments/namedArgumentsAndDefaultValues.kt index 55c8734c07e..7dbc23bea71 100644 --- a/compiler/testData/diagnostics/tests/namedArguments/namedArgumentsAndDefaultValues.kt +++ b/compiler/testData/diagnostics/tests/namedArguments/namedArgumentsAndDefaultValues.kt @@ -14,14 +14,14 @@ fun test() { foo(1, "", "") bar(z = "") - bar() - bar("") + bar() + bar("") bar(1, 1, "") bar(1, 1, "") bar(1, z = "") bar(1, z = "", y = 2) bar(z = "", 1) bar(1, zz = "", - zz.foo - ) + zz.foo + ) } diff --git a/compiler/testData/diagnostics/tests/objects/Objects.fir.kt b/compiler/testData/diagnostics/tests/objects/Objects.fir.kt index 87f125e4a1f..3b80ddbbf97 100644 --- a/compiler/testData/diagnostics/tests/objects/Objects.fir.kt +++ b/compiler/testData/diagnostics/tests/objects/Objects.fir.kt @@ -5,13 +5,13 @@ package toplevelObjectDeclarations open fun foo() : Int = 1 } - class T : Foo {} + class T : Foo {} - object A : Foo { + object A : Foo { val x : Int = 2 fun test() : Int { - return x + foo() + return x + foo() } } diff --git a/compiler/testData/diagnostics/tests/override/parameterNames/invokeInFunctionClass.fir.kt b/compiler/testData/diagnostics/tests/override/parameterNames/invokeInFunctionClass.fir.kt index 85d2cad8c5e..485e3318a45 100644 --- a/compiler/testData/diagnostics/tests/override/parameterNames/invokeInFunctionClass.fir.kt +++ b/compiler/testData/diagnostics/tests/override/parameterNames/invokeInFunctionClass.fir.kt @@ -4,24 +4,24 @@ class Function1Impl : (String) -> Unit { fun test1(f: Function1Impl) { f("") - f(p0 = "") + f(p0 = "") f(myParamName = "") f.invoke("") - f.invoke(p0 = "") + f.invoke(p0 = "") f.invoke(myParamName = "") } fun test2(f: (String) -> Unit) { f("") - f(p0 = "") - f(myParamName = "") + f(p0 = "") + f(myParamName = "") f.invoke("") - f.invoke(p0 = "") - f.invoke(myParamName = "") + f.invoke(p0 = "") + f.invoke(myParamName = "") } fun test3(f: String.(String) -> Unit) { "".f("") - "".f(p0 = "") - "".f(zzz = "") + "".f(p0 = "") + "".f(zzz = "") } diff --git a/compiler/testData/diagnostics/tests/override/parameterNames/invokeInFunctionClass.kt b/compiler/testData/diagnostics/tests/override/parameterNames/invokeInFunctionClass.kt index 8ab8ab3fa25..89977700028 100644 --- a/compiler/testData/diagnostics/tests/override/parameterNames/invokeInFunctionClass.kt +++ b/compiler/testData/diagnostics/tests/override/parameterNames/invokeInFunctionClass.kt @@ -4,24 +4,24 @@ class Function1Impl : (String) -> Unit { fun test1(f: Function1Impl) { f("") - f(p0 = "") + f(p0 = "") f(myParamName = "") f.invoke("") - f.invoke(p0 = "") + f.invoke(p0 = "") f.invoke(myParamName = "") } fun test2(f: (String) -> Unit) { f("") - f(p0 = "") - f(myParamName = "") + f(p0 = "") + f(myParamName = "") f.invoke("") - f.invoke(p0 = "") - f.invoke(myParamName = "") + f.invoke(p0 = "") + f.invoke(myParamName = "") } fun test3(f: String.(String) -> Unit) { "".f("") - "".f(p0 = "") - "".f(zzz = "") + "".f(p0 = "") + "".f(zzz = "") } diff --git a/compiler/testData/diagnostics/tests/regressions/kt10633.kt b/compiler/testData/diagnostics/tests/regressions/kt10633.kt index 5c71c8b74a0..aea2daafcfd 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt10633.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt10633.kt @@ -15,5 +15,5 @@ fun main() { 1.set(2, z = 1) 1[2] += 1 - 1.set(2, 1) + 1.set(2, 1) } diff --git a/compiler/testData/diagnostics/tests/regressions/kt5362.kt b/compiler/testData/diagnostics/tests/regressions/kt5362.kt index 01590fb2bfe..150df91af39 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt5362.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt5362.kt @@ -24,7 +24,7 @@ public class Manager { class Task(val callback: Manager.() -> Unit) : Runnable { override public fun run() { - callback() // Manager is not accessible here, but no error is shown + callback() // Manager is not accessible here, but no error is shown } } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/resolve/incompleteConstructorInvocation.fir.kt b/compiler/testData/diagnostics/tests/resolve/incompleteConstructorInvocation.fir.kt index f221efafca1..11d1435e5e4 100644 --- a/compiler/testData/diagnostics/tests/resolve/incompleteConstructorInvocation.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/incompleteConstructorInvocation.fir.kt @@ -4,7 +4,7 @@ class X(provider: () -> V, trackValue: Boolean) { } class B { - val c = X { + val c = X { "e" - } + } } diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/errors/receiverPresenceErrorForInvoke.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/errors/receiverPresenceErrorForInvoke.fir.kt index cc7a06dd453..7f7f7dc821b 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/errors/receiverPresenceErrorForInvoke.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/errors/receiverPresenceErrorForInvoke.fir.kt @@ -1,7 +1,7 @@ fun test1(f: String.() -> Unit) { - (f)() + (f)() - f() + f() } fun test2(f: (Int) -> Int) { diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/errors/receiverPresenceErrorForInvoke.kt b/compiler/testData/diagnostics/tests/resolve/invoke/errors/receiverPresenceErrorForInvoke.kt index 000797a550f..240cd090e88 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/errors/receiverPresenceErrorForInvoke.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/errors/receiverPresenceErrorForInvoke.kt @@ -1,11 +1,11 @@ fun test1(f: String.() -> Unit) { - (f)() + (f)() - f() + f() } fun test2(f: (Int) -> Int) { 1.f(2) 2.(f)(2) -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/errors/wrongReceiverForInvokeOnExpression.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/errors/wrongReceiverForInvokeOnExpression.fir.kt index 7ff5eb86954..9b3fb216876 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/errors/wrongReceiverForInvokeOnExpression.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/errors/wrongReceiverForInvokeOnExpression.fir.kt @@ -6,7 +6,7 @@ fun test1() { fun test2(f: String.(Int) -> Unit) { 11.(f)(1) - 11.(f)() + 11.(f)() } fun test3() { diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/functionExpectedWhenSeveralInvokesExist.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/functionExpectedWhenSeveralInvokesExist.fir.kt index dc70817fa31..9b1d7aae0ad 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/functionExpectedWhenSeveralInvokesExist.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/functionExpectedWhenSeveralInvokesExist.fir.kt @@ -7,7 +7,7 @@ class SomeClass fun test(identifier: SomeClass, fn: String.() -> Unit) { identifier() - identifier(123) + identifier(123) identifier(1, 2) 1.fn() } diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/invokeAndSmartCast.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/invokeAndSmartCast.fir.kt index 3d84cac8b12..2517643820b 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/invokeAndSmartCast.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/invokeAndSmartCast.fir.kt @@ -11,10 +11,10 @@ fun test(a: A) { (a.x)("") with("") { - a.x() + a.x() (a.x)() if (a.x != null) { - a.x() // todo + a.x() // todo (a.x)() } } diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/invokeAndSmartCast.kt b/compiler/testData/diagnostics/tests/resolve/invoke/invokeAndSmartCast.kt index 619c7f51c2a..0a48bdafa2c 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/invokeAndSmartCast.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/invokeAndSmartCast.kt @@ -11,10 +11,10 @@ fun test(a: A) { (a.x)("") with("") { - a.x() + a.x() (a.x)() if (a.x != null) { - a.x() // todo + a.x() // todo (a.x)() } } diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/invokeOnVariableWithExtensionFunctionType.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/invokeOnVariableWithExtensionFunctionType.fir.kt index 3497ac9552f..1be2418d663 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/invokeOnVariableWithExtensionFunctionType.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/invokeOnVariableWithExtensionFunctionType.fir.kt @@ -23,8 +23,8 @@ fun test(a: A, b: B) { } with(b) { - a.foo() - a.(foo)() + a.foo() + a.(foo)() (a.foo)() @@ -65,8 +65,8 @@ fun test(a: A, b: B) { } with(b) { - a.foo() - a.(foo)() + a.foo() + a.(foo)() (a.foo)() diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/invokeOnVariableWithExtensionFunctionType.kt b/compiler/testData/diagnostics/tests/resolve/invoke/invokeOnVariableWithExtensionFunctionType.kt index bed94c1770a..79d36dd2325 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/invokeOnVariableWithExtensionFunctionType.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/invokeOnVariableWithExtensionFunctionType.kt @@ -23,7 +23,7 @@ fun test(a: A, b: B) { } with(b) { - a.foo() + a.foo() a.(foo)() (a.foo)() @@ -65,7 +65,7 @@ fun test(a: A, b: B) { } with(b) { - a.foo() + a.foo() a.(foo)() (a.foo)() diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/kt9805.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/kt9805.fir.kt new file mode 100644 index 00000000000..26d45e3534e --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/invoke/kt9805.fir.kt @@ -0,0 +1,17 @@ +class A { + val foo: B.() -> Unit get() = null!! +} + +class B + +fun test(a: A, b: B) { + with(b) { + a.foo() // here must be error, because a is not extension receiver + + a.foo(this) + + (a.foo)() + + (a.foo)(this) + } +} diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/kt9805.kt b/compiler/testData/diagnostics/tests/resolve/invoke/kt9805.kt index 9b69d4949ea..dc797a1979d 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/kt9805.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/kt9805.kt @@ -1,4 +1,3 @@ -// FIR_IDENTICAL class A { val foo: B.() -> Unit get() = null!! } @@ -7,7 +6,7 @@ class B fun test(a: A, b: B) { with(b) { - a.foo() // here must be error, because a is not extension receiver + a.foo() // here must be error, because a is not extension receiver a.foo(this) diff --git a/compiler/testData/diagnostics/tests/resolve/nestedCalls/completeUnmappedArguments.kt b/compiler/testData/diagnostics/tests/resolve/nestedCalls/completeUnmappedArguments.kt index f936b4c1350..efd8b611cc5 100644 --- a/compiler/testData/diagnostics/tests/resolve/nestedCalls/completeUnmappedArguments.kt +++ b/compiler/testData/diagnostics/tests/resolve/nestedCalls/completeUnmappedArguments.kt @@ -10,6 +10,6 @@ fun test() { bar(foo(xx = zzz(11) { j: Int -> j + 7 })) - bar(zz = foo( - xx = zzz(12) { i: Int -> i + i })) + bar(zz = foo( + xx = zzz(12) { i: Int -> i + i })) } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/resolve/newLineLambda.fir.kt b/compiler/testData/diagnostics/tests/resolve/newLineLambda.fir.kt index 2a7655bfd2e..52f476530fe 100644 --- a/compiler/testData/diagnostics/tests/resolve/newLineLambda.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/newLineLambda.fir.kt @@ -28,7 +28,7 @@ fun testNoArgs() { } fun testLambdaArg() { - oneLambdaArg() + oneLambdaArg() oneLambdaArg {} oneLambdaArg() {} @@ -40,7 +40,7 @@ fun testLambdaArg() { {} ) oneLambdaArg() {} - oneLambdaArg() // {} + oneLambdaArg() // {} oneLambdaArg() /* */ {} oneLambdaArg() /* block @@ -95,7 +95,7 @@ fun testTwoLambdas() { ) fun bar(): () -> Unit { - twoLambdaArgs() + twoLambdaArgs() {} {} diff --git a/compiler/testData/diagnostics/tests/resolve/newLineLambda.kt b/compiler/testData/diagnostics/tests/resolve/newLineLambda.kt index 63691dbed3f..ea12a16a8af 100644 --- a/compiler/testData/diagnostics/tests/resolve/newLineLambda.kt +++ b/compiler/testData/diagnostics/tests/resolve/newLineLambda.kt @@ -28,7 +28,7 @@ fun testNoArgs() { } fun testLambdaArg() { - oneLambdaArg() + oneLambdaArg() oneLambdaArg {} oneLambdaArg() {} @@ -40,7 +40,7 @@ fun testLambdaArg() { {} ) oneLambdaArg() {} - oneLambdaArg() // {} + oneLambdaArg() // {} oneLambdaArg() /* */ {} oneLambdaArg() /* block @@ -95,7 +95,7 @@ fun testTwoLambdas() { ) fun bar(): () -> Unit { - twoLambdaArgs() + twoLambdaArgs() {} {} diff --git a/compiler/testData/diagnostics/tests/scopes/protectedVisibility/constructors.fir.kt b/compiler/testData/diagnostics/tests/scopes/protectedVisibility/constructors.fir.kt index 896f4fff6fb..9ab38cf1aaa 100644 --- a/compiler/testData/diagnostics/tests/scopes/protectedVisibility/constructors.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/protectedVisibility/constructors.fir.kt @@ -7,7 +7,7 @@ open class A protected constructor(x: Int) { } fun foo() { - A() + A() A(1.0) } diff --git a/compiler/testData/diagnostics/tests/script/resolveInitializerOfDestructuringDeclarationOnce.kts b/compiler/testData/diagnostics/tests/script/resolveInitializerOfDestructuringDeclarationOnce.kts index 6e34f6b76b0..c127e4e6133 100644 --- a/compiler/testData/diagnostics/tests/script/resolveInitializerOfDestructuringDeclarationOnce.kts +++ b/compiler/testData/diagnostics/tests/script/resolveInitializerOfDestructuringDeclarationOnce.kts @@ -1,4 +1,4 @@ -val (a, b, c) = A() +val (a, b, c) = A() class A(val a: Int) { operator fun component1() {} diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/errorsOnEmptyDelegationCall.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/errorsOnEmptyDelegationCall.kt index e8fc8dad909..bc585e767a2 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/errorsOnEmptyDelegationCall.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/errorsOnEmptyDelegationCall.kt @@ -3,7 +3,7 @@ open class B0(x: Int) class A0 : B0 { constructor() - constructor(x: Int) : super() + constructor(x: Int) : super() } // -------------------------- diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/noPrimaryConstructor.fir.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/noPrimaryConstructor.fir.kt new file mode 100644 index 00000000000..9f373b0777b --- /dev/null +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/noPrimaryConstructor.fir.kt @@ -0,0 +1,6 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER +class A { + constructor(x: Int) +} + +val x = A() diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/noPrimaryConstructor.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/noPrimaryConstructor.kt index b3dadd7c7ef..4c2fc25be5d 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/noPrimaryConstructor.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/noPrimaryConstructor.kt @@ -1,7 +1,6 @@ -// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER class A { constructor(x: Int) } -val x = A() +val x = A() diff --git a/compiler/testData/diagnostics/tests/sourceCompatibility/apiVersion/typealiasesAsConstructors.fir.kt b/compiler/testData/diagnostics/tests/sourceCompatibility/apiVersion/typealiasesAsConstructors.fir.kt index 7956fb3a45a..2914af2f48d 100644 --- a/compiler/testData/diagnostics/tests/sourceCompatibility/apiVersion/typealiasesAsConstructors.fir.kt +++ b/compiler/testData/diagnostics/tests/sourceCompatibility/apiVersion/typealiasesAsConstructors.fir.kt @@ -13,7 +13,7 @@ open class C2(val x: Int) { typealias C2_Alias = C2 val test1 = C1_Alias() -val test2 = C2_Alias() +val test2 = C2_Alias() class Test3 : C1_Alias() diff --git a/compiler/testData/diagnostics/tests/sourceCompatibility/apiVersion/typealiasesAsConstructors.kt b/compiler/testData/diagnostics/tests/sourceCompatibility/apiVersion/typealiasesAsConstructors.kt index 6c8608a99f1..4e611fc0e84 100644 --- a/compiler/testData/diagnostics/tests/sourceCompatibility/apiVersion/typealiasesAsConstructors.kt +++ b/compiler/testData/diagnostics/tests/sourceCompatibility/apiVersion/typealiasesAsConstructors.kt @@ -13,8 +13,8 @@ open class C2(val x: Int) { typealias C2_Alias = C2 val test1 = C1_Alias() -val test2 = C2_Alias() +val test2 = C2_Alias() class Test3 : C1_Alias() -class Test4 : C2_Alias() \ No newline at end of file +class Test4 : C2_Alias() diff --git a/compiler/testData/diagnostics/tests/typealias/privateInFile.fir.kt b/compiler/testData/diagnostics/tests/typealias/privateInFile.fir.kt index ecdbd0134b3..b64b21dd89f 100644 --- a/compiler/testData/diagnostics/tests/typealias/privateInFile.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/privateInFile.fir.kt @@ -9,14 +9,14 @@ private typealias TA = C private val test1: C = C() private val test1co: C.Companion = C -private val test2: TA = TA() +private val test2: TA = TA() private val test2co = TA // FILE: file2.kt private val test1: C = C() private val test1co: C.Companion = C -private val test2: TA = TA() +private val test2: TA = TA() private val test2co = TA private class C diff --git a/compiler/testData/diagnostics/tests/unsignedTypes/callDefaultConstructorOfUnsignedType.kt b/compiler/testData/diagnostics/tests/unsignedTypes/callDefaultConstructorOfUnsignedType.kt index a191c65a447..35feb097047 100644 --- a/compiler/testData/diagnostics/tests/unsignedTypes/callDefaultConstructorOfUnsignedType.kt +++ b/compiler/testData/diagnostics/tests/unsignedTypes/callDefaultConstructorOfUnsignedType.kt @@ -1 +1 @@ -val foo = UInt() +val foo = UInt() diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/namedArguments.kt b/compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/namedArguments.kt index 31abe4c98b2..f66195aae37 100644 --- a/compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/namedArguments.kt +++ b/compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/namedArguments.kt @@ -3,5 +3,5 @@ fun test(d: dynamic) { d.foo(1, name = "name") - d.foo(1, duplicate = "", duplicate = "") + d.foo(1, duplicate = "", duplicate = "") } diff --git a/compiler/testData/diagnostics/testsWithMultiplatformCompositeAnalysis/defaultArguments/constructor.kt b/compiler/testData/diagnostics/testsWithMultiplatformCompositeAnalysis/defaultArguments/constructor.kt index 7b346fdb6c7..3aa06e3b9b3 100644 --- a/compiler/testData/diagnostics/testsWithMultiplatformCompositeAnalysis/defaultArguments/constructor.kt +++ b/compiler/testData/diagnostics/testsWithMultiplatformCompositeAnalysis/defaultArguments/constructor.kt @@ -4,7 +4,7 @@ expect class Ok(x: Int, y: String = "") fun test() { - Ok() + Ok() Ok(42) Ok(42, "OK") } @@ -15,7 +15,7 @@ fun test() { actual class Ok actual constructor(x: Int, y: String) fun testJvm() { - Ok() + Ok() Ok(42) Ok(42, "OK") } diff --git a/compiler/testData/diagnostics/testsWithMultiplatformCompositeAnalysis/defaultArguments/function.kt b/compiler/testData/diagnostics/testsWithMultiplatformCompositeAnalysis/defaultArguments/function.kt index 6324bf6224d..4f7ddfc0be2 100644 --- a/compiler/testData/diagnostics/testsWithMultiplatformCompositeAnalysis/defaultArguments/function.kt +++ b/compiler/testData/diagnostics/testsWithMultiplatformCompositeAnalysis/defaultArguments/function.kt @@ -16,21 +16,21 @@ expect fun topLevelFunction(x: Int, y: String = "ok") expect fun String.topLevelExtensionFunction(x: Int, y: String = "ok") fun test() { - A().memberFunction() + A().memberFunction() A().memberFunction(42) A().memberFunction(42, "ok") - topLevelFunction() + topLevelFunction() topLevelFunction(42) topLevelFunction(42, "ok") - "".topLevelExtensionFunction() + "".topLevelExtensionFunction() "".topLevelExtensionFunction(42) "".topLevelExtensionFunction(42, "ok") } fun A.test() { - "".companionExtensionFunction() + "".companionExtensionFunction() "".companionExtensionFunction(42) "".companionExtensionFunction(42, "ok") } @@ -53,21 +53,21 @@ actual fun topLevelFunction(x: Int, y: String) = Unit actual fun String.topLevelExtensionFunction(x: Int, y: String) = Unit fun testJvm() { - A().memberFunction() + A().memberFunction() A().memberFunction(42) A().memberFunction(42, "ok") - topLevelFunction() + topLevelFunction() topLevelFunction(42) topLevelFunction(42, "ok") - "".topLevelExtensionFunction() + "".topLevelExtensionFunction() "".topLevelExtensionFunction(42) "".topLevelExtensionFunction(42, "ok") } fun A.testJvm() { - "".companionExtensionFunction() + "".companionExtensionFunction() "".companionExtensionFunction(42) "".companionExtensionFunction(42, "ok") } diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameters/valueArray.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameters/valueArray.kt index a7499621980..9cc668489f0 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameters/valueArray.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameters/valueArray.kt @@ -21,4 +21,4 @@ public @interface A { @A(y = 7) fun test7() {} -@A("8", "9", "10") fun test8() {} +@A("8", "9", "10") fun test8() {} diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/kt11266.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/kt11266.fir.kt new file mode 100644 index 00000000000..2d5a4b2302c --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/kt11266.fir.kt @@ -0,0 +1,3 @@ +// NI_EXPECTED_FILE + +fun foo(first: Array, second: Array) = Pair(first.toCollection(), second.toCollection()) diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/kt11266.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/kt11266.kt index b271a096627..a2baf8bed8f 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/kt11266.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/kt11266.kt @@ -1,4 +1,3 @@ -// FIR_IDENTICAL // NI_EXPECTED_FILE -fun foo(first: Array, second: Array) = Pair(first.toCollection(), second.toCollection()) +fun foo(first: Array, second: Array) = Pair(first.toCollection(), second.toCollection()) diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/kt1558.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/kt1558.fir.kt index bd473f38329..2f97dc0bc23 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/kt1558.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/kt1558.fir.kt @@ -12,13 +12,13 @@ fun List<*>.toArray(ar: Array): Array = ar fun testArrays(ci: List, cii: List?) { val c1: Array = cii.sure().toArray(Array) - val c2: Array = ci.toArray(Array()) + val c2: Array = ci.toArray(Array()) - val c3 = Array() + val c3 = Array() - val c4 = ci.toArray(Array()) + val c4 = ci.toArray(Array()) - val c5 = ci.toArray(Array()) + val c5 = ci.toArray(Array()) checkSubtype>(c1) checkSubtype>(c2) diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/kt1558.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/kt1558.kt index 073c85653b3..419227bb219 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/kt1558.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/kt1558.kt @@ -12,13 +12,13 @@ fun List<*>.toArray(ar: Array): Array = ar fun testArrays(ci: List, cii: List?) { val c1: Array = cii.sure().toArray(Array) - val c2: Array = ci.toArray(Array()) + val c2: Array = ci.toArray(Array()) - val c3 = Array() + val c3 = Array() - val c4 = ci.toArray(Array()) + val c4 = ci.toArray(Array()) - val c5 = ci.toArray(Array()) + val c5 = ci.toArray(Array()) checkSubtype>(c1) checkSubtype>(c2) diff --git a/compiler/testData/diagnostics/testsWithStdLib/regression/ea70880_illegalJvmName.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/regression/ea70880_illegalJvmName.fir.kt index b93ac607a60..ad0fde54de0 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/regression/ea70880_illegalJvmName.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/regression/ea70880_illegalJvmName.fir.kt @@ -1,4 +1,4 @@ -@JvmName() +@JvmName() fun foo() {} @JvmName(42) diff --git a/compiler/testData/diagnostics/testsWithStdLib/regression/ea70880_illegalJvmName.kt b/compiler/testData/diagnostics/testsWithStdLib/regression/ea70880_illegalJvmName.kt index af4743d7b82..a177065677e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/regression/ea70880_illegalJvmName.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/regression/ea70880_illegalJvmName.kt @@ -1,4 +1,4 @@ -@JvmName() +@JvmName() fun foo() {} @JvmName(42) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/5.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/5.fir.kt index 3fd2c9ef798..5e306e1144c 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/5.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/5.fir.kt @@ -6,7 +6,7 @@ class Case1 { inline fun case_1(x: Any?) { if (x is T) { x - x.toByte() + x.toByte() } } }