Files
kotlin-fork/compiler/testData/diagnostics/tests/namedArguments/disallowForDelegationToJavaMethods.kt
T
Kirill Rakhman 314784f435 [FIR] Introduce FirDeclarationStatus.hasStableParameterNames
This flag is true by default but is set to false for

- Java methods and constructors
- interface delegation methods that delegate to Java

The NAMED_ARGUMENTS_NOT_ALLOWED logic is mostly refactored to use the
new flag though some custom logic remains for determining the correct
message and to work around a corner case with fake overrides.

The flag is (de)serialized from/to metadata. For backward compatibility
with K1, delegated methods to Java types are deserialized as stable.

^KT-40480 Fixed
2023-02-13 12:09:39 +00:00

25 lines
442 B
Kotlin
Vendored

// FIR_IDENTICAL
// SKIP_TXT
// FILE: JavaInterface.java
public interface JavaInterface {
public void foo(int javaName);
}
// FILE: JavaClass.java
public class JavaSuperClass implements JavaInterface {
@Override
public void foo(int javaName) {}
}
// FILE: 1.kt
class KtClass: JavaInterface by JavaSuperClass()
fun test() {
val ktInstance = KtClass()
ktInstance.foo(<!NAMED_ARGUMENTS_NOT_ALLOWED!>javaName<!> = 1)
}