Allow the import of private symols from a resolved file
A repository resolved file contains a trace of the actual repository rules
called from a WORKSPACE file. This is the case, even if a repository rule
is not called directly but via macro. Now, macros may refer to symbols
private to the file they are defined in. Therefore, a resolved file may
legitimately contain a reference to a private symbol. However, when using
a resolved file, this import is currently disallowed. Fix this.
Fixes #6835.
Change-Id: Id890388c2c480fcb958e0468bf8da6c02dd46c2a
PiperOrigin-RevId: 232842034
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/Eval.java b/src/main/java/com/google/devtools/build/lib/syntax/Eval.java
index 42e798e..7a4273b 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/Eval.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/Eval.java
@@ -149,7 +149,7 @@
Identifier name = binding.getLocalName();
Identifier declared = binding.getOriginalName();
- if (declared.isPrivate()) {
+ if (declared.isPrivate() && !node.mayLoadInternalSymbols()) {
throw new EvalException(
node.getLocation(),
"symbol '" + declared.getName() + "' is private and cannot be imported.");