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/SkylarkEvaluationTest.java b/src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java
index 579268f..43e5ac8 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/SkylarkEvaluationTest.java
@@ -664,6 +664,22 @@
   }
 
   @Test
+  public void testFunctionCallOrdering() throws Exception {
+    eval("def func(): return foo() * 2",
+         "def foo(): return 2",
+         "x = func()");
+    assertThat(lookup("x")).isEqualTo(4);
+  }
+
+  @Test
+  public void testFunctionCallBadOrdering() throws Exception {
+    checkEvalError("name 'foo' is not defined",
+         "def func(): return foo() * 2",
+         "x = func()",
+         "def foo(): return 2");
+  }
+
+  @Test
   public void testNoneTrueFalseInSkylark() throws Exception {
     eval("a = None",
       "b = True",