Clean up FuncallExpression and document it better
With this change, FuncallExpression defers to DotExpression in many cases instead of re-inventing dot expresssion evaluation. This removes some of the code duplication between these two classes.
Additionally, this avoids creating a BuiltinCallable for selfCall methods of objects. This is a benefit in that it cleans up the code (it removes the need for redundant BuiltinCallable code, to be removed in a future change), and it also prevents creating a superfluous object which is to be immediately discarded.
RELNOTES: None.
PiperOrigin-RevId: 219877592
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 732c4e8..682a8a4 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
@@ -1272,7 +1272,7 @@
new SkylarkTest()
.update("mock", new Mock())
.testIfErrorContains(
- "expected string for 'pos' while calling MockFn but got int instead: 1",
+ "expected value of type 'string' for parameter 'pos', in call to MockFn(int)",
"v = mock(1)");
}
@@ -2175,19 +2175,11 @@
}
@Test
- public void testStructFieldDefinedInValuesAndSkylarkCallable() throws Exception {
- new SkylarkTest()
- .update("val", new SkylarkClassObjectWithSkylarkCallables())
- .setUp("v = val.collision_field")
- .testLookup("v", "fromSkylarkCallable");
- }
-
- @Test
public void testStructMethodDefinedInValuesAndSkylarkCallable() throws Exception {
new SkylarkTest()
.update("val", new SkylarkClassObjectWithSkylarkCallables())
.setUp("v = val.collision_method()")
- .testLookup("v", "fromValues");
+ .testLookup("v", "fromSkylarkCallable");
}
@Test