Index: compiler/java/com/google/dart/compiler/resolver/Resolver.java |
diff --git a/compiler/java/com/google/dart/compiler/resolver/Resolver.java b/compiler/java/com/google/dart/compiler/resolver/Resolver.java |
index d556533a32f0934a2d6266ed7c56f47c718da16e..339805f1a837c16fde60e0858542902fc23dff3d 100644 |
--- a/compiler/java/com/google/dart/compiler/resolver/Resolver.java |
+++ b/compiler/java/com/google/dart/compiler/resolver/Resolver.java |
@@ -1197,8 +1197,16 @@ public class Resolver { |
} else { |
element = checkResolvedIdentifier(x, isQualifier, scope, name, element); |
} |
+ |
+ if (ElementKind.of(element) == ElementKind.DUPLICATE) { |
+ DuplicateElement duplicateElement = (DuplicateElement) element; |
+ List<String> locations = duplicateElement.getLocations(); |
+ onError(x, ResolverErrorCode.DUPLICATE_IMPORTED_NAME, element.getName(), locations.size(), |
+ locations); |
+ return null; |
+ } |
- if (inInitializer && (element != null && element.getKind().equals(ElementKind.FIELD))) { |
+ if (inInitializer && ElementKind.of(element) == ElementKind.FIELD) { |
if (!element.getModifiers().isStatic() && !Elements.isTopLevel(element)) { |
onError(x, ResolverErrorCode.CANNOT_ACCESS_FIELD_IN_INIT); |
} |