Skylark: Functions don't need to be declared in order.
--
MOS_MIGRATED_REVID=93515487
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/ValidationTests.java b/src/test/java/com/google/devtools/build/lib/syntax/ValidationTests.java
index edbf550..fbbdbcc 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/ValidationTests.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/ValidationTests.java
@@ -107,14 +107,14 @@
@Test
public void testFunctionDefRecursion() throws Exception {
- checkError("function 'func' does not exist",
+ parse(
"def func():",
" func()\n");
}
@Test
public void testMutualRecursion() throws Exception {
- checkError("function 'bar' does not exist",
+ parse(
"def foo(i):",
" bar(i)",
"def bar(i):",
@@ -123,13 +123,19 @@
}
@Test
- public void testFunctionDoesNotExistInFunctionDef() {
- checkError("function 'foo' does not exist",
+ public void testFunctionDefinedBelow() {
+ parse(
"def bar(): a = foo() + 'a'",
"def foo(): return 1\n");
}
@Test
+ public void testFunctionDoesNotExist() {
+ checkError("function 'foo' does not exist",
+ "def bar(): a = foo() + 'a'");
+ }
+
+ @Test
public void testStructMembersAreImmutable() {
checkError("can only assign to variables and tuples, not to 's.x'",
"s = struct(x = 'a')",