Allow calling attributes of built-in objects.

If `f` is an object with an attribute `x` which is callable, it's valid now to
call `f.x()` directly (caused a "no function called x" error before because .x
is a attribute, not a method).

--
MOS_MIGRATED_REVID=137698425
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 2fee2c3..dcb927f 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
@@ -29,6 +29,7 @@
 import com.google.devtools.build.lib.skylarkinterface.Param;
 import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable;
 import com.google.devtools.build.lib.skylarkinterface.SkylarkModule;
+import com.google.devtools.build.lib.skylarkinterface.SkylarkSignature;
 import com.google.devtools.build.lib.syntax.SkylarkList.MutableList;
 import com.google.devtools.build.lib.testutil.TestMode;
 import org.junit.Before;
@@ -61,6 +62,13 @@
     }
   }
 
+  @SkylarkSignature(name = "foobar", returnType = String.class, documented = false)
+  static BuiltinFunction foobar = new BuiltinFunction("foobar") {
+    public String invoke() throws EvalException {
+      return "foobar";
+    }
+  };
+
   @SkylarkModule(name = "Mock", doc = "")
   static class Mock {
     @SkylarkCallable(doc = "")
@@ -80,6 +88,10 @@
     public String structField() {
       return "a";
     }
+    @SkylarkCallable(name = "struct_field_callable", doc = "", structField = true)
+    public BuiltinFunction structFieldCallable() {
+      return foobar;
+    }
     @SkylarkCallable(name = "function", doc = "", structField = false)
     public String function() {
       return "a";
@@ -791,10 +803,19 @@
   }
 
   @Test
-  public void testStructAccessAsFuncall() throws Exception {
+  public void testStructAccessAsFuncallNonCallable() throws Exception {
     new SkylarkTest()
         .update("mock", new Mock())
-        .testIfExactError("Type Mock has no function struct_field()", "v = mock.struct_field()");
+        .testIfExactError("'string' object is not callable", "v = mock.struct_field()");
+  }
+
+  @Test
+  public void testStructAccessAsFuncall() throws Exception {
+    foobar.configure(getClass().getDeclaredField("foobar").getAnnotation(SkylarkSignature.class));
+    new SkylarkTest()
+        .update("mock", new Mock())
+        .setUp("v = mock.struct_field_callable()")
+        .testLookup("v", "foobar");
   }
 
   @Test
@@ -1096,6 +1117,7 @@
             "string",
             "string_list",
             "struct_field",
+            "struct_field_callable",
             "value_of",
             "voidfunc",
             "with_params");