Put a little more information into the "duplicate provide" error message.
@@ -75,9 +75,11 @@ class ProcessClosurePrimitives extends AbstractPostOrderCallback
"JSC_TOO_MANY_ARGUMENTS_ERROR",
"method \"{0}\" called with more than one argument");
- static final DiagnosticType DUPLICATE_NAMESPACE_ERROR = DiagnosticType.error(
+ static final DiagnosticType DUPLICATE_NAMESPACE_ERROR =
+ DiagnosticType.error(
"JSC_DUPLICATE_NAMESPACE_ERROR",
- "namespace \"{0}\" cannot be provided twice");
+ "namespace \"{0}\" cannot be provided twice\n" //
+ + "Originally provided at {1}");
static final DiagnosticType WEAK_NAMESPACE_TYPE = DiagnosticType.warning(
"JSC_WEAK_NAMESPACE_TYPE",
@@ -503,8 +505,8 @@ class ProcessClosurePrimitives extends AbstractPostOrderCallback
if (!previouslyProvided.isExplicitlyProvided()) {
previouslyProvided.addProvide(parent, t.getModule(), true);
} else {
- compiler.report(
- t.makeError(n, DUPLICATE_NAMESPACE_ERROR, ns));
+ String explicitSourceName = previouslyProvided.explicitNode.getSourceFileName();
+ compiler.report(t.makeError(n, DUPLICATE_NAMESPACE_ERROR, ns, explicitSourceName));
}
} else {
registerAnyProvidedPrefixes(ns, parent, t.getModule());
