Roll forward fix of global var shadow detection
RELNOTES[INC]: Skylark: It is an error to shadow a global variable with a local variable after the global has already been accessed in the function.
--
MOS_MIGRATED_REVID=130014492
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/FunctionTest.java b/src/test/java/com/google/devtools/build/lib/syntax/FunctionTest.java
index d5d3937..3451238 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/FunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/FunctionTest.java
@@ -120,6 +120,18 @@
}
@Test
+ public void testFunctionDefLocalVariableReferencedInCallBeforeAssignment() throws Exception {
+ checkEvalErrorContains("Variable 'a' is referenced before assignment.",
+ "def dummy(x):",
+ " pass",
+ "a = 1",
+ "def func():",
+ " dummy(a)",
+ " a = 2",
+ "func()\n");
+ }
+
+ @Test
public void testFunctionDefLocalVariableReferencedAfterAssignment() throws Exception {
eval("a = 1",
"def func():",