diff --git a/src/main/java/com/google/devtools/build/lib/packages/StarlarkSemanticsOptions.java b/src/main/java/com/google/devtools/build/lib/packages/StarlarkSemanticsOptions.java index 46c45e80dda43b..939711fffb2e11 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/StarlarkSemanticsOptions.java +++ b/src/main/java/com/google/devtools/build/lib/packages/StarlarkSemanticsOptions.java @@ -490,20 +490,6 @@ public class StarlarkSemanticsOptions extends OptionsBase implements Serializabl + "symbols introduced by load are not implicitly re-exported.") public boolean incompatibleNoTransitiveLoads; - @Option( - name = "incompatible_no_kwargs_in_build_files", - defaultValue = "true", - documentationCategory = OptionDocumentationCategory.STARLARK_SEMANTICS, - effectTags = {OptionEffectTag.BUILD_FILE_SEMANTICS}, - metadataTags = { - OptionMetadataTag.INCOMPATIBLE_CHANGE, - OptionMetadataTag.TRIGGERED_BY_ALL_INCOMPATIBLE_CHANGES - }, - help = - "If set to true, *args and **kwargs are not allowed in BUILD files. See " - + "https://github.com/bazelbuild/bazel/issues/8021") - public boolean incompatibleNoKwargsInBuildFiles; - @Option( name = "incompatible_remap_main_repo", defaultValue = "false", @@ -645,7 +631,6 @@ public StarlarkSemantics toSkylarkSemantics() { .incompatibleExpandDirectories(incompatibleExpandDirectories) .incompatibleNewActionsApi(incompatibleNewActionsApi) .incompatibleNoAttrLicense(incompatibleNoAttrLicense) - .incompatibleNoKwargsInBuildFiles(incompatibleNoKwargsInBuildFiles) .incompatibleNoOutputAttrDefault(incompatibleNoOutputAttrDefault) .incompatibleNoRuleOutputsParam(incompatibleNoRuleOutputsParam) .incompatibleNoSupportToolsInActionInputs(incompatibleNoSupportToolsInActionInputs) diff --git a/src/main/java/com/google/devtools/build/lib/syntax/StarlarkSemantics.java b/src/main/java/com/google/devtools/build/lib/syntax/StarlarkSemantics.java index 9c955dd04cffd2..cd4f4023c69bd9 100644 --- a/src/main/java/com/google/devtools/build/lib/syntax/StarlarkSemantics.java +++ b/src/main/java/com/google/devtools/build/lib/syntax/StarlarkSemantics.java @@ -175,8 +175,6 @@ public boolean flagValue(FlagIdentifier flagIdentifier) { public abstract boolean incompatibleNoAttrLicense(); - public abstract boolean incompatibleNoKwargsInBuildFiles(); - public abstract boolean incompatibleNoOutputAttrDefault(); public abstract boolean incompatibleNoRuleOutputsParam(); @@ -261,7 +259,6 @@ public static Builder builderWithDefaults() { .incompatibleExpandDirectories(true) .incompatibleNewActionsApi(true) .incompatibleNoAttrLicense(true) - .incompatibleNoKwargsInBuildFiles(true) .incompatibleNoOutputAttrDefault(true) .incompatibleNoRuleOutputsParam(false) .incompatibleNoSupportToolsInActionInputs(true) @@ -336,8 +333,6 @@ public abstract Builder incompatibleDisallowRuleExecutionPlatformConstraintsAllo public abstract Builder incompatibleNewActionsApi(boolean value); - public abstract Builder incompatibleNoKwargsInBuildFiles(boolean value); - public abstract Builder incompatibleNoAttrLicense(boolean value); public abstract Builder incompatibleNoOutputAttrDefault(boolean value); diff --git a/src/main/java/com/google/devtools/build/lib/syntax/ValidationEnvironment.java b/src/main/java/com/google/devtools/build/lib/syntax/ValidationEnvironment.java index 6233bfdb40499b..ada8a87d4fbbd7 100644 --- a/src/main/java/com/google/devtools/build/lib/syntax/ValidationEnvironment.java +++ b/src/main/java/com/google/devtools/build/lib/syntax/ValidationEnvironment.java @@ -460,9 +460,7 @@ public void visit(FuncallExpression node) { + "explicitly."); } } - if (env.getSemantics().incompatibleNoKwargsInBuildFiles()) { - super.visit(node); - } + super.visit(node); } }; checker.visitAll(statements); diff --git a/src/test/java/com/google/devtools/build/lib/packages/SkylarkSemanticsConsistencyTest.java b/src/test/java/com/google/devtools/build/lib/packages/SkylarkSemanticsConsistencyTest.java index 86f9ccc97eaf97..a7d4a661624a21 100644 --- a/src/test/java/com/google/devtools/build/lib/packages/SkylarkSemanticsConsistencyTest.java +++ b/src/test/java/com/google/devtools/build/lib/packages/SkylarkSemanticsConsistencyTest.java @@ -153,7 +153,6 @@ private static StarlarkSemanticsOptions buildRandomOptions(Random rand) throws E "--incompatible_expand_directories=" + rand.nextBoolean(), "--incompatible_new_actions_api=" + rand.nextBoolean(), "--incompatible_no_attr_license=" + rand.nextBoolean(), - "--incompatible_no_kwargs_in_build_files=" + rand.nextBoolean(), "--incompatible_no_output_attr_default=" + rand.nextBoolean(), "--incompatible_no_rule_outputs_param=" + rand.nextBoolean(), "--incompatible_no_support_tools_in_action_inputs=" + rand.nextBoolean(), @@ -206,7 +205,6 @@ private static StarlarkSemantics buildRandomSemantics(Random rand) { .incompatibleExpandDirectories(rand.nextBoolean()) .incompatibleNewActionsApi(rand.nextBoolean()) .incompatibleNoAttrLicense(rand.nextBoolean()) - .incompatibleNoKwargsInBuildFiles(rand.nextBoolean()) .incompatibleNoOutputAttrDefault(rand.nextBoolean()) .incompatibleNoRuleOutputsParam(rand.nextBoolean()) .incompatibleNoSupportToolsInActionInputs(rand.nextBoolean()) 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 b06623cfa4210e..d199a918ab5d8e 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 @@ -705,6 +705,10 @@ public void testIfStatementForbiddenInBuild() throws Exception { public void testKwargsForbiddenInBuild() throws Exception { new BuildTest() .testIfErrorContains("**kwargs arguments are not allowed in BUILD files", "print(**dict)"); + + new BuildTest() + .testIfErrorContains( + "**kwargs arguments are not allowed in BUILD files", "len(dict(**{'a': 1}))"); } @Test @@ -712,17 +716,4 @@ public void testArgsForbiddenInBuild() throws Exception { new BuildTest() .testIfErrorContains("*args arguments are not allowed in BUILD files", "print(*['a'])"); } - - @Test - public void testIncompatibleKwargsInBuildFiles() throws Exception { - new BuildTest("--incompatible_no_kwargs_in_build_files=true") - .testIfErrorContains( - "kwargs arguments are not allowed in BUILD files", "len(dict(**{'a': 1}))"); - - new BuildTest("--incompatible_no_kwargs_in_build_files=false") - .testStatement("len(dict(**{'a': 1}))", 1); - - new SkylarkTest("--incompatible_no_kwargs_in_build_files") - .testStatement("len(dict(**{'a': 1}))", 1); - } }