diff --git a/compiler/fir/analysis-tests/testData/resolve/arguments/argumentsOfAnnotations.kt b/compiler/fir/analysis-tests/testData/resolve/arguments/argumentsOfAnnotations.kt index 5d460f57658..97efb6d29e9 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 bf5a1904af2..b663afc10d8 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(0, 0.0, false, "") + 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 6995c3c4d61..ec2ce34c183 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 efbfd0fe827..60aa8e6fc51 100644 --- a/compiler/fir/analysis-tests/testData/resolve/arguments/lambda.kt +++ b/compiler/fir/analysis-tests/testData/resolve/arguments/lambda.kt @@ -10,8 +10,8 @@ fun test() { foo({}) // Bad - foo(1) {} - foo(f = {}) {} + foo(1) {} + foo(f = {}) {} // OK bar(1) {} @@ -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/simple.kt b/compiler/fir/analysis-tests/testData/resolve/arguments/simple.kt index 737e67d3b8e..067d60f6a9e 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(first = 0, second = 0.0, third = false, fourth = "", first = 1) + foo(0, 0.0, false, foth = "") } diff --git a/compiler/fir/analysis-tests/testData/resolve/arguments/vararg.fir.txt b/compiler/fir/analysis-tests/testData/resolve/arguments/vararg.fir.txt index bc2b28f3876..ecf6da3fde5 100644 --- a/compiler/fir/analysis-tests/testData/resolve/arguments/vararg.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/arguments/vararg.fir.txt @@ -13,4 +13,5 @@ FILE: vararg.kt R|/bar|(Int(1), z = Boolean(true), vararg(y = *R|kotlin/arrayOf|(vararg(String(my), String(yours))))) #(Int(0), z = Boolean(false), y = String(), y = String(other)) #(Int(0), String(), Boolean(true)) + #(Int(0), z = Boolean(false), y = String(), y = String(other), y = String(yet other)) } diff --git a/compiler/fir/analysis-tests/testData/resolve/arguments/vararg.kt b/compiler/fir/analysis-tests/testData/resolve/arguments/vararg.kt index f42aee5067d..3bf7a428880 100644 --- a/compiler/fir/analysis-tests/testData/resolve/arguments/vararg.kt +++ b/compiler/fir/analysis-tests/testData/resolve/arguments/vararg.kt @@ -12,6 +12,7 @@ fun test() { bar(1, z = true, y = *arrayOf("my", "yours")) - bar(0, z = false, y = "", y = "other") - bar(0, "", true) + bar(0, z = false, y = "", y = "other") + 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 9fc2d8a4684..1924d441068 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 @@ class A class B : A class C(x: Int) -class D : C +class D : C class E : C(10) class F() : C(10) diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/CallBasedInExpressionGenerator.kt b/compiler/fir/analysis-tests/testData/resolve/expresssions/CallBasedInExpressionGenerator.kt index b4f776776d1..f31be1e628c 100644 --- a/compiler/fir/analysis-tests/testData/resolve/expresssions/CallBasedInExpressionGenerator.kt +++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/CallBasedInExpressionGenerator.kt @@ -21,7 +21,7 @@ class CallBasedInExpressionGenerator( gen(argument).let { if (isInverted) Invert(it) else it } private fun gen(argument: StackValue): BranchedValue = - object : BranchedValue(argument, null, argument.type, Opcodes.IFEQ) { + object : BranchedValue(argument, null, argument.type, Opcodes.IFEQ) { override fun putSelector(type: Type, kotlinType: KotlinType?, v: InstructionAdapter) { invokeFunction(v) coerceTo(type, kotlinType, v) diff --git a/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/DiagnosticData.kt b/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/DiagnosticData.kt index 104e5d8cda9..58797850a92 100644 --- a/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/DiagnosticData.kt +++ b/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/DiagnosticData.kt @@ -50,8 +50,9 @@ enum class PositioningStrategy(private val strategy: String? = null) { PRIVATE_MODIFIER, COMPANION_OBJECT, CONST_MODIFIER, - ARRAY_ACCESS - + ARRAY_ACCESS, + NAME_OF_NAMED_ARGUMENT, + VALUE_ARGUMENTS, ; val expressionToCreate get() = "SourceElementPositioningStrategies.${strategy ?: name}" diff --git a/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt b/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt index c9db0cfffc7..518ed74a24f 100644 --- a/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt +++ b/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.fir.checkers.generator.diagnostics import com.intellij.psi.PsiElement import com.intellij.psi.PsiTypeElement +import com.intellij.psi.impl.source.tree.LeafPsiElement import org.jetbrains.kotlin.config.LanguageFeature import org.jetbrains.kotlin.config.LanguageVersionSettings import org.jetbrains.kotlin.contracts.description.EventOccurrencesRange @@ -18,6 +19,7 @@ import org.jetbrains.kotlin.fir.PrivateForInline import org.jetbrains.kotlin.fir.declarations.FirCallableDeclaration import org.jetbrains.kotlin.fir.declarations.FirClass import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration +import org.jetbrains.kotlin.fir.declarations.FirValueParameter import org.jetbrains.kotlin.fir.expressions.FirExpression import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirClassLikeSymbol @@ -219,10 +221,18 @@ object DIAGNOSTICS_LIST : DiagnosticList() { val VARARG_OUTSIDE_PARENTHESES by error() - // TODO: implement a position strategy that highlights the argument name instead of the whole named argument - val NAMED_ARGUMENTS_NOT_ALLOWED by error { + val NAMED_ARGUMENTS_NOT_ALLOWED by error(PositioningStrategy.NAME_OF_NAMED_ARGUMENT) { parameter("forbiddenNamedArgumentsTarget") } + + val NON_VARARG_SPREAD by error() + val ARGUMENT_PASSED_TWICE by error(PositioningStrategy.NAME_OF_NAMED_ARGUMENT) + val TOO_MANY_ARGUMENTS by error { + parameter>("function") + } + val NO_VALUE_FOR_PARAMETER by error(PositioningStrategy.VALUE_ARGUMENTS) { + parameter("violatedParameter") + } } val AMBIGUITY by object : DiagnosticGroup("Ambiguity") { diff --git a/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt b/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt index 52ee9965549..6fd2146d19a 100644 --- a/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt +++ b/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.fir.analysis.diagnostics import com.intellij.psi.PsiElement import com.intellij.psi.PsiTypeElement +import com.intellij.psi.impl.source.tree.LeafPsiElement import org.jetbrains.kotlin.config.LanguageFeature import org.jetbrains.kotlin.config.LanguageVersionSettings import org.jetbrains.kotlin.contracts.description.EventOccurrencesRange @@ -18,6 +19,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.SourceElementPositioningStr import org.jetbrains.kotlin.fir.declarations.FirCallableDeclaration import org.jetbrains.kotlin.fir.declarations.FirClass import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration +import org.jetbrains.kotlin.fir.declarations.FirValueParameter import org.jetbrains.kotlin.fir.expressions.FirExpression import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirClassLikeSymbol @@ -48,6 +50,7 @@ import org.jetbrains.kotlin.psi.KtTypeAlias import org.jetbrains.kotlin.psi.KtTypeParameter import org.jetbrains.kotlin.psi.KtTypeParameterList import org.jetbrains.kotlin.psi.KtTypeReference +import org.jetbrains.kotlin.psi.KtValueArgument import org.jetbrains.kotlin.psi.KtWhenExpression import org.jetbrains.kotlin.resolve.ForbiddenNamedArgumentsTarget @@ -179,7 +182,11 @@ object FirErrors { val INAPPLICABLE_CANDIDATE by error1>(SourceElementPositioningStrategies.REFERENCE_BY_QUALIFIED) val INAPPLICABLE_LATEINIT_MODIFIER by error1(SourceElementPositioningStrategies.LATEINIT_MODIFIER) val VARARG_OUTSIDE_PARENTHESES by error0() - val NAMED_ARGUMENTS_NOT_ALLOWED by error1() + val NAMED_ARGUMENTS_NOT_ALLOWED by error1(SourceElementPositioningStrategies.NAME_OF_NAMED_ARGUMENT) + val NON_VARARG_SPREAD by error0() + val ARGUMENT_PASSED_TWICE by error0(SourceElementPositioningStrategies.NAME_OF_NAMED_ARGUMENT) + val TOO_MANY_ARGUMENTS by error1>() + val NO_VALUE_FOR_PARAMETER by error1(SourceElementPositioningStrategies.VALUE_ARGUMENTS) // Ambiguity val AMBIGUITY by error1>>(SourceElementPositioningStrategies.REFERENCE_BY_QUALIFIED) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDefaultErrorMessages.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDefaultErrorMessages.kt index 82c58820b9e..64f401d036d 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDefaultErrorMessages.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDefaultErrorMessages.kt @@ -38,6 +38,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.ANNOTATION_ARGUME import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.ANNOTATION_CLASS_MEMBER import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.ANNOTATION_PARAMETER_DEFAULT_VALUE_MUST_BE_CONSTANT import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.ANONYMOUS_FUNCTION_PARAMETER_WITH_DEFAULT_VALUE +import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.ARGUMENT_PASSED_TWICE import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.ARRAY_EQUALITY_OPERATOR_CAN_BE_REPLACED_WITH_EQUALS import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.ASSIGNED_VALUE_IS_NEVER_READ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.ASSIGN_OPERATOR_AMBIGUITY @@ -139,6 +140,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NON_FINAL_MEMBER_ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NON_MEMBER_FUNCTION_NO_BODY import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NON_PRIVATE_CONSTRUCTOR_IN_ENUM import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NON_PRIVATE_OR_PROTECTED_CONSTRUCTOR_IN_SEALED +import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NON_VARARG_SPREAD import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NOTHING_TO_OVERRIDE import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NOT_AN_ANNOTATION_CLASS import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NOT_A_LOOP_LABEL @@ -147,6 +149,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NO_ELSE_IN_WHEN import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NO_GET_METHOD import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NO_SET_METHOD import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NO_THIS +import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NO_VALUE_FOR_PARAMETER import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NULLABLE_TYPE_IN_CLASS_LITERAL_LHS import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NULLABLE_TYPE_OF_ANNOTATION_MEMBER import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.OTHER_ERROR @@ -193,6 +196,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SUPERTYPE_NOT_INI import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SUPER_IS_NOT_AN_EXPRESSION import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SUPER_NOT_AVAILABLE import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SYNTAX +import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.TOO_MANY_ARGUMENTS import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.TOPLEVEL_TYPEALIASES_ONLY import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.TYPE_ARGUMENTS_NOT_ALLOWED import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.TYPE_MISMATCH @@ -386,6 +390,10 @@ class FirDefaultErrorMessages : DefaultErrorMessages.Extension { map.put(INAPPLICABLE_LATEINIT_MODIFIER, "''lateinit'' modifier {0}", TO_STRING) map.put(VARARG_OUTSIDE_PARENTHESES, "Passing value as a vararg is only allowed inside a parenthesized argument list") map.put(NAMED_ARGUMENTS_NOT_ALLOWED, "Named arguments are not allowed for {0}", TO_STRING) + map.put(NON_VARARG_SPREAD, "The spread operator (*foo) may only be applied in a vararg position") + map.put(TOO_MANY_ARGUMENTS, "Too many arguments for {0}", FQ_NAMES_IN_TYPES) + map.put(ARGUMENT_PASSED_TWICE, "An argument is already passed for this parameter") + map.put(NO_VALUE_FOR_PARAMETER, "No value passed for parameter ''{0}''", NAME) // Ambiguity map.put(AMBIGUITY, "Ambiguity between candidates: {0}", SYMBOLS) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt index 05021fbd55e..329f5e64892 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/LightTreePositioningStrategies.kt @@ -17,6 +17,7 @@ import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.lexer.KtTokens.MODALITY_MODIFIERS import org.jetbrains.kotlin.lexer.KtTokens.VISIBILITY_MODIFIERS import org.jetbrains.kotlin.psi.KtParameter.VAL_VAR_TOKEN_SET +import org.jetbrains.kotlin.utils.addToStdlib.firstNotNullResult object LightTreePositioningStrategies { val DEFAULT = object : LightTreePositioningStrategy() { @@ -336,6 +337,34 @@ object LightTreePositioningStrategies { } } + val NAME_OF_NAMED_ARGUMENT: LightTreePositioningStrategy = object : LightTreePositioningStrategy() { + override fun mark( + node: LighterASTNode, + startOffset: Int, + endOffset: Int, + tree: FlyweightCapableTreeStructure + ): List { + return tree.findChildByType(node, KtNodeTypes.VALUE_ARGUMENT_NAME)?.let { valueArgumentName -> + markElement(valueArgumentName, startOffset, endOffset, tree, node) + } ?: markElement(node, startOffset, endOffset, tree, node) + } + } + + val VALUE_ARGUMENTS: LightTreePositioningStrategy = object : LightTreePositioningStrategy() { + override fun mark( + node: LighterASTNode, + startOffset: Int, + endOffset: Int, + tree: FlyweightCapableTreeStructure + ): List { + return tree.findDescendantByType(node, KtNodeTypes.VALUE_ARGUMENT_LIST)?.let { valueArgumentList -> + tree.findLastChildByType(valueArgumentList, KtTokens.RPAR)?.let { rpar -> + markElement(rpar, startOffset, endOffset, tree, node) + } + } ?: markElement(node, startOffset, endOffset, tree, node) + } + } + val DOT_BY_QUALIFIED: LightTreePositioningStrategy = object : LightTreePositioningStrategy() { override fun mark( node: LighterASTNode, @@ -604,13 +633,31 @@ fun FlyweightCapableTreeStructure.findChildByType(node: LighterA return childrenRef.get()?.firstOrNull { it?.tokenType == type } } +fun FlyweightCapableTreeStructure.findLastChildByType(node: LighterASTNode, type: IElementType): LighterASTNode? { + val childrenRef = Ref>() + getChildren(node, childrenRef) + return childrenRef.get()?.lastOrNull { it?.tokenType == type } +} + +fun FlyweightCapableTreeStructure.findDescendantByType(node: LighterASTNode, type: IElementType): LighterASTNode? { + val childrenRef = Ref>() + getChildren(node, childrenRef) + return childrenRef.get()?.firstOrNull { it?.tokenType == type } ?: childrenRef.get() + ?.firstNotNullResult { child -> child?.let { findDescendantByType(it, type) } } +} + private fun FlyweightCapableTreeStructure.findChildByType(node: LighterASTNode, type: TokenSet): LighterASTNode? { val childrenRef = Ref>() getChildren(node, childrenRef) return childrenRef.get()?.firstOrNull { it?.tokenType in type } } -private fun FlyweightCapableTreeStructure.findParentOfType(node: LighterASTNode, type: IElementType): LighterASTNode? { +private fun FlyweightCapableTreeStructure.findParentOfType( + node: LighterASTNode, + type: IElementType, + strict: Boolean = true +): LighterASTNode? { + if (!strict && node.tokenType == type) return node var parent = getParent(node) while (parent != null) { if (parent.tokenType == type) return parent diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategies.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategies.kt index 1232989c737..45aa0814db4 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategies.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/SourceElementPositioningStrategies.kt @@ -107,7 +107,7 @@ object SourceElementPositioningStrategies { LightTreePositioningStrategies.OPERATOR, PositioningStrategies.OPERATOR ) - + val PARAMETER_DEFAULT_VALUE = SourceElementPositioningStrategy( LightTreePositioningStrategies.PARAMETER_DEFAULT_VALUE, PositioningStrategies.PARAMETER_DEFAULT_VALUE @@ -118,6 +118,16 @@ object SourceElementPositioningStrategies { PositioningStrategies.PARAMETER_VARARG_MODIFIER ) + val NAME_OF_NAMED_ARGUMENT = SourceElementPositioningStrategy( + LightTreePositioningStrategies.NAME_OF_NAMED_ARGUMENT, + PositioningStrategies.NAME_OF_NAMED_ARGUMENT + ) + + val VALUE_ARGUMENTS = SourceElementPositioningStrategy( + LightTreePositioningStrategies.VALUE_ARGUMENTS, + PositioningStrategies.VALUE_ARGUMENTS + ) + val DOT_BY_QUALIFIED = SourceElementPositioningStrategy( LightTreePositioningStrategies.DOT_BY_QUALIFIED, PositioningStrategies.DOT_BY_QUALIFIED diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/coneDiagnosticToFirDiagnostic.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/coneDiagnosticToFirDiagnostic.kt index e6dab4dc717..f8ed9d4f158 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/coneDiagnosticToFirDiagnostic.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/coneDiagnosticToFirDiagnostic.kt @@ -13,10 +13,7 @@ import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction import org.jetbrains.kotlin.fir.declarations.isInfix import org.jetbrains.kotlin.fir.declarations.isOperator import org.jetbrains.kotlin.fir.diagnostics.* -import org.jetbrains.kotlin.fir.resolve.calls.InapplicableWrongReceiver -import org.jetbrains.kotlin.fir.resolve.calls.NamedArgumentNotAllowed -import org.jetbrains.kotlin.fir.resolve.calls.ResolutionDiagnostic -import org.jetbrains.kotlin.fir.resolve.calls.VarargArgumentOutsideParentheses +import org.jetbrains.kotlin.fir.resolve.calls.* import org.jetbrains.kotlin.fir.resolve.diagnostics.* import org.jetbrains.kotlin.fir.symbols.impl.FirBackingFieldSymbol import org.jetbrains.kotlin.fir.types.* @@ -137,9 +134,13 @@ private fun mapInapplicableCandidateError( rootCause.argument.source ?: qualifiedAccessSource ) is NamedArgumentNotAllowed -> FirErrors.NAMED_ARGUMENTS_NOT_ALLOWED.on( - rootCause.argument.source ?: qualifiedAccessSource, + rootCause.argument.source, rootCause.forbiddenNamedArgumentsTarget ) + is NonVarargSpread -> FirErrors.NON_VARARG_SPREAD.on(rootCause.argument.source?.getChild(KtTokens.MUL, depth = 1)!!) + is ArgumentPassedTwice -> FirErrors.ARGUMENT_PASSED_TWICE.on(rootCause.argument.source) + is TooManyArguments -> FirErrors.TOO_MANY_ARGUMENTS.on(rootCause.argument.source ?: source, rootCause.function) + is NoValueForParameter -> FirErrors.NO_VALUE_FOR_PARAMETER.on(qualifiedAccessSource ?: source, rootCause.valueParameter) else -> null } }.ifEmpty { listOf(FirErrors.INAPPLICABLE_CANDIDATE.on(source, diagnostic.candidate.symbol)) } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt index e8e6f55f69d..3dbb8d075e7 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt @@ -470,6 +470,17 @@ object PositioningStrategies { } } + /** + * Mark the name of a named argument. If the given element is not a named argument or doesn't have a name, then the entire given element + * is marked instead. + */ + @JvmField + val NAME_OF_NAMED_ARGUMENT: PositioningStrategy = object : PositioningStrategy() { + override fun mark(element: KtValueArgument): List { + return markElement(element.getArgumentName() ?: element) + } + } + @JvmField val CALL_ELEMENT: PositioningStrategy = object : PositioningStrategy() { override fun mark(element: PsiElement): List { @@ -563,7 +574,7 @@ object PositioningStrategies { @JvmField val VALUE_ARGUMENTS: PositioningStrategy = object : PositioningStrategy() { override fun mark(element: KtElement): List { - return markElement((element as? KtValueArgumentList)?.rightParenthesis ?: element) + return markElement(element.findDescendantOfType()?.rightParenthesis ?: element) } } diff --git a/compiler/testData/diagnostics/tests/Basic.fir.kt b/compiler/testData/diagnostics/tests/Basic.fir.kt index 8e482deb189..4aabd12047d 100644 --- a/compiler/testData/diagnostics/tests/Basic.fir.kt +++ b/compiler/testData/diagnostics/tests/Basic.fir.kt @@ -10,7 +10,7 @@ fun test() : Int { } class A() { - val x : Int = foo1(xx) + val x : Int = foo1(xx) } fun foo1() {} diff --git a/compiler/testData/diagnostics/tests/CharacterLiterals.fir.kt b/compiler/testData/diagnostics/tests/CharacterLiterals.fir.kt index 249092de44a..6fc44b50729 100644 --- a/compiler/testData/diagnostics/tests/CharacterLiterals.fir.kt +++ b/compiler/testData/diagnostics/tests/CharacterLiterals.fir.kt @@ -2,12 +2,12 @@ fun test(c : Char) { test('') test('a') test('aa') - test('a) + test('a) test(' test(0' test('\n') test('\\') - test('''') + test('''') test('\'') test('\"') } diff --git a/compiler/testData/diagnostics/tests/ConstructorsOfPrimitives.fir.kt b/compiler/testData/diagnostics/tests/ConstructorsOfPrimitives.fir.kt index 08cdb42e71e..8c720027bc5 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 38f66e13e72..e1b90e09b4f 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) @@ -38,7 +38,7 @@ fun main(args : Array) { a.foo1()(a) foo2()({}) - foo2(){} + foo2(){} (foo2()){} (foo2()){x -> } foo2()({x -> }) @@ -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/Nullability.fir.kt b/compiler/testData/diagnostics/tests/Nullability.fir.kt index a59a6f45cfb..00edb39d0e7 100644 --- a/compiler/testData/diagnostics/tests/Nullability.fir.kt +++ b/compiler/testData/diagnostics/tests/Nullability.fir.kt @@ -44,7 +44,7 @@ fun test() { if (out == null || out.println(0) == Unit) { out?.println(1) - out.println(1) + out.println(1) } else { out.println(2) @@ -66,11 +66,11 @@ fun test() { if (1 == 2 || out != null && out.println(1) == Unit) { out?.println(2); - out.println(2); + out.println(2); } else { out?.println(3) - out.println(3) + out.println(3) } out?.println() @@ -103,7 +103,7 @@ fun test() { if (out == null || out.println(0) == Unit) { out?.println(1) - out.println(1) + out.println(1) } else { out.println(2) @@ -127,11 +127,11 @@ fun test() { if (1 == 2 || out != null && out.println(1) == Unit) { out?.println(2); - out.println(2); + out.println(2); } else { out?.println(3) - out.println(3) + out.println(3) } if (1 > 2) { diff --git a/compiler/testData/diagnostics/tests/annotations/AmbigiousAnnotationConstructor.fir.kt b/compiler/testData/diagnostics/tests/annotations/AmbigiousAnnotationConstructor.fir.kt index b2509b87409..4882323d7da 100644 --- a/compiler/testData/diagnostics/tests/annotations/AmbigiousAnnotationConstructor.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/AmbigiousAnnotationConstructor.fir.kt @@ -3,4 +3,4 @@ import java.util.ArrayList @ArrayList(1, 1) fun b() {} @Xoo(x) fun c() {} -@java.lang.Deprecated(x) fun a() {} +@java.lang.Deprecated(x) fun a() {} diff --git a/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter.fir.kt b/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter.fir.kt index 728e16d62e4..07d16e28c0f 100644 --- a/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter.fir.kt @@ -1,10 +1,10 @@ annotation class A1 annotation class A2(val some: Int = 12) -class TopLevelClass<@A1 @A2(3) @A2 @A1(12) @A2("Test") T> { - class InnerClass<@A1 @A2(3) @A2 @A1(12) @A2("Test") T> { +class TopLevelClass<@A1 @A2(3) @A2 @A1(12) @A2("Test") T> { + class InnerClass<@A1 @A2(3) @A2 @A1(12) @A2("Test") T> { fun test() { - class InFun<@A1 @A2(3) @A2 @A1(12) @A2("Test") T> + class InFun<@A1 @A2(3) @A2 @A1(12) @A2("Test") T> } } } diff --git a/compiler/testData/diagnostics/tests/annotations/AnnotationForFunctionTypeParameter.fir.kt b/compiler/testData/diagnostics/tests/annotations/AnnotationForFunctionTypeParameter.fir.kt index edd5a887999..02536a4b56a 100644 --- a/compiler/testData/diagnostics/tests/annotations/AnnotationForFunctionTypeParameter.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/AnnotationForFunctionTypeParameter.fir.kt @@ -1,12 +1,12 @@ annotation class A1 annotation class A2(val some: Int = 12) -fun <@A1 @A2(3) @A2 @A1(12) @A2("Test") T> topFun() = 12 +fun <@A1 @A2(3) @A2 @A1(12) @A2("Test") T> topFun() = 12 class SomeClass { - fun <@A1 @A2(3) @A2 @A1(12) @A2("Test") T> method() = 12 + fun <@A1 @A2(3) @A2 @A1(12) @A2("Test") T> method() = 12 fun foo() { - fun <@A1 @A2(3) @A2 @A1(12) @A2("Test") T> innerFun() = 12 + fun <@A1 @A2(3) @A2 @A1(12) @A2("Test") T> innerFun() = 12 } } diff --git a/compiler/testData/diagnostics/tests/annotations/AnnotationsForPropertyTypeParameter.fir.kt b/compiler/testData/diagnostics/tests/annotations/AnnotationsForPropertyTypeParameter.fir.kt index 01ae94af87d..06ed2a04db2 100644 --- a/compiler/testData/diagnostics/tests/annotations/AnnotationsForPropertyTypeParameter.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/AnnotationsForPropertyTypeParameter.fir.kt @@ -3,10 +3,10 @@ annotation class A1 annotation class A2(val some: Int = 12) -val <@A1 @A2(3) @A2 @A1(12) @A2("Test") T> T.topProp: Int get() = 12 +val <@A1 @A2(3) @A2 @A1(12) @A2("Test") T> T.topProp: Int get() = 12 class SomeClass { - val <@A1 @A2(3) @A2 @A1(12) @A2("Test") T> T.field: Int get() = 12 + val <@A1 @A2(3) @A2 @A1(12) @A2("Test") T> T.field: Int get() = 12 fun foo() { val <@A1 @A2(3) @A2 @A1(12) @A2("Test") T> localVal = 12 diff --git a/compiler/testData/diagnostics/tests/annotations/BasicAnnotations.fir.kt b/compiler/testData/diagnostics/tests/annotations/BasicAnnotations.fir.kt index 3da14fdb2be..ad0b3f65e63 100644 --- a/compiler/testData/diagnostics/tests/annotations/BasicAnnotations.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/BasicAnnotations.fir.kt @@ -3,7 +3,7 @@ annotation class my1(val i : Int) annotation class my2(val i : Int = 0) @my fun foo() {} -@my1 fun foo2() {} +@my1 fun foo2() {} @my1(2) fun foo3() {} @my2() fun foo4() {} @my2 fun foo41() {} diff --git a/compiler/testData/diagnostics/tests/annotations/ConstructorCall.fir.kt b/compiler/testData/diagnostics/tests/annotations/ConstructorCall.fir.kt index 21188f702fe..fa66da3ee58 100644 --- a/compiler/testData/diagnostics/tests/annotations/ConstructorCall.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/ConstructorCall.fir.kt @@ -16,7 +16,7 @@ fun foo() { Ann() val a = Ann() - Ann1() + Ann1() Ann1(1) bar(Ann()) bar(a = Ann()) diff --git a/compiler/testData/diagnostics/tests/annotations/rendering/tooManyArguments.fir.kt b/compiler/testData/diagnostics/tests/annotations/rendering/tooManyArguments.fir.kt index b59d761bfba..a826e31f1d8 100644 --- a/compiler/testData/diagnostics/tests/annotations/rendering/tooManyArguments.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/rendering/tooManyArguments.fir.kt @@ -6,6 +6,6 @@ annotation class Ann(val s: String = "") @Ann("s") fun foo() {} -val bar = foo( - 15 -) \ No newline at end of file +val bar = foo( + 15 +) diff --git a/compiler/testData/diagnostics/tests/callableReference/property/memberFromTopLevel.fir.kt b/compiler/testData/diagnostics/tests/callableReference/property/memberFromTopLevel.fir.kt index 09e82f8d23d..8c32de43108 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/checkArguments/SpreadVarargs.fir.kt b/compiler/testData/diagnostics/tests/checkArguments/SpreadVarargs.fir.kt index 3cd78ff7515..49eac651e55 100644 --- a/compiler/testData/diagnostics/tests/checkArguments/SpreadVarargs.fir.kt +++ b/compiler/testData/diagnostics/tests/checkArguments/SpreadVarargs.fir.kt @@ -10,7 +10,7 @@ fun main() { join(1) join(1, "2") join(1, "2", "3") - join(*1, "2") + join(*1, "2") join(1, *"2") join(x = 1, a = "2") join(x = *1, a = *"2") @@ -30,7 +30,7 @@ fun main() { join(a = a, x = 1) joinG(1, "2") - joinG(*1, "2") + joinG(*1, "2") joinG(1, *"2") joinG(x = 1, a = a) joinG(x = 1, a = "2") @@ -43,7 +43,7 @@ fun main() { joinG(a = a, x = 1) joinG(1, "2") - joinG(*1, "2") + joinG(*1, "2") joinG(1, *"2") joinG(x = 1, a = a) joinG(x = 1, a = "2") @@ -57,7 +57,7 @@ fun main() { val x1 = joinT(1, "2") checkSubtype(x1) - val x2 = joinT(*1, "2") + val x2 = joinT(*1, "2") checkSubtype(x2) val x6 = joinT(1, *a) checkSubtype(x6) diff --git a/compiler/testData/diagnostics/tests/checkArguments/arrayAccessSet.fir.kt b/compiler/testData/diagnostics/tests/checkArguments/arrayAccessSet.fir.kt index bb6927c297d..68cff469d7c 100644 --- a/compiler/testData/diagnostics/tests/checkArguments/arrayAccessSet.fir.kt +++ b/compiler/testData/diagnostics/tests/checkArguments/arrayAccessSet.fir.kt @@ -31,5 +31,5 @@ fun test() { D[0] = "" D[0] = 2.72 - Z[0] = "" + Z[0] = "" } diff --git a/compiler/testData/diagnostics/tests/checkArguments/arrayAccessSetTooManyArgs.fir.kt b/compiler/testData/diagnostics/tests/checkArguments/arrayAccessSetTooManyArgs.fir.kt index 05cb5f29c98..f0c9d7d0646 100644 --- a/compiler/testData/diagnostics/tests/checkArguments/arrayAccessSetTooManyArgs.fir.kt +++ b/compiler/testData/diagnostics/tests/checkArguments/arrayAccessSetTooManyArgs.fir.kt @@ -6,6 +6,6 @@ class A { operator fun set(x: String, value: Int) {} fun d(x: Int) { - this["", 1] = 1 + this["", 1] = 1 } } diff --git a/compiler/testData/diagnostics/tests/checkArguments/kt1897_diagnostic_part.fir.kt b/compiler/testData/diagnostics/tests/checkArguments/kt1897_diagnostic_part.fir.kt index 66fd955733e..b63a5b4f488 100644 --- a/compiler/testData/diagnostics/tests/checkArguments/kt1897_diagnostic_part.fir.kt +++ b/compiler/testData/diagnostics/tests/checkArguments/kt1897_diagnostic_part.fir.kt @@ -9,21 +9,21 @@ fun foo(i: Int, s: String) {} fun test() { - bar(xx) + bar(xx) - bar { } + bar { } - foo("", 1, xx) + foo("", 1, xx) foo(r = xx, i = "", s = "") - foo(i = 1, i = 1, s = 11) + foo(i = 1, i = 1, s = 11) foo("", s = 2) - foo(i = "", s = 2, 33) + foo(i = "", s = 2, 33) - foo("", 1) {} + foo("", 1) {} - foo("", 1) {} {} + foo("", 1) {} {} } diff --git a/compiler/testData/diagnostics/tests/checkArguments/kt1940.fir.kt b/compiler/testData/diagnostics/tests/checkArguments/kt1940.fir.kt deleted file mode 100644 index fa19aede37b..00000000000 --- a/compiler/testData/diagnostics/tests/checkArguments/kt1940.fir.kt +++ /dev/null @@ -1,9 +0,0 @@ -//KT-1940 Exception while repeating named parameters -package kt1940 - -fun foo(i: Int) {} - -fun test() { - foo(1, i = 2) //exception - foo(i = 1, i = 2) //exception -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/checkArguments/kt1940.kt b/compiler/testData/diagnostics/tests/checkArguments/kt1940.kt index 4daa0628c5b..4024916acfd 100644 --- a/compiler/testData/diagnostics/tests/checkArguments/kt1940.kt +++ b/compiler/testData/diagnostics/tests/checkArguments/kt1940.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL //KT-1940 Exception while repeating named parameters package kt1940 diff --git a/compiler/testData/diagnostics/tests/collectionLiterals/collectionLiteralsWithVarargs.fir.kt b/compiler/testData/diagnostics/tests/collectionLiterals/collectionLiteralsWithVarargs.fir.kt index 0f5d04f6d1d..a49fcf77409 100644 --- a/compiler/testData/diagnostics/tests/collectionLiterals/collectionLiteralsWithVarargs.fir.kt +++ b/compiler/testData/diagnostics/tests/collectionLiterals/collectionLiteralsWithVarargs.fir.kt @@ -34,7 +34,7 @@ fun test6() {} annotation class AnnArray(val a: Array) -@AnnArray(*["/"]) +@AnnArray(*["/"]) fun testArray() {} @Ann1([""]) diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/unmappedArgs.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/unmappedArgs.fir.kt deleted file mode 100644 index 0e41d12110d..00000000000 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/unmappedArgs.fir.kt +++ /dev/null @@ -1,5 +0,0 @@ -fun foo(a: Int, b: Int) = a + b - -fun bar(i: Int) { - foo(1, 1, i) -} diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/unmappedArgs.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/unmappedArgs.kt index 24d0f37bbcd..0d91c988ad3 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/unmappedArgs.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/unmappedArgs.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL fun foo(a: Int, b: Int) = a + b fun bar(i: Int) { diff --git a/compiler/testData/diagnostics/tests/controlStructures/kt799.fir.kt b/compiler/testData/diagnostics/tests/controlStructures/kt799.fir.kt index 27b31997a8c..014d78806cc 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/kt799.fir.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/kt799.fir.kt @@ -9,7 +9,7 @@ fun test() { doSmth(if (true) 3 else return) - doSmth(if (true) 3 else return, 1) + doSmth(if (true) 3 else return, 1) } val a : Nothing = return 1 diff --git a/compiler/testData/diagnostics/tests/declarationChecks/kt1193.fir.kt b/compiler/testData/diagnostics/tests/declarationChecks/kt1193.fir.kt index 60dc7517f13..e350c4cb39c 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/kt1193.fir.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/kt1193.fir.kt @@ -5,9 +5,9 @@ package kt1193 enum class MyEnum(val i: Int) { A(12), - B //no error + B //no error } open class A(x: Int = 1) -val x: MyEnum = MyEnum.A \ No newline at end of file +val x: MyEnum = MyEnum.A diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/kt4640.fir.kt b/compiler/testData/diagnostics/tests/delegatedProperty/kt4640.fir.kt index fb962e9965d..596ae0070e3 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/kt4640.fir.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/kt4640.fir.kt @@ -8,4 +8,4 @@ class ValueWrapper() fun setValue(v: Int) { backingValue = v } } -val foo by ValueWrapper() +val foo by ValueWrapper() diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/wrongCountOfParametersInGet.fir.kt b/compiler/testData/diagnostics/tests/delegatedProperty/wrongCountOfParametersInGet.fir.kt index f9f35f93c16..275e1445199 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/wrongCountOfParametersInGet.fir.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/wrongCountOfParametersInGet.fir.kt @@ -3,10 +3,10 @@ import kotlin.reflect.KProperty class A { - val a: Int by Delegate() + val a: Int by Delegate() } -val aTopLevel: Int by Delegate() +val aTopLevel: Int by Delegate() class Delegate { fun getValue(t: Any?, p: KProperty<*>, a: Int): Int { diff --git a/compiler/testData/diagnostics/tests/deprecated/javaDeprecated.fir.kt b/compiler/testData/diagnostics/tests/deprecated/javaDeprecated.fir.kt index c1adba9e67c..4206722ba17 100644 --- a/compiler/testData/diagnostics/tests/deprecated/javaDeprecated.fir.kt +++ b/compiler/testData/diagnostics/tests/deprecated/javaDeprecated.fir.kt @@ -11,6 +11,6 @@ public class A { // FILE: B.kt -class B(private @property:Deprecated val foo: String) : A() { +class B(private @property:Deprecated val foo: String) : A() { override fun getFoo(text: String): String = super.getFoo(text + foo) } diff --git a/compiler/testData/diagnostics/tests/enum/constructorWithDefaultParametersOnly.fir.kt b/compiler/testData/diagnostics/tests/enum/constructorWithDefaultParametersOnly.fir.kt index 863bd73eb40..a53bcadd231 100644 --- a/compiler/testData/diagnostics/tests/enum/constructorWithDefaultParametersOnly.fir.kt +++ b/compiler/testData/diagnostics/tests/enum/constructorWithDefaultParametersOnly.fir.kt @@ -5,8 +5,8 @@ enum class TestOk(val x: String = "OK") { } enum class TestErrors(val x: String) { - TEST1, - TEST2(), + TEST1, + TEST2(), TEST3("Hello") } diff --git a/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.fir.kt b/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.fir.kt index d3f46fa3931..0233c9fc64c 100644 --- a/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.fir.kt @@ -20,7 +20,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 7c839bac648..319b8106ee9 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/throwOutCandidatesByReceiver.fir.kt b/compiler/testData/diagnostics/tests/extensions/throwOutCandidatesByReceiver.fir.kt index cf9e93659a0..abd2550140a 100644 --- a/compiler/testData/diagnostics/tests/extensions/throwOutCandidatesByReceiver.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/throwOutCandidatesByReceiver.fir.kt @@ -20,8 +20,8 @@ fun Int.foo() {} fun test3(s: String?) { "".foo() s.foo() - "".foo(1) - s.foo("a") + "".foo(1) + s.foo("a") } interface A diff --git a/compiler/testData/diagnostics/tests/extensions/variableInvoke.fir.kt b/compiler/testData/diagnostics/tests/extensions/variableInvoke.fir.kt index 150d7b92c6d..8783f3069f7 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(p2 = "") + 4.foo(p1 = "") + 4.foo(p2 = "") } diff --git a/compiler/testData/diagnostics/tests/functionLiterals/higherOrderCallMissingParameters.fir.kt b/compiler/testData/diagnostics/tests/functionLiterals/higherOrderCallMissingParameters.fir.kt index 7b5618f7a0b..2d6edf9f350 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" } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/functionLiterals/kt6541_extensionForExtensionFunction.fir.kt b/compiler/testData/diagnostics/tests/functionLiterals/kt6541_extensionForExtensionFunction.fir.kt index 64001baabe3..e7b45efa280 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/kt6541_extensionForExtensionFunction.fir.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/kt6541_extensionForExtensionFunction.fir.kt @@ -7,4 +7,4 @@ object Z { infix fun add(b : Foo.() -> Unit) : Z = Z } -val t2 = Z add { } { } +val t2 = Z add { } { } diff --git a/compiler/testData/diagnostics/tests/generics/Projections.fir.kt b/compiler/testData/diagnostics/tests/generics/Projections.fir.kt index 65ab20e0ec9..8ef6bf22fe4 100644 --- a/compiler/testData/diagnostics/tests/generics/Projections.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/Projections.fir.kt @@ -50,5 +50,5 @@ fun testInOut() { (null as Inv).outf() (null as Inv<*>).outf() - Inv().outf(1) // Wrong Arg + Inv().outf(1) // Wrong Arg } diff --git a/compiler/testData/diagnostics/tests/imports/ImportOverloadFunctions.fir.kt b/compiler/testData/diagnostics/tests/imports/ImportOverloadFunctions.fir.kt index 05e1b395148..3902c5b8ef1 100644 --- a/compiler/testData/diagnostics/tests/imports/ImportOverloadFunctions.fir.kt +++ b/compiler/testData/diagnostics/tests/imports/ImportOverloadFunctions.fir.kt @@ -32,8 +32,8 @@ fun test() { zero("") one() - one(1) - one("") + one(1) + one("") two() two(1) diff --git a/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/noTypeParamsInReturnType.fir.kt b/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/noTypeParamsInReturnType.fir.kt index 7dcf7de4b6f..2094b38ed5a 100644 --- a/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/noTypeParamsInReturnType.fir.kt +++ b/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/noTypeParamsInReturnType.fir.kt @@ -6,5 +6,5 @@ fun foo(map: Map) : R = throw Exception() fun getMap() : Map = throw Exception() fun bar123() { - foo(getMap( + foo(getMap( } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferences.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferences.fir.kt index c74674862dc..f08d4ca064d 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferences.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferences.fir.kt @@ -39,7 +39,7 @@ fun select(vararg x: R) = x[0] fun poll0(): Flow { return flow { val inv = select(::bar, ::foo) - inv() + inv() } } @@ -123,7 +123,7 @@ fun poll14(flag: Boolean): Flow { fun poll15(flag: Boolean): Flow { return flow { val inv = if (flag) { ::bar5 } else { ::foo5 } - inv() + inv() } } @@ -144,7 +144,7 @@ fun poll17(flag: Boolean): Flow { fun poll2(flag: Boolean): Flow { return flow { val inv = when (flag) { true -> ::bar else -> ::foo } - inv() + inv() } } @@ -193,7 +193,7 @@ fun poll26(flag: Boolean): Flow { fun poll3(flag: Boolean): Flow { return flow { val inv = when (flag) { true -> ::bar false -> ::foo } - inv() + inv() } } @@ -242,7 +242,7 @@ fun poll36(flag: Boolean): Flow { fun poll4(): Flow { return flow { val inv = try { ::bar } finally { ::foo } - inv() + inv() } } @@ -270,7 +270,7 @@ fun poll43(): Flow { fun poll44(): Flow { return flow { val inv = try { ::bar5 } finally { ::foo5 } - inv() + inv() } } @@ -291,7 +291,7 @@ fun poll46(): Flow { fun poll5(): Flow { return flow { val inv = try { ::bar } catch (e: Exception) { ::foo } finally { ::foo } - inv() + inv() } } @@ -319,7 +319,7 @@ fun poll53(): Flow { fun poll54(): Flow { return flow { val inv = try { ::bar5 } catch (e: Exception) { ::foo5 } finally { ::foo5 } - inv() + inv() } } @@ -389,7 +389,7 @@ fun poll66(): Flow { fun poll7(): Flow { return flow { val inv = ::bar!! - inv() + inv() } } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExression.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExression.fir.kt index 5b1aac97a4e..795693120f3 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExression.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesDontCareTypeInBlockExression.fir.kt @@ -72,7 +72,7 @@ fun poll14(flag: Boolean): Flow { fun poll15(flag: Boolean): Flow { return flow { val inv = if (flag) { ::bar5 } else { ::foo5 } - inv() + inv() } } @@ -93,7 +93,7 @@ fun poll17(flag: Boolean): Flow { fun poll4(): Flow { return flow { val inv = try { ::bar } finally { ::foo } - inv() + inv() } } @@ -121,7 +121,7 @@ fun poll43(): Flow { fun poll44(): Flow { return flow { val inv = try { ::bar5 } finally { ::foo5 } - inv() + inv() } } @@ -142,7 +142,7 @@ fun poll46(): Flow { fun poll5(): Flow { return flow { val inv = try { ::bar } catch (e: Exception) { ::foo } finally { ::foo } - inv() + inv() } } @@ -170,7 +170,7 @@ fun poll53(): Flow { fun poll54(): Flow { return flow { val inv = try { ::bar5 } catch (e: Exception) { ::foo5 } finally { ::foo5 } - inv() + inv() } } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesErrorType.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesErrorType.fir.kt index c53792ca78e..6a28975caa9 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesErrorType.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferencesErrorType.fir.kt @@ -38,7 +38,7 @@ class Flow(private val block: suspend FlowCollector.() -> Unit) fun poll7(): Flow { return flow { val inv = ::bar!! - inv() + inv() } } 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 86870041ce5..e39c4d21ce3 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 }) /* @@ -152,7 +152,7 @@ fun main() { select(id(fun String.(x: String) {}), id(fun(x: String, y: String) { }), { x: String, y: String -> x }) // Convert to extension lambda is impossible because the lambda parameter types aren't specified explicitly select(id(fun String.(x: String) {}), id(fun(x: String, y: String) { }), { x, y -> x }) - select(id(id(fun(x: String, y: String) { }), fun String.(x: String) {}), { x, y -> x }) + select(id(id(fun(x: String, y: String) { }), fun String.(x: String) {}), { x, y -> x }) val x26: Int.(String) -> Int = fun (x: String) = 10 // it must be error, see KT-38439 // Receiver must be specified in anonymous function declaration val x27: Int.(String) -> Int = id(fun (x: String) = 10) diff --git a/compiler/testData/diagnostics/tests/inference/invokeLambdaAsFunction.fir.kt b/compiler/testData/diagnostics/tests/inference/invokeLambdaAsFunction.fir.kt index 89d7abf1986..3a895c91a0e 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) \ No newline at end of file +fun test3() = { i -> i }(1) diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2057.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2057.fir.kt index f9d3fdbe345..c5880c7b3e5 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(), ) \ No newline at end of file +val bar = foo("", arrayListOf(), ) +val bar2 = foo("", arrayListOf(), ) diff --git a/compiler/testData/diagnostics/tests/inference/specialCallsWithCallableReferences.fir.kt b/compiler/testData/diagnostics/tests/inference/specialCallsWithCallableReferences.fir.kt index 5f065dee813..3b1681ff5d3 100644 --- a/compiler/testData/diagnostics/tests/inference/specialCallsWithCallableReferences.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/specialCallsWithCallableReferences.fir.kt @@ -30,22 +30,22 @@ fun poll11(flag: Boolean) { fun poll12(flag: Boolean) { val inv = if (flag) { ::bar3 } else { ::foo3 } - inv() + inv() } fun poll13(flag: Boolean) { val inv = if (flag) { ::bar2 } else { ::foo3 } - inv() + inv() } 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) { @@ -60,7 +60,7 @@ fun poll17(flag: Boolean) { fun poll2(flag: Boolean) { val inv = when (flag) { true -> ::bar else -> ::foo } - inv() + inv() } fun poll21(flag: Boolean) { @@ -70,12 +70,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) { @@ -95,7 +95,7 @@ fun poll26(flag: Boolean) { fun poll3(flag: Boolean) { val inv = when (flag) { true -> ::bar false -> ::foo } - inv() + inv() } fun poll31(flag: Boolean) { @@ -105,12 +105,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) { @@ -130,7 +130,7 @@ fun poll36(flag: Boolean) { fun poll4() { val inv = try { ::bar } finally { ::foo } - inv() + inv() } fun poll41() { @@ -140,17 +140,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() { @@ -165,7 +165,7 @@ fun poll46() { fun poll5() { val inv = try { ::bar } catch (e: Exception) { ::foo } finally { ::foo } - inv() + inv() } fun poll51() { @@ -175,17 +175,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() { @@ -235,7 +235,7 @@ fun poll66() { fun poll7() { val inv = ::bar!! - inv() + inv() } fun poll71() { @@ -245,7 +245,7 @@ fun poll71() { fun poll72() { val inv = ::bar3!! - inv() + inv() } fun poll73() { @@ -270,7 +270,7 @@ fun poll76() { fun poll8() { val inv = ::bar in setOf(::foo) - inv() + inv() } fun poll81() { @@ -280,7 +280,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 303bb5a88dc..05527d81a2a 100644 --- a/compiler/testData/diagnostics/tests/inner/innerConstructorsFromQualifiersWithIrrelevantCandidate.fir.kt +++ b/compiler/testData/diagnostics/tests/inner/innerConstructorsFromQualifiersWithIrrelevantCandidate.fir.kt @@ -20,7 +20,7 @@ class Outer { } fun foo() { - Outer.Inner() + Outer.Inner() Outer.Inner(1) Outer.Inner("") } diff --git a/compiler/testData/diagnostics/tests/inner/kt5854.fir.kt b/compiler/testData/diagnostics/tests/inner/kt5854.fir.kt deleted file mode 100644 index ae458b800a5..00000000000 --- a/compiler/testData/diagnostics/tests/inner/kt5854.fir.kt +++ /dev/null @@ -1,11 +0,0 @@ -//KT-5854 Incorrect 'Nested class should be qualified' - -class A { - class Nested { - - } - - fun foo() { - Nested(1) //two errors here, the first one is wrong - } -} diff --git a/compiler/testData/diagnostics/tests/inner/kt5854.kt b/compiler/testData/diagnostics/tests/inner/kt5854.kt index a769b4b6ab5..5a7ffd7070c 100644 --- a/compiler/testData/diagnostics/tests/inner/kt5854.kt +++ b/compiler/testData/diagnostics/tests/inner/kt5854.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL //KT-5854 Incorrect 'Nested class should be qualified' class A { diff --git a/compiler/testData/diagnostics/tests/inner/kt6026.fir.kt b/compiler/testData/diagnostics/tests/inner/kt6026.fir.kt index dc1c5a22692..13f0c4837d9 100644 --- a/compiler/testData/diagnostics/tests/inner/kt6026.fir.kt +++ b/compiler/testData/diagnostics/tests/inner/kt6026.fir.kt @@ -4,5 +4,5 @@ val oo = object { // Forbidden in KT-13510 class Nested - fun f1() = Nested(11) + fun f1() = Nested(11) } diff --git a/compiler/testData/diagnostics/tests/j+k/genericConstructor/recursive.fir.kt b/compiler/testData/diagnostics/tests/j+k/genericConstructor/recursive.fir.kt index d6fae89aa4e..eee0e6ef4dd 100644 --- a/compiler/testData/diagnostics/tests/j+k/genericConstructor/recursive.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/genericConstructor/recursive.fir.kt @@ -9,4 +9,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 5ec15398cd4..5a1ac0a610e 100644 --- a/compiler/testData/diagnostics/tests/kt435.fir.kt +++ b/compiler/testData/diagnostics/tests/kt435.fir.kt @@ -3,5 +3,5 @@ fun Any.foo1() : (i : Int) -> Unit { } fun test(a : Any) { - a.foo1()() + a.foo1()() } diff --git a/compiler/testData/diagnostics/tests/multiplatform/namedArguments.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/namedArguments.fir.kt index 2295c0fe3da..c4145c624e8 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/namedArguments.fir.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/namedArguments.fir.kt @@ -12,10 +12,10 @@ expect class Foo(zzz: Int) { expect fun f2(xxx: Int) fun testCommon() { - Foo(zzz = 0) - val f = Foo(aaa = true) - f.f1(xxx = "") - f2(xxx = 42) + Foo(zzz = 0) + val f = Foo(aaa = true) + f.f1(xxx = "") + f2(xxx = 42) } // MODULE: m2-jvm(m1-common) diff --git a/compiler/testData/diagnostics/tests/namedArguments/ambiguousNamedArguments1.fir.kt b/compiler/testData/diagnostics/tests/namedArguments/ambiguousNamedArguments1.fir.kt index 6620127a9ed..1a4e95387fe 100644 --- a/compiler/testData/diagnostics/tests/namedArguments/ambiguousNamedArguments1.fir.kt +++ b/compiler/testData/diagnostics/tests/namedArguments/ambiguousNamedArguments1.fir.kt @@ -11,8 +11,8 @@ interface D : B, A fun foo(x : C, y : D){ x.foo(x = 0) - x.foo(y = 0) - y.foo(x = 0) + x.foo(y = 0) + y.foo(x = 0) y.foo(y = 0) } @@ -21,7 +21,7 @@ abstract class D1 : A, B fun bar(x : C1, y : D1){ x.foo(x = 0) - x.foo(y = 0) + x.foo(y = 0) y.foo(x = 0) - y.foo(y = 0) -} \ No newline at end of file + y.foo(y = 0) +} diff --git a/compiler/testData/diagnostics/tests/namedArguments/ambiguousNamedArguments2.fir.kt b/compiler/testData/diagnostics/tests/namedArguments/ambiguousNamedArguments2.fir.kt index aae1ca6de24..058d2c1c35a 100644 --- a/compiler/testData/diagnostics/tests/namedArguments/ambiguousNamedArguments2.fir.kt +++ b/compiler/testData/diagnostics/tests/namedArguments/ambiguousNamedArguments2.fir.kt @@ -14,11 +14,11 @@ interface C : A, B { // Warning here, this is correct } fun test(c: C) { - c.foo(b1 = 1, b2 = 1.0) - c.foo(a1 = 1, b2 = 1.0) + c.foo(b1 = 1, b2 = 1.0) + c.foo(a1 = 1, b2 = 1.0) c.foo(a1 = 1, a2 = 1.0) c.foo(a1 = 1, a2 = 1.0) - c.bar(a1 = 1, a2 = 1.0, b3= "") - c.baz(a1 = 1, b2 = 1.0, a3 = "", b4 = 2, a5 = "") - c.baz(a1 = 1, a2 = 1.0, a3 = "", b4 = 2, a5 = "") -} \ No newline at end of file + c.bar(a1 = 1, a2 = 1.0, b3= "") + c.baz(a1 = 1, b2 = 1.0, a3 = "", b4 = 2, a5 = "") + c.baz(a1 = 1, a2 = 1.0, a3 = "", b4 = 2, a5 = "") +} diff --git a/compiler/testData/diagnostics/tests/namedArguments/ambiguousNamedArgumentsWithGenerics1.fir.kt b/compiler/testData/diagnostics/tests/namedArguments/ambiguousNamedArgumentsWithGenerics1.fir.kt index 2ba29a9054f..d6d96276071 100644 --- a/compiler/testData/diagnostics/tests/namedArguments/ambiguousNamedArgumentsWithGenerics1.fir.kt +++ b/compiler/testData/diagnostics/tests/namedArguments/ambiguousNamedArgumentsWithGenerics1.fir.kt @@ -11,5 +11,5 @@ interface C : A, B { // Warning here, this is correct fun test(c: C) { c.foo(a = 1) - c.foo(b = 1) -} \ No newline at end of file + c.foo(b = 1) +} diff --git a/compiler/testData/diagnostics/tests/namedArguments/ambiguousNamedArgumentsWithGenerics2.fir.kt b/compiler/testData/diagnostics/tests/namedArguments/ambiguousNamedArgumentsWithGenerics2.fir.kt index a585e0831b0..f2d84a634b0 100644 --- a/compiler/testData/diagnostics/tests/namedArguments/ambiguousNamedArgumentsWithGenerics2.fir.kt +++ b/compiler/testData/diagnostics/tests/namedArguments/ambiguousNamedArgumentsWithGenerics2.fir.kt @@ -11,5 +11,5 @@ interface C : A, B { // Warning here, this is correct fun test(c: C) { c.foo(a = 1) - c.foo(b = 1) -} \ No newline at end of file + c.foo(b = 1) +} diff --git a/compiler/testData/diagnostics/tests/namedArguments/ambiguousNamedArgumentsWithGenerics3.fir.kt b/compiler/testData/diagnostics/tests/namedArguments/ambiguousNamedArgumentsWithGenerics3.fir.kt index f75dd574cf5..9cd47f23117 100644 --- a/compiler/testData/diagnostics/tests/namedArguments/ambiguousNamedArgumentsWithGenerics3.fir.kt +++ b/compiler/testData/diagnostics/tests/namedArguments/ambiguousNamedArgumentsWithGenerics3.fir.kt @@ -11,5 +11,5 @@ interface C : A, B { // Warning here, this is correct fun test(c: C) { c.foo(a = 1) - c.foo(b = 1) -} \ No newline at end of file + c.foo(b = 1) +} diff --git a/compiler/testData/diagnostics/tests/namedArguments/disallowForJavaConstructor.fir.kt b/compiler/testData/diagnostics/tests/namedArguments/disallowForJavaConstructor.fir.kt deleted file mode 100644 index 66c286e2287..00000000000 --- a/compiler/testData/diagnostics/tests/namedArguments/disallowForJavaConstructor.fir.kt +++ /dev/null @@ -1,9 +0,0 @@ -// FILE: A.java - -public class A { - public A(int x, String y) {} -} - -// FILE: 1.kt - -val test = A(x = 1, y = "2") diff --git a/compiler/testData/diagnostics/tests/namedArguments/disallowForJavaConstructor.kt b/compiler/testData/diagnostics/tests/namedArguments/disallowForJavaConstructor.kt index a437f29e87e..6a1498c091d 100644 --- a/compiler/testData/diagnostics/tests/namedArguments/disallowForJavaConstructor.kt +++ b/compiler/testData/diagnostics/tests/namedArguments/disallowForJavaConstructor.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // FILE: A.java public class A { diff --git a/compiler/testData/diagnostics/tests/namedArguments/disallowForJavaMethods.fir.kt b/compiler/testData/diagnostics/tests/namedArguments/disallowForJavaMethods.fir.kt index 233a5e4f392..c7d4c996df1 100644 --- a/compiler/testData/diagnostics/tests/namedArguments/disallowForJavaMethods.fir.kt +++ b/compiler/testData/diagnostics/tests/namedArguments/disallowForJavaMethods.fir.kt @@ -8,11 +8,11 @@ public class JavaSuperClass { // FILE: 1.kt -fun directInvocation() = JavaSuperClass().foo(javaName = 1) +fun directInvocation() = JavaSuperClass().foo(javaName = 1) open class KotlinSubClass : JavaSuperClass() -fun viaFakeOverride() = KotlinSubClass().foo(javaName = 2) +fun viaFakeOverride() = KotlinSubClass().foo(javaName = 2) class KotlinSubSubClass : KotlinSubClass() { override fun foo(kotlinName: Int) {} @@ -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") +fun multipleParameters() = JavaSuperClass().multipleParameters(first = 1, second = 2L, third = "3") diff --git a/compiler/testData/diagnostics/tests/namedArguments/disallowForSamAdapterConstructor.fir.kt b/compiler/testData/diagnostics/tests/namedArguments/disallowForSamAdapterConstructor.fir.kt deleted file mode 100644 index cbc5d21c433..00000000000 --- a/compiler/testData/diagnostics/tests/namedArguments/disallowForSamAdapterConstructor.fir.kt +++ /dev/null @@ -1,17 +0,0 @@ -// !WITH_NEW_INFERENCE -// FILE: test/J.java - -package test; - -public class J { - public J(String s, Runnable r, Boolean z) { - } -} - -// FILE: usage.kt - -package test - -fun test() { - J("", r = { }, z = false) -} diff --git a/compiler/testData/diagnostics/tests/namedArguments/disallowForSamAdapterConstructor.kt b/compiler/testData/diagnostics/tests/namedArguments/disallowForSamAdapterConstructor.kt index 7ec20ec9c19..28775d449d4 100644 --- a/compiler/testData/diagnostics/tests/namedArguments/disallowForSamAdapterConstructor.kt +++ b/compiler/testData/diagnostics/tests/namedArguments/disallowForSamAdapterConstructor.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !WITH_NEW_INFERENCE // FILE: test/J.java diff --git a/compiler/testData/diagnostics/tests/namedArguments/disallowForSamAdapterFunction.fir.kt b/compiler/testData/diagnostics/tests/namedArguments/disallowForSamAdapterFunction.fir.kt deleted file mode 100644 index 888e9066a68..00000000000 --- a/compiler/testData/diagnostics/tests/namedArguments/disallowForSamAdapterFunction.fir.kt +++ /dev/null @@ -1,17 +0,0 @@ -// !WITH_NEW_INFERENCE -// FILE: test/J.java - -package test; - -public class J { - public static void foo(String s, Runnable r, Boolean z) { - } -} - -// FILE: usage.kt - -package test - -fun test() { - J.foo("", r = { }, z = false) -} diff --git a/compiler/testData/diagnostics/tests/namedArguments/disallowForSamAdapterFunction.kt b/compiler/testData/diagnostics/tests/namedArguments/disallowForSamAdapterFunction.kt index 5d9af118432..2ae3fc32ac4 100644 --- a/compiler/testData/diagnostics/tests/namedArguments/disallowForSamAdapterFunction.kt +++ b/compiler/testData/diagnostics/tests/namedArguments/disallowForSamAdapterFunction.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !WITH_NEW_INFERENCE // FILE: test/J.java diff --git a/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/disabledFeature.fir.kt b/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/disabledFeature.fir.kt index 8c24c4ead05..1b0b5918e3a 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/oldInference.fir.kt b/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/oldInference.fir.kt index e89f7f5e9a5..856d4c143c0 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/simple.fir.kt b/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/simple.fir.kt index fa71be4dd76..0cd7f35115d 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/varargs.fir.kt b/compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/varargs.fir.kt index 87a05f77887..1d9b4c8c58e 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/namedArgumentsAndDefaultValues.fir.kt b/compiler/testData/diagnostics/tests/namedArguments/namedArgumentsAndDefaultValues.fir.kt index cc03090bca2..2374bab59f7 100644 --- a/compiler/testData/diagnostics/tests/namedArguments/namedArgumentsAndDefaultValues.fir.kt +++ b/compiler/testData/diagnostics/tests/namedArguments/namedArgumentsAndDefaultValues.fir.kt @@ -11,17 +11,17 @@ fun test() { foo(b = "") foo(1, "") foo(a = 2) - foo(1, "", "") + 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 = "", + bar(1, zz = "", zz.foo - ) + ) } diff --git a/compiler/testData/diagnostics/tests/namedArguments/namedArgumentsInOverrides.fir.kt b/compiler/testData/diagnostics/tests/namedArguments/namedArgumentsInOverrides.fir.kt index 8b8e9d729d5..09ce8b303e7 100644 --- a/compiler/testData/diagnostics/tests/namedArguments/namedArgumentsInOverrides.fir.kt +++ b/compiler/testData/diagnostics/tests/namedArguments/namedArgumentsInOverrides.fir.kt @@ -18,5 +18,5 @@ fun test1(d: D) { } fun test2(c: C) { - c.foo(b1 = 1, b2 = 1.0) -} \ No newline at end of file + c.foo(b1 = 1, b2 = 1.0) +} diff --git a/compiler/testData/diagnostics/tests/objects/Objects.fir.kt b/compiler/testData/diagnostics/tests/objects/Objects.fir.kt index 1907fec8769..0205ae8790f 100644 --- a/compiler/testData/diagnostics/tests/objects/Objects.fir.kt +++ b/compiler/testData/diagnostics/tests/objects/Objects.fir.kt @@ -4,15 +4,15 @@ 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() } - } + } object B : A {} diff --git a/compiler/testData/diagnostics/tests/operatorsOverloading/InconsistentGetSet.fir.kt b/compiler/testData/diagnostics/tests/operatorsOverloading/InconsistentGetSet.fir.kt index 5933e9a4041..5b151c50d65 100644 --- a/compiler/testData/diagnostics/tests/operatorsOverloading/InconsistentGetSet.fir.kt +++ b/compiler/testData/diagnostics/tests/operatorsOverloading/InconsistentGetSet.fir.kt @@ -34,11 +34,11 @@ object MismatchingArities2 { } fun testMismatchingArities() { - ++MismatchingArities1[0] - MismatchingArities1[0]++ + ++MismatchingArities1[0] + MismatchingArities1[0]++ MismatchingArities1[0] += 1 - ++MismatchingArities2[0] - MismatchingArities2[0]++ - MismatchingArities2[0] += 1 + ++MismatchingArities2[0] + MismatchingArities2[0]++ + MismatchingArities2[0] += 1 } diff --git a/compiler/testData/diagnostics/tests/override/parameterNames/invokeInFunctionClass.fir.kt b/compiler/testData/diagnostics/tests/override/parameterNames/invokeInFunctionClass.fir.kt index 820b4bc9a52..36f23c088f8 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/regressions/kt1736.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt1736.fir.kt deleted file mode 100644 index d81fdfcd2b1..00000000000 --- a/compiler/testData/diagnostics/tests/regressions/kt1736.fir.kt +++ /dev/null @@ -1,10 +0,0 @@ -//KT-1736 AssertionError in CallResolver - -package kt1736 - -object Obj { - fun method() { - } -} - -val x = Obj.method{ -> } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/kt1736.kt b/compiler/testData/diagnostics/tests/regressions/kt1736.kt index e659bdc9a3c..83a0649973e 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt1736.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt1736.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL //KT-1736 AssertionError in CallResolver package kt1736 diff --git a/compiler/testData/diagnostics/tests/resolve/incompleteConstructorInvocation.fir.kt b/compiler/testData/diagnostics/tests/resolve/incompleteConstructorInvocation.fir.kt index 060b8628bd9..f221efafca1 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 68c4faece55..cc7a06dd453 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/wrongReceiverForInvokeOnExpression.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/errors/wrongReceiverForInvokeOnExpression.fir.kt index b92866a8c13..e565821cbee 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/errors/wrongReceiverForInvokeOnExpression.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/errors/wrongReceiverForInvokeOnExpression.fir.kt @@ -7,7 +7,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 221636473b8..42798dd77f2 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/functionExpectedWhenSeveralInvokesExist.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/functionExpectedWhenSeveralInvokesExist.fir.kt @@ -8,7 +8,7 @@ class SomeClass fun test(identifier: SomeClass, fn: String.() -> Unit) { identifier() - identifier(123) - identifier(1, 2) + 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 a95ec3b4fd2..822774ec9a7 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() + (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 f0c2f5f5486..4541883398a 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/invokeOnVariableWithExtensionFunctionType.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/invokeOnVariableWithExtensionFunctionType.fir.kt @@ -24,8 +24,8 @@ fun test(a: A, b: B) { } with(b) { - a.foo() - a.(foo)() + a.foo() + a.(foo)() (a.foo)() @@ -66,8 +66,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/kt9805.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/kt9805.fir.kt deleted file mode 100644 index e4ebeaadaae..00000000000 --- a/compiler/testData/diagnostics/tests/resolve/invoke/kt9805.fir.kt +++ /dev/null @@ -1,17 +0,0 @@ -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 3190359c25b..9b69d4949ea 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/kt9805.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/kt9805.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL class A { val foo: B.() -> Unit get() = null!! } diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/reportFunctionExpectedWhenOneInvokeExist.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/reportFunctionExpectedWhenOneInvokeExist.fir.kt index 9ba5b306186..2632e43b888 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/reportFunctionExpectedWhenOneInvokeExist.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/reportFunctionExpectedWhenOneInvokeExist.fir.kt @@ -7,7 +7,7 @@ class SomeClass fun test(identifier: SomeClass, fn: String.() -> Unit) { identifier() - identifier(123) - identifier(1, 2) + identifier(123) + identifier(1, 2) 1.fn() } diff --git a/compiler/testData/diagnostics/tests/resolve/nestedCalls/completeUnmappedArguments.fir.kt b/compiler/testData/diagnostics/tests/resolve/nestedCalls/completeUnmappedArguments.fir.kt index 7b787bf145c..215bd134df8 100644 --- a/compiler/testData/diagnostics/tests/resolve/nestedCalls/completeUnmappedArguments.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/nestedCalls/completeUnmappedArguments.fir.kt @@ -9,6 +9,6 @@ fun test() { bar(foo(xx = zzz(11) { j: Int -> j + 7 })) - bar(zz = foo( - xx = zzz(12) { i: Int -> i + i })) -} \ No newline at end of file + bar(zz = foo( + xx = zzz(12) { i: Int -> i + i })) +} diff --git a/compiler/testData/diagnostics/tests/resolve/newLineLambda.fir.kt b/compiler/testData/diagnostics/tests/resolve/newLineLambda.fir.kt index 94f3778182d..27d0a82836a 100644 --- a/compiler/testData/diagnostics/tests/resolve/newLineLambda.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/newLineLambda.fir.kt @@ -8,40 +8,40 @@ fun varargFn(vararg args: Int) {} fun testNoArgs() { noArgs() - noArgs {} - noArgs() {} + noArgs {} + noArgs() {} noArgs() // {} - noArgs() /* */ {} - noArgs() /* + noArgs() /* */ {} + noArgs() /* block comment, no new line - */ {} - noArgs() + */ {} + noArgs() /* block comment with new line */ - {} - noArgs() // comment + {} + noArgs() // comment // comment - {} - noArgs() {} {} - noArgs() {} - {} + {} + noArgs() {} {} + noArgs() {} + {} } fun testLambdaArg() { - oneLambdaArg() + oneLambdaArg() oneLambdaArg {} oneLambdaArg() {} - oneLambdaArg() + oneLambdaArg() {} - {} - oneLambdaArg( + {} + oneLambdaArg( {}, - {} + {} ) oneLambdaArg() {} - oneLambdaArg() // {} + oneLambdaArg() // {} oneLambdaArg() /* */ {} oneLambdaArg() /* block @@ -50,21 +50,21 @@ fun testLambdaArg() { oneLambdaArg() // comment // comment {} - oneLambdaArg() {}/* + oneLambdaArg() {}/* block comment, no new line - */ {} - oneLambdaArg() {}/* + */ {} + oneLambdaArg() {}/* block comment with new line */ - {} - oneLambdaArg() {}// comment + {} + oneLambdaArg() {}// comment // comment - {} - oneLambdaArg() {} {} - oneLambdaArg() {} - {} - oneLambdaArg() {} // comment - {} + {} + oneLambdaArg() {} {} + oneLambdaArg() {} + {} + oneLambdaArg() {} // comment + {} } fun testVararg() { @@ -101,9 +101,9 @@ fun testTwoLambdas() { {} return if (true) { - twoLambdaArgs({}) - {} + twoLambdaArgs({}) {} + {} } else { {} } @@ -112,7 +112,7 @@ fun testTwoLambdas() { fun f1(): (() -> Unit) -> (() -> Unit) -> Unit { return { l1 -> - l1() - { l2 -> l2() } + l1() + { l2 -> l2() } } } diff --git a/compiler/testData/diagnostics/tests/scopes/protectedVisibility/constructors.fir.kt b/compiler/testData/diagnostics/tests/scopes/protectedVisibility/constructors.fir.kt index 4793101a9cf..896f4fff6fb 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/secondaryConstructors/ctrsAnnotationResolve.fir.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/ctrsAnnotationResolve.fir.kt index b36ed84abaf..cbd41fe3e7f 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/ctrsAnnotationResolve.fir.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/ctrsAnnotationResolve.fir.kt @@ -5,7 +5,7 @@ annotation class Ann2(val x: Int) class A { @Ann1 constructor() - @Ann2 + @Ann2 constructor(x1: Int) @Ann2(2) constructor(x1: Int, x2: Int) diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/errorsOnEmptyDelegationCall.fir.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/errorsOnEmptyDelegationCall.fir.kt index f8ff7c69fa7..6b195862cf1 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/errorsOnEmptyDelegationCall.fir.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/errorsOnEmptyDelegationCall.fir.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 deleted file mode 100644 index c2b72c83e13..00000000000 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/noPrimaryConstructor.fir.kt +++ /dev/null @@ -1,6 +0,0 @@ -// !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 89665c8bbbc..b3dadd7c7ef 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/noPrimaryConstructor.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/noPrimaryConstructor.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER class A { constructor(x: Int) diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/superAnyNonEmpty.fir.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/superAnyNonEmpty.fir.kt deleted file mode 100644 index 28338060b30..00000000000 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/superAnyNonEmpty.fir.kt +++ /dev/null @@ -1,4 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -class A { - constructor(): super(1) -} diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/superAnyNonEmpty.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/superAnyNonEmpty.kt index 1e31c5345f7..6fa41193d9a 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/superAnyNonEmpty.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/superAnyNonEmpty.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER class A { constructor(): super(1) diff --git a/compiler/testData/diagnostics/tests/smartCasts/intersectionScope/unstableSmartCast.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/intersectionScope/unstableSmartCast.fir.kt index f5fbc030695..5f772e95754 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/intersectionScope/unstableSmartCast.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/intersectionScope/unstableSmartCast.fir.kt @@ -31,7 +31,7 @@ fun test() { x.foo().checkType { _() } x.baz("") x.baz(1).checkType { _() } - x.baz(1, 2) + x.baz(1, 2) x.foobar().checkType { _() } } diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/NoNamedArgsAllowed.fir.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/NoNamedArgsAllowed.fir.kt deleted file mode 100644 index 77c5e172e97..00000000000 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/NoNamedArgsAllowed.fir.kt +++ /dev/null @@ -1,14 +0,0 @@ -// !WITH_NEW_INFERENCE -// FILE: KotlinFile.kt -fun foo(javaClass: JavaClass) { - javaClass.doSomething(p = 1) { - bar() - } -} - -fun bar(){} - -// FILE: JavaClass.java -public class JavaClass { - public void doSomething(int p, Runnable runnable) { runnable.run(); } -} diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/NoNamedArgsAllowed.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/NoNamedArgsAllowed.kt index c0f3ecee47e..f91a4e7d6ae 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/NoNamedArgsAllowed.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/NoNamedArgsAllowed.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !WITH_NEW_INFERENCE // FILE: KotlinFile.kt fun foo(javaClass: JavaClass) { diff --git a/compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord/disabledFeature.fir.kt b/compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord/disabledFeature.fir.kt index e5eae937740..2048c53037b 100644 --- a/compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord/disabledFeature.fir.kt +++ b/compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord/disabledFeature.fir.kt @@ -13,7 +13,7 @@ class MyRec( ) fun foo(jr: JRecord) { - JRecord(1, "") + JRecord(1, "") jr.x() jr.y() diff --git a/compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord/simpleRecords.fir.kt b/compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord/simpleRecords.fir.kt index 58fb8a59523..a6cb2cf77b2 100644 --- a/compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord/simpleRecords.fir.kt +++ b/compiler/testData/diagnostics/tests/testsWithJava15/jvmRecord/simpleRecords.fir.kt @@ -8,7 +8,7 @@ public record MyRecord(int x, CharSequence y) { // FILE: main.kt fun foo(mr: MyRecord) { - MyRecord(1, "") + MyRecord(1, "") mr.x() mr.y() diff --git a/compiler/testData/diagnostics/tests/typealias/privateInFile.fir.kt b/compiler/testData/diagnostics/tests/typealias/privateInFile.fir.kt index 740fcab3ee4..9700eb28880 100644 --- a/compiler/testData/diagnostics/tests/typealias/privateInFile.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/privateInFile.fir.kt @@ -8,14 +8,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/typealias/typeAliasObjectWithInvoke.fir.kt b/compiler/testData/diagnostics/tests/typealias/typeAliasObjectWithInvoke.fir.kt index 7f0db227d54..bb0c017ef31 100644 --- a/compiler/testData/diagnostics/tests/typealias/typeAliasObjectWithInvoke.fir.kt +++ b/compiler/testData/diagnostics/tests/typealias/typeAliasObjectWithInvoke.fir.kt @@ -16,7 +16,7 @@ typealias WI = ObjectWithInvoke typealias CWI = ClassWithCompanionObjectWithInvoke val test1 = WI() -val test2 = WI(null) +val test2 = WI(null) val test3 = CWI() val test4 = CWI("") diff --git a/compiler/testData/diagnostics/tests/varargs/NullableTypeForVarargArgument.fir.kt b/compiler/testData/diagnostics/tests/varargs/NullableTypeForVarargArgument.fir.kt index 037cf7fa0fd..454b4716190 100644 --- a/compiler/testData/diagnostics/tests/varargs/NullableTypeForVarargArgument.fir.kt +++ b/compiler/testData/diagnostics/tests/varargs/NullableTypeForVarargArgument.fir.kt @@ -32,7 +32,7 @@ fun getArr(): Array? = null fun f() { A().foo(1, *args) bar(2, *args) - baz(*args) + baz(*args) } fun g(args: Array?) { @@ -56,7 +56,7 @@ fun h(b: B) { fun k() { A().foo(1, *getArr()) bar(2, *getArr()) - baz(*getArr()) + baz(*getArr()) } fun invokeTest(goodArgs: Array) { diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameters/valueArray.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameters/valueArray.fir.kt deleted file mode 100644 index a0bfa860b25..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameters/valueArray.fir.kt +++ /dev/null @@ -1,23 +0,0 @@ -// FILE: A.java -public @interface A { - String[] value(); - Class x() default Integer.class; - int y(); -} - -// FILE: b.kt -@A("1", "2", "3", y = 1) fun test1() {} - -@A("4", y = 2) fun test2() {} - -@A(*arrayOf("5", "6"), "7", y = 3) fun test3() {} - -@A("1", "2", "3", x = String::class, y = 4) fun test4() {} - -@A("4", y = 5) fun test5() {} - -@A(*arrayOf("5", "6"), "7", x = Any::class, y = 6) fun test6() {} - -@A(y = 7) fun test7() {} - -@A("8", "9", "10") fun test8() {} diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameters/valueArray.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameters/valueArray.kt index 167492f03fd..a7499621980 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameters/valueArray.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameters/valueArray.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // FILE: A.java public @interface A { String[] value(); diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/prohibitPositionedArgument/tooManyArgs.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/prohibitPositionedArgument/tooManyArgs.fir.kt index f3cd8e7f854..ab8d76fde53 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/prohibitPositionedArgument/tooManyArgs.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/prohibitPositionedArgument/tooManyArgs.fir.kt @@ -6,6 +6,6 @@ public @interface A { } // FILE: b.kt -@A(false, +@A(false, 1.0, -false, 1, 2) fun foo1() {} +false, 1, 2) fun foo1() {} diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendExternalFunctions.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendExternalFunctions.fir.kt index d9965faf092..9a5ad755e6c 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendExternalFunctions.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendExternalFunctions.fir.kt @@ -36,7 +36,7 @@ fun test() { severalParams("", 89) checkType { _() } // TODO: should we allow somehow to call with passing continuation explicitly? - severalParams("", 89, 6.9) checkType { _() } + severalParams("", 89, 6.9) checkType { _() } "".stringReceiver(1) Any().anyReceiver(1) diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.fir.kt index 056131d68e4..2663d0780de 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctions.fir.kt @@ -37,7 +37,7 @@ fun test() { severalParams("", 89) checkType { _() } // TODO: should we allow somehow to call with passing continuation explicitly? - severalParams("", 89, 6.9) checkType { _() } - severalParams("", 89, this as Continuation) checkType { _() } + severalParams("", 89, 6.9) checkType { _() } + severalParams("", 89, this as Continuation) checkType { _() } } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/kt11266.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/kt11266.fir.kt deleted file mode 100644 index 13a8675f6c9..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/kt11266.fir.kt +++ /dev/null @@ -1,4 +0,0 @@ -// !WITH_NEW_INFERENCE -// 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 27ada61349a..4649f78fe29 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/kt11266.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/kt11266.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !WITH_NEW_INFERENCE // NI_EXPECTED_FILE diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/kt1558.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/kt1558.fir.kt index f42237eb05a..24f7c942f03 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/regression/ea70880_illegalJvmName.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/regression/ea70880_illegalJvmName.fir.kt index 36209e35b10..e75585de35b 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/regression/ea70880_illegalJvmName.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/regression/ea70880_illegalJvmName.fir.kt @@ -1,8 +1,8 @@ -@JvmName() +@JvmName() fun foo() {} @JvmName(42) fun bar() {} -@JvmName("a", "b") +@JvmName("a", "b") fun baz() {} diff --git a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-4/neg/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-4/neg/1.1.fir.kt index 1190f320a02..2d5dc57c918 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-4/neg/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-4/neg/1.1.fir.kt @@ -17,7 +17,7 @@ fun case1() { } class B() { - val p: String by Delegate() // DELEGATE_SPECIAL_FUNCTION_MISSING expected + val p: String by Delegate() // DELEGATE_SPECIAL_FUNCTION_MISSING expected } class Delegate { @@ -42,7 +42,7 @@ fun case2() { } class B() { - var p: String by Delegate() // DELEGATE_SPECIAL_FUNCTION_MISSING expected + var p: String by Delegate() // DELEGATE_SPECIAL_FUNCTION_MISSING expected } class Delegate { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/13.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/13.fir.kt index 7e2d5a9980f..f167a08ef89 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/13.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/13.fir.kt @@ -23,7 +23,7 @@ fun case_2() { fun case_3() { var x: Class? = Class() x!! - val y = x[if (true) {x=null;0} else 0, x[0]] + val y = x[if (true) {x=null;0} else 0, x[0]] x x.fun_1() } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/26.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/26.fir.kt index fbc59bb9911..17a2d9ccf94 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/26.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/26.fir.kt @@ -41,9 +41,9 @@ fun case_3() { fun case_4() { var x: Class? = Class() x!! - val y = x[if (true) {x=null;0} else 0, x[0]] + val y = x[if (true) {x=null;0} else 0, x[0]] x - x[0].inv() + x[0].inv() } /* diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/36.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/36.fir.kt index c30f0e3ba32..8f65710a4cc 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/36.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/36.fir.kt @@ -50,14 +50,14 @@ fun case_4(x: Class?, y: Any) { fun case_5(x: Class?, y: String?) { x?.prop_12 = y ?: return y - y.toUpperCase() + y.toUpperCase() } // TESTCASE NUMBER: 6 fun case_6(x: Class?, y: String?) { x?.prop_9 = y !is String && throw Exception() y - y.toUpperCase() + y.toUpperCase() } /* @@ -68,7 +68,7 @@ fun case_6(x: Class?, y: String?) { fun case_7(x: Class?, y: String?) { x?.prop_12 = y!! y - y.toUpperCase() + y.toUpperCase() } /* @@ -79,5 +79,5 @@ fun case_7(x: Class?, y: String?) { fun case_8(x: Class?, y: String?) { x?.prop_12 = if (y === null) throw Exception() else "" y - y.toUpperCase() + y.toUpperCase() } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.fir.kt index 7b5dbfaf037..97149066ff2 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.fir.kt @@ -20,7 +20,7 @@ fun case_1(x: Any) { fun case_2(x: Any?) { if (x is Int || x is Float?) { ?")!>x - ?")!>x.toByte() + ?")!>x.toByte() } } @@ -31,7 +31,7 @@ fun case_2(x: Any?) { fun case_3(x: Any?) { if (x is Int? || x is Float) { ?")!>x - ?")!>x.toByte() + ?")!>x.toByte() } } @@ -75,7 +75,7 @@ fun case_6(x: T) { fun case_7(x: T) { if (x is Int? || x is Float?) { ? & T")!>x - ? & T")!>x.toByte() + ? & T")!>x.toByte() } } @@ -86,7 +86,7 @@ fun case_7(x: T) { inline fun case_8(x: T) { if (x is Int? || x is Float?) { ? & T")!>x - ? & T")!>x.toByte() + ? & T")!>x.toByte() } } 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 4ebf1b2ea41..be378bedfc5 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 @@ -7,7 +7,7 @@ class Case1 { inline fun case_1(x: Any?) { if (x is T) { x - x.toByte() + x.toByte() } } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/48.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/48.fir.kt index 350c26fadb8..e07f194c83f 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/48.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/48.fir.kt @@ -24,9 +24,9 @@ fun case_1(x: Any?, y: Any?) { fun case_2(x: Any?, y: Any?) { if (x as Int === y) { x - x.inv(10) + x.inv(10) y - y.inv(10) + y.inv(10) } } @@ -52,8 +52,8 @@ fun case_3(x: Any?, y: Any?) { fun case_4(x: Any?, y: Any?) { if (y === x as Int) { x - x.inv(10) + x.inv(10) y - y.inv(10) + y.inv(10) } } diff --git a/idea/idea-frontend-fir/idea-frontend-fir-generator/src/org/jetbrains/kotlin/idea/frontend/api/fir/generator/HLDiagnosticConverter.kt b/idea/idea-frontend-fir/idea-frontend-fir-generator/src/org/jetbrains/kotlin/idea/frontend/api/fir/generator/HLDiagnosticConverter.kt index e5b5f8d51e2..366496d0f63 100644 --- a/idea/idea-frontend-fir/idea-frontend-fir-generator/src/org/jetbrains/kotlin/idea/frontend/api/fir/generator/HLDiagnosticConverter.kt +++ b/idea/idea-frontend-fir/idea-frontend-fir-generator/src/org/jetbrains/kotlin/idea/frontend/api/fir/generator/HLDiagnosticConverter.kt @@ -19,6 +19,7 @@ import org.jetbrains.kotlin.fir.checkers.generator.diagnostics.DiagnosticParamet import org.jetbrains.kotlin.fir.declarations.FirCallableDeclaration import org.jetbrains.kotlin.fir.declarations.FirClass import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration +import org.jetbrains.kotlin.fir.declarations.FirValueParameter import org.jetbrains.kotlin.fir.expressions.FirExpression import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirClassLikeSymbol @@ -32,6 +33,7 @@ import org.jetbrains.kotlin.idea.frontend.api.types.KtType import org.jetbrains.kotlin.lexer.KtModifierKeywordToken import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.psi.KtExpression +import org.jetbrains.kotlin.psi.KtParameter import kotlin.reflect.KClass import kotlin.reflect.KType import kotlin.reflect.full.createType @@ -138,6 +140,11 @@ private object FirToKtConversionCreator { "org.jetbrains.kotlin.fir.psi" ) ), + FirValueParameter::class to HLFunctionCallConversion( + "firSymbolBuilder.buildSymbol({0})", + KtSymbol::class.createType(), + importsToAdd = listOf("org.jetbrains.kotlin.fir.declarations.FirDeclaration") + ), FirClassLikeSymbol::class to HLFunctionCallConversion( "firSymbolBuilder.classifierBuilder.buildClassLikeSymbol({0}.fir as FirClass<*>)", KtClassLikeSymbol::class.createType(), diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDataClassConverters.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDataClassConverters.kt index 855cf657b88..b6f2f23c2ae 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDataClassConverters.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDataClassConverters.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.idea.frontend.api.fir.diagnostics import com.intellij.psi.PsiElement import com.intellij.psi.PsiTypeElement +import com.intellij.psi.impl.source.tree.LeafPsiElement import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.fir.analysis.diagnostics.FirPsiDiagnostic import org.jetbrains.kotlin.fir.declarations.FirCallableDeclaration @@ -37,6 +38,7 @@ import org.jetbrains.kotlin.psi.KtTypeAlias import org.jetbrains.kotlin.psi.KtTypeParameter import org.jetbrains.kotlin.psi.KtTypeParameterList import org.jetbrains.kotlin.psi.KtTypeReference +import org.jetbrains.kotlin.psi.KtValueArgument import org.jetbrains.kotlin.psi.KtWhenExpression /* @@ -698,6 +700,32 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert token, ) } + add(FirErrors.NON_VARARG_SPREAD) { firDiagnostic -> + NonVarargSpreadImpl( + firDiagnostic as FirPsiDiagnostic<*>, + token, + ) + } + add(FirErrors.ARGUMENT_PASSED_TWICE) { firDiagnostic -> + ArgumentPassedTwiceImpl( + firDiagnostic as FirPsiDiagnostic<*>, + token, + ) + } + add(FirErrors.TOO_MANY_ARGUMENTS) { firDiagnostic -> + TooManyArgumentsImpl( + firSymbolBuilder.callableBuilder.buildCallableSymbol(firDiagnostic.a as FirCallableDeclaration), + firDiagnostic as FirPsiDiagnostic<*>, + token, + ) + } + add(FirErrors.NO_VALUE_FOR_PARAMETER) { firDiagnostic -> + NoValueForParameterImpl( + firSymbolBuilder.buildSymbol(firDiagnostic.a), + firDiagnostic as FirPsiDiagnostic<*>, + token, + ) + } add(FirErrors.AMBIGUITY) { firDiagnostic -> AmbiguityImpl( firDiagnostic.a.map { abstractFirBasedSymbol -> diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDiagnostics.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDiagnostics.kt index 9f806e8fc7b..9d7872fb9b1 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDiagnostics.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDiagnostics.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.idea.frontend.api.fir.diagnostics import com.intellij.psi.PsiElement import com.intellij.psi.PsiTypeElement +import com.intellij.psi.impl.source.tree.LeafPsiElement import org.jetbrains.kotlin.config.LanguageFeature import org.jetbrains.kotlin.config.LanguageVersionSettings import org.jetbrains.kotlin.contracts.description.EventOccurrencesRange @@ -43,6 +44,7 @@ import org.jetbrains.kotlin.psi.KtTypeAlias import org.jetbrains.kotlin.psi.KtTypeParameter import org.jetbrains.kotlin.psi.KtTypeParameterList import org.jetbrains.kotlin.psi.KtTypeReference +import org.jetbrains.kotlin.psi.KtValueArgument import org.jetbrains.kotlin.psi.KtWhenExpression import org.jetbrains.kotlin.resolve.ForbiddenNamedArgumentsTarget @@ -498,11 +500,29 @@ sealed class KtFirDiagnostic : KtDiagnosticWithPsi { override val diagnosticClass get() = VarargOutsideParentheses::class } - abstract class NamedArgumentsNotAllowed : KtFirDiagnostic() { + abstract class NamedArgumentsNotAllowed : KtFirDiagnostic() { override val diagnosticClass get() = NamedArgumentsNotAllowed::class abstract val forbiddenNamedArgumentsTarget: ForbiddenNamedArgumentsTarget } + abstract class NonVarargSpread : KtFirDiagnostic() { + override val diagnosticClass get() = NonVarargSpread::class + } + + abstract class ArgumentPassedTwice : KtFirDiagnostic() { + override val diagnosticClass get() = ArgumentPassedTwice::class + } + + abstract class TooManyArguments : KtFirDiagnostic() { + override val diagnosticClass get() = TooManyArguments::class + abstract val function: KtCallableSymbol + } + + abstract class NoValueForParameter : KtFirDiagnostic() { + override val diagnosticClass get() = NoValueForParameter::class + abstract val violatedParameter: KtSymbol + } + abstract class Ambiguity : KtFirDiagnostic() { override val diagnosticClass get() = Ambiguity::class abstract val candidates: List diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDiagnosticsImpl.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDiagnosticsImpl.kt index ed79f74c14e..b484d46de52 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDiagnosticsImpl.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDiagnosticsImpl.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.idea.frontend.api.fir.diagnostics import com.intellij.psi.PsiElement import com.intellij.psi.PsiTypeElement +import com.intellij.psi.impl.source.tree.LeafPsiElement import org.jetbrains.kotlin.config.LanguageFeature import org.jetbrains.kotlin.config.LanguageVersionSettings import org.jetbrains.kotlin.contracts.description.EventOccurrencesRange @@ -45,6 +46,7 @@ import org.jetbrains.kotlin.psi.KtTypeAlias import org.jetbrains.kotlin.psi.KtTypeParameter import org.jetbrains.kotlin.psi.KtTypeParameterList import org.jetbrains.kotlin.psi.KtTypeReference +import org.jetbrains.kotlin.psi.KtValueArgument import org.jetbrains.kotlin.psi.KtWhenExpression import org.jetbrains.kotlin.resolve.ForbiddenNamedArgumentsTarget @@ -800,7 +802,37 @@ internal class NamedArgumentsNotAllowedImpl( override val forbiddenNamedArgumentsTarget: ForbiddenNamedArgumentsTarget, firDiagnostic: FirPsiDiagnostic<*>, override val token: ValidityToken, -) : KtFirDiagnostic.NamedArgumentsNotAllowed(), KtAbstractFirDiagnostic { +) : KtFirDiagnostic.NamedArgumentsNotAllowed(), KtAbstractFirDiagnostic { + override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic) +} + +internal class NonVarargSpreadImpl( + firDiagnostic: FirPsiDiagnostic<*>, + override val token: ValidityToken, +) : KtFirDiagnostic.NonVarargSpread(), KtAbstractFirDiagnostic { + override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic) +} + +internal class ArgumentPassedTwiceImpl( + firDiagnostic: FirPsiDiagnostic<*>, + override val token: ValidityToken, +) : KtFirDiagnostic.ArgumentPassedTwice(), KtAbstractFirDiagnostic { + override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic) +} + +internal class TooManyArgumentsImpl( + override val function: KtCallableSymbol, + firDiagnostic: FirPsiDiagnostic<*>, + override val token: ValidityToken, +) : KtFirDiagnostic.TooManyArguments(), KtAbstractFirDiagnostic { + override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic) +} + +internal class NoValueForParameterImpl( + override val violatedParameter: KtSymbol, + firDiagnostic: FirPsiDiagnostic<*>, + override val token: ValidityToken, +) : KtFirDiagnostic.NoValueForParameter(), KtAbstractFirDiagnostic { override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic) } diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/simpleCallWithNonMatchingArgs.kt b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/simpleCallWithNonMatchingArgs.kt index 5e1da7ba366..c1bf2f6ba92 100644 --- a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/simpleCallWithNonMatchingArgs.kt +++ b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/simpleCallWithNonMatchingArgs.kt @@ -4,4 +4,6 @@ fun x() { fun foo(){} -// CALL: KtFunctionCall: targetFunction = ERR \ No newline at end of file +// CALL: KtFunctionCall: targetFunction = ERR \ No newline at end of file diff --git a/idea/testData/checker/ExtensionFunctions.fir.kt b/idea/testData/checker/ExtensionFunctions.fir.kt index 2d2e0481e90..fd4f38b2924 100644 --- a/idea/testData/checker/ExtensionFunctions.fir.kt +++ b/idea/testData/checker/ExtensionFunctions.fir.kt @@ -16,7 +16,7 @@ class A infix operator fun A.plus(a : Any) { 1.foo() - true.foo() + true.foo() 1 } diff --git a/idea/testData/checker/Objects.fir.kt b/idea/testData/checker/Objects.fir.kt index 5c096dd5d4b..8325cc56e26 100644 --- a/idea/testData/checker/Objects.fir.kt +++ b/idea/testData/checker/Objects.fir.kt @@ -3,15 +3,15 @@ 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() } - } + } object B : A {} diff --git a/idea/testData/checker/regression/DestructuringDeclarationInLambda.fir.kt b/idea/testData/checker/regression/DestructuringDeclarationInLambda.fir.kt new file mode 100644 index 00000000000..750c4bf50e5 --- /dev/null +++ b/idea/testData/checker/regression/DestructuringDeclarationInLambda.fir.kt @@ -0,0 +1,5 @@ +data class XY(val x: Int, val y: Int) + +fun convert(xy: XY, f: (XY) -> Int) = f(xy) + +fun foo() = convert { (x, y) } diff --git a/idea/testData/checker/regression/DestructuringDeclarationInLambda.kt b/idea/testData/checker/regression/DestructuringDeclarationInLambda.kt index 4680eeed218..3ee969d8e61 100644 --- a/idea/testData/checker/regression/DestructuringDeclarationInLambda.kt +++ b/idea/testData/checker/regression/DestructuringDeclarationInLambda.kt @@ -1,5 +1,3 @@ -// FIR_IDENTICAL - data class XY(val x: Int, val y: Int) fun convert(xy: XY, f: (XY) -> Int) = f(xy) diff --git a/idea/testData/checker/rendering/TypeInferenceError.fir.kt b/idea/testData/checker/rendering/TypeInferenceError.fir.kt index f8e00fefc51..a9504a93565 100644 --- a/idea/testData/checker/rendering/TypeInferenceError.fir.kt +++ b/idea/testData/checker/rendering/TypeInferenceError.fir.kt @@ -4,7 +4,7 @@ fun testMutableMapEntry(map: MutableMap, k1: K, v: V) { } fun foo() { - testMutableMapEntry(hashMap(1 to 'a'), 'b') + testMutableMapEntry(hashMap(1 to 'a'), 'b') } //extract from library