Forbid **kwargs and *args in BUILD files.
Rationale: it makes BUILD files less declarative and makes harder to do
automated changes on BUILD files. It is however still allowed in .bzl
files.
--
MOS_MIGRATED_REVID=94577442
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/ParserTest.java b/src/test/java/com/google/devtools/build/lib/syntax/ParserTest.java
index ef1b9f9..5f33718 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/ParserTest.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/ParserTest.java
@@ -1036,6 +1036,20 @@
}
@Test
+ public void testKwargsForbidden() throws Exception {
+ setFailFast(false);
+ parseFile("func(**dict)");
+ assertContainsEvent("**kwargs arguments are not allowed in BUILD files");
+ }
+
+ @Test
+ public void testArgsForbidden() throws Exception {
+ setFailFast(false);
+ parseFile("func(*array)");
+ assertContainsEvent("*args arguments are not allowed in BUILD files");
+ }
+
+ @Test
public void testOptionalArgBeforeMandatoryArgInFuncDef() throws Exception {
setFailFast(false);
parseFileForSkylark("def func(a, b = 'a', c):\n return 0\n");