Check componentN functions for overload conflicts

This commit is contained in:
Alexander Udalov
2012-09-03 21:09:28 +04:00
parent fbeaaf5fbb
commit 67211fde40
3 changed files with 12 additions and 1 deletions
@@ -210,7 +210,9 @@ public class OverloadResolver {
if (!overloadable.isSuccess()) {
JetDeclaration jetDeclaration = (JetDeclaration) BindingContextUtils
.descriptorToDeclaration(trace.getBindingContext(), member);
redeclarations.add(Pair.create(jetDeclaration, member));
if (jetDeclaration != null) {
redeclarations.add(Pair.create(jetDeclaration, member));
}
}
}
}
@@ -0,0 +1,4 @@
data class A(val x: Int, val y: String) {
<!CONFLICTING_OVERLOADS!>fun component1()<!> = 1
<!CONFLICTING_OVERLOADS!>fun component2()<!> = 2
}
@@ -977,6 +977,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
doTest("compiler/testData/diagnostics/tests/dataClasses/componentNamedComponent1.kt");
}
@TestMetadata("conflictingOverloads.kt")
public void testConflictingOverloads() throws Exception {
doTest("compiler/testData/diagnostics/tests/dataClasses/conflictingOverloads.kt");
}
@TestMetadata("dataClassOverrideConflict.kt")
public void testDataClassOverrideConflict() throws Exception {
doTest("compiler/testData/diagnostics/tests/dataClasses/dataClassOverrideConflict.kt");