Allow impl declarations to have non-stable parameter names

#KT-17027 Fixed
This commit is contained in:
Alexander Udalov
2017-03-23 14:52:06 +03:00
parent 633798db18
commit 116380a826
4 changed files with 57 additions and 1 deletions
@@ -270,7 +270,7 @@ class HeaderImplDeclarationChecker(val moduleToCheck: ModuleDescriptor? = null)
aExtensionReceiver?.type?.let(substitutor) != bExtensionReceiver?.type) return Incompatible.ParameterTypes
if (substitutor(a.returnType) != b.returnType) return Incompatible.ReturnType
if (!equalsBy(aParams, bParams, ValueParameterDescriptor::getName)) return Incompatible.ParameterNames
if (b.hasStableParameterNames() && !equalsBy(aParams, bParams, ValueParameterDescriptor::getName)) return Incompatible.ParameterNames
if (!equalsBy(aTypeParams, bTypeParams, TypeParameterDescriptor::getName)) return Incompatible.TypeParameterNames
if (a.modality != b.modality) return Incompatible.Modality
@@ -0,0 +1,18 @@
// !LANGUAGE: +MultiPlatformProjects
// MODULE: m1-common
// FILE: common.kt
header class Foo {
fun foo(i: Int, d: Double, f: Float): Unit
}
// MODULE: m2-jvm(m1-common)
// FILE: FooImpl.java
public class FooImpl {
public final void foo(int d, double i, float f) {}
}
// FILE: jvm.kt
impl typealias Foo = FooImpl
@@ -0,0 +1,23 @@
// -- Module: <m1-common> --
package
public final header class Foo {
public constructor Foo()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final header fun foo(/*0*/ i: kotlin.Int, /*1*/ d: kotlin.Double, /*2*/ f: kotlin.Float): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
// -- Module: <m2-jvm> --
package
public open class FooImpl {
public constructor FooImpl()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final fun foo(/*0*/ d: kotlin.Int, /*1*/ i: kotlin.Double, /*2*/ f: kotlin.Float): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public typealias Foo = FooImpl
@@ -13237,6 +13237,21 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
}
}
@TestMetadata("compiler/testData/diagnostics/tests/multiplatform/java")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Java extends AbstractDiagnosticsTest {
public void testAllFilesPresentInJava() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform/java"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("parameterNames.kt")
public void testParameterNames() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/multiplatform/java/parameterNames.kt");
doTest(fileName);
}
}
@TestMetadata("compiler/testData/diagnostics/tests/multiplatform/topLevelFun")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)