Fix type parameter bound check in expect-actual checker

Also make TypeParameterUpperBounds a "strong" incompatibility, meaning
that non-actual members from platform module are _not_ going to be
matched to the expected members if this incompatibility exists between
them, and therefore NO_ACTUAL_FOR_EXPECT will be reported on the
expected declaration, instead of ACTUAL_MISSING on the platform member.
This is needed because the difference in type parameter upper bounds can
have effect on the function signature on the platform (e.g. on JVM,
Array<T> -> T[], but Array<T> -> Comparable[] if T : Comparable<T>), and
it would be incorrect to report ACTUAL_MISSING on the member that has
nothing to do with the expected declaration that happens to coincide
with it in everything except type parameter bounds

 #KT-21864 Fixed
This commit is contained in:
Alexander Udalov
2018-01-08 15:35:59 +01:00
parent 8c6b140865
commit f198a28276
11 changed files with 224 additions and 3 deletions
@@ -14290,11 +14290,29 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform/generic"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("functionTypeParameterBounds.kt")
public void testFunctionTypeParameterBounds() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/multiplatform/generic/functionTypeParameterBounds.kt");
doTest(fileName);
}
@TestMetadata("genericMemberBounds.kt")
public void testGenericMemberBounds() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/multiplatform/generic/genericMemberBounds.kt");
doTest(fileName);
}
@TestMetadata("membersInGenericClass.kt")
public void testMembersInGenericClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/multiplatform/generic/membersInGenericClass.kt");
doTest(fileName);
}
@TestMetadata("typeParameterBoundsDifferentOrderActualMissing.kt")
public void testTypeParameterBoundsDifferentOrderActualMissing() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/multiplatform/generic/typeParameterBoundsDifferentOrderActualMissing.kt");
doTest(fileName);
}
}
@TestMetadata("compiler/testData/diagnostics/tests/multiplatform/headerClass")