diff --git a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionDiagnostic.kt b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionDiagnostic.kt index 47ede463b10..51607ffbc56 100644 --- a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionDiagnostic.kt +++ b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionDiagnostic.kt @@ -43,10 +43,10 @@ class TooManyArguments( ) : ResolutionDiagnostic(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR) class NamedArgumentNotAllowed( - override val argument: FirExpression, + val argument: FirExpression, val function: FirFunction, val forbiddenNamedArgumentsTarget: ForbiddenNamedArgumentsTarget -) : InapplicableArgumentDiagnostic() +) : ResolutionDiagnostic(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR) class ArgumentPassedTwice( override val argument: FirExpression, diff --git a/compiler/testData/diagnostics/tests/extensions/variableInvoke.fir.kt b/compiler/testData/diagnostics/tests/extensions/variableInvoke.fir.kt index a940855855a..2a4208f86a3 100644 --- a/compiler/testData/diagnostics/tests/extensions/variableInvoke.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/variableInvoke.fir.kt @@ -6,6 +6,6 @@ class A(foo: Int.() -> Unit) { fun test(foo: Int.(String) -> Unit) { 4.foo("") - 4.foo(p1 = "") + 4.foo(p1 = "") 4.foo(p2 = "") } diff --git a/compiler/testData/diagnostics/tests/namedArguments/disallowForJavaMethods.fir.kt b/compiler/testData/diagnostics/tests/namedArguments/disallowForJavaMethods.fir.kt deleted file mode 100644 index 08e4e4f5075..00000000000 --- a/compiler/testData/diagnostics/tests/namedArguments/disallowForJavaMethods.fir.kt +++ /dev/null @@ -1,27 +0,0 @@ -// FILE: JavaSuperClass.java - -public class JavaSuperClass { - public void foo(int javaName) {} - - public void multipleParameters(int first, long second, String third) {} -} - -// FILE: 1.kt - -fun directInvocation() = JavaSuperClass().foo(javaName = 1) - -open class KotlinSubClass : JavaSuperClass() - -fun viaFakeOverride() = KotlinSubClass().foo(javaName = 2) - -class KotlinSubSubClass : KotlinSubClass() { - override fun foo(kotlinName: Int) {} -} - -fun viaRealOverride() = KotlinSubSubClass().foo(kotlinName = 3) - - -fun unresolvedParameter() = JavaSuperClass().foo(nonexistentName = 4) - - -fun multipleParameters() = JavaSuperClass().multipleParameters(first = 1, second = 2L, third = "3") diff --git a/compiler/testData/diagnostics/tests/namedArguments/disallowForJavaMethods.kt b/compiler/testData/diagnostics/tests/namedArguments/disallowForJavaMethods.kt index 79047c5ef7d..8f905c11438 100644 --- a/compiler/testData/diagnostics/tests/namedArguments/disallowForJavaMethods.kt +++ b/compiler/testData/diagnostics/tests/namedArguments/disallowForJavaMethods.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // FILE: JavaSuperClass.java public class JavaSuperClass { diff --git a/compiler/testData/diagnostics/tests/override/parameterNames/invokeInFunctionClass.fir.kt b/compiler/testData/diagnostics/tests/override/parameterNames/invokeInFunctionClass.fir.kt index 485e3318a45..75bdfb15708 100644 --- a/compiler/testData/diagnostics/tests/override/parameterNames/invokeInFunctionClass.fir.kt +++ b/compiler/testData/diagnostics/tests/override/parameterNames/invokeInFunctionClass.fir.kt @@ -13,15 +13,24 @@ fun test1(f: Function1Impl) { 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 = "") +} + +fun test4(f: (myParamName: String) -> Unit) { + f("") + f(p0 = "") + f(myParamName = "") + f.invoke("") + f.invoke(p0 = "") + f.invoke(myParamName = "") } diff --git a/compiler/testData/diagnostics/tests/override/parameterNames/invokeInFunctionClass.kt b/compiler/testData/diagnostics/tests/override/parameterNames/invokeInFunctionClass.kt index 89977700028..c32283efc04 100644 --- a/compiler/testData/diagnostics/tests/override/parameterNames/invokeInFunctionClass.kt +++ b/compiler/testData/diagnostics/tests/override/parameterNames/invokeInFunctionClass.kt @@ -25,3 +25,12 @@ fun test3(f: String.(String) -> Unit) { "".f(p0 = "") "".f(zzz = "") } + +fun test4(f: (myParamName: String) -> Unit) { + f("") + f(p0 = "") + f(myParamName = "") + f.invoke("") + f.invoke(p0 = "") + f.invoke(myParamName = "") +} diff --git a/compiler/testData/diagnostics/tests/override/parameterNames/invokeInFunctionClass.txt b/compiler/testData/diagnostics/tests/override/parameterNames/invokeInFunctionClass.txt index bffeea32440..d6586b525dc 100644 --- a/compiler/testData/diagnostics/tests/override/parameterNames/invokeInFunctionClass.txt +++ b/compiler/testData/diagnostics/tests/override/parameterNames/invokeInFunctionClass.txt @@ -3,6 +3,7 @@ package public fun test1(/*0*/ f: Function1Impl): kotlin.Unit public fun test2(/*0*/ f: (kotlin.String) -> kotlin.Unit): kotlin.Unit public fun test3(/*0*/ f: kotlin.String.(kotlin.String) -> kotlin.Unit): kotlin.Unit +public fun test4(/*0*/ f: (myParamName: kotlin.String) -> kotlin.Unit): kotlin.Unit public final class Function1Impl : (kotlin.String) -> kotlin.Unit { public constructor Function1Impl()