Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2377)

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/resolution/members.dart

Issue 14031011: Print the location of duplicated elements. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/sdk/lib/_internal/compiler/implementation/resolution/members.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/resolution/members.dart b/dart/sdk/lib/_internal/compiler/implementation/resolution/members.dart
index 9504271cb652c2ed082e0c52d1e94bb317b7bf18..1b04830a70facfd47d674c5d399e9d900e381176 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/resolution/members.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/resolution/members.dart
@@ -1475,6 +1475,25 @@ class TypeResolver {
AmbiguousElement ambiguous = element;
type = reportFailureAndCreateType(
ambiguous.messageKind, ambiguous.messageArguments);
+ if (ambiguous.existingElement == ambiguous.newElement) {
+ compiler.reportMessage(
+ compiler.spanFromSpannable(ambiguous.existingElement),
+ MessageKind.GENERIC.error(
+ {'text': 'Giladism: you cannot refer to the same element '
ahe 2013/04/17 14:56:25 Perhaps Gilad can help us come up with a better er
+ 'through different imports.'}),
+ Diagnostic.INFO);
+ } else {
+ compiler.reportMessage(
+ compiler.spanFromSpannable(ambiguous.existingElement),
+ MessageKind.GENERIC.error(
+ {'text': 'Note: this is the location of the first element.'}),
+ Diagnostic.INFO);
+ compiler.reportMessage(
+ compiler.spanFromSpannable(ambiguous.newElement),
+ MessageKind.GENERIC.error(
+ {'text': 'Note: this is the location of the second element.'}),
+ Diagnostic.INFO);
+ }
} else if (!element.impliesType()) {
type = reportFailureAndCreateType(
MessageKind.NOT_A_TYPE, {'node': node.typeName});
@@ -1655,6 +1674,26 @@ class ResolverVisitor extends CommonResolverVisitor<Element> {
AmbiguousElement ambiguous = result;
compiler.reportErrorCode(
node, ambiguous.messageKind, ambiguous.messageArguments);
+ if (ambiguous.existingElement == ambiguous.newElement) {
+ compiler.reportMessage(
+ compiler.spanFromSpannable(ambiguous.existingElement),
+ MessageKind.GENERIC.error(
+ {'text': 'Giladism: you cannot refer to the same element '
+ 'through different imports.'}),
+ Diagnostic.INFO);
+ } else {
+ compiler.reportMessage(
+ compiler.spanFromSpannable(ambiguous.existingElement),
+ MessageKind.GENERIC.error(
+ {'text': 'Note: this is the location of the first element.'}),
+ Diagnostic.INFO);
+ compiler.reportMessage(
+ compiler.spanFromSpannable(ambiguous.newElement),
+ MessageKind.GENERIC.error(
+ {'text':
+ 'Note: this is the location of the second element.'}),
+ Diagnostic.INFO);
+ }
return new ErroneousElementX(ambiguous.messageKind,
ambiguous.messageArguments,
name, enclosingElement);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698