Process each namespace only once while reporting redeclaration errors
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user