Use BuiltinFunction for all builtins Replace the uses of AbstractFunction, MixedModeFunction, SkylarkFunction and SimpleSkylarkFunction by BuiltinFunction. -- MOS_MIGRATED_REVID=91763158
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java b/src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java index cc14802..8ca1e9e 100644 --- a/src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java +++ b/src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java
@@ -558,13 +558,13 @@ @Test public void testDictKeysTooManyArgs() throws Exception { - checkEvalError("Invalid number of arguments (expected 0)", + checkEvalError("too many (2) positional arguments in call to keys(self: dict)", "{'a': 1}.keys('abc')"); } @Test public void testDictKeysTooManyKeyArgs() throws Exception { - checkEvalError("Invalid number of arguments (expected 0)", + checkEvalError("unexpected keyword 'arg' in call to keys(self: dict)", "{'a': 1}.keys(arg='abc')"); } @@ -576,8 +576,8 @@ @Test public void testArgBothPosKey() throws Exception { - checkEvalError("replace(this, old, new, maxsplit = null) got multiple values " - + "for keyword argument 'new'", - "'banana'.replace('a', 'o', 3, new=4)"); + checkEvalErrorStartsWith("arguments 'old', 'new' passed both by position and by name " + + "in call to replace(self: string, ", + "'banana'.replace('a', 'o', 3, old='a', new=4)"); } }
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 c7977e4..57371e8 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
@@ -567,7 +567,8 @@ @Test public void testStructPosArgs() throws Exception { - checkEvalError("struct only supports keyword arguments", "x = struct(1, b = 2)\n"); + checkEvalError("struct(**kwarg) does not accept positional arguments, but got 1", + "x = struct(1, b = 2)\n"); } @Test @@ -787,7 +788,9 @@ @Test public void testPrintBadKwargs() throws Exception { - checkEvalError("unexpected keywords: '[end, other]'", "print(end='x', other='y')"); + checkEvalError( + "unexpected keywords 'end', 'other' in call to print(*args, sep: string = \" \")", + "print(end='x', other='y')"); } @Test
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/SkylarkListTest.java b/src/test/java/com/google/devtools/build/lib/syntax/SkylarkListTest.java index 81029b1..2fb179e 100644 --- a/src/test/java/com/google/devtools/build/lib/syntax/SkylarkListTest.java +++ b/src/test/java/com/google/devtools/build/lib/syntax/SkylarkListTest.java
@@ -51,12 +51,12 @@ @Test public void testLazyListIndex() throws Exception { - checkEvalError("Iterator requested", "a = lazy[0]"); + checkEvalError("Illegal argument in call to $index: Iterator requested", "a = lazy[0]"); } @Test public void testLazyListSize() throws Exception { - checkEvalError("Iterator requested", "a = len(lazy)"); + checkEvalError("Illegal argument in call to len: Iterator requested", "a = len(lazy)"); } @Test