Process each namespace only once while reporting redeclaration errors

This commit is contained in:
Nikolay Krasko
2013-10-23 18:47:47 +04:00
parent 60ef034330
commit d23ad4f262
3 changed files with 11 additions and 1 deletions
@@ -351,7 +351,7 @@ public class DeclarationResolver {
}
private void checkRedeclarationsInNamespaces() {
for (NamespaceDescriptorImpl descriptor : context.getNamespaceDescriptors().values()) {
for (NamespaceDescriptorImpl descriptor : Sets.newHashSet(context.getNamespaceDescriptors().values())) {
Multimap<Name, DeclarationDescriptor> simpleNameDescriptors = descriptor.getMemberScope().getDeclaredDescriptorsAccessibleBySimpleName();
for (Name name : simpleNameDescriptors.keySet()) {
// Keep only properties with no receiver
@@ -0,0 +1,5 @@
// FILE: a.kt
val <!REDECLARATION, REDECLARATION!>a<!> : Int = 1
// FILE: b.kt
val <!REDECLARATION, REDECLARATION!>a<!> : Int = 1
@@ -4650,6 +4650,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
doTest("compiler/testData/diagnostics/tests/redeclarations/PropertyAndInnerClass.kt");
}
@TestMetadata("RedeclarationInMultiFile.kt")
public void testRedeclarationInMultiFile() throws Exception {
doTest("compiler/testData/diagnostics/tests/redeclarations/RedeclarationInMultiFile.kt");
}
@TestMetadata("Redeclarations.kt")
public void testRedeclarations() throws Exception {
doTest("compiler/testData/diagnostics/tests/redeclarations/Redeclarations.kt");