Chromium Code Reviews| 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); |