Skip to content

Commit

Permalink
Remove flag incompatible_static_name_resolution_in_build_files
Browse files Browse the repository at this point in the history
It was flipped. This change is expected to be a no-op.

#8022

RELNOTES: None.
PiperOrigin-RevId: 253035152
  • Loading branch information
laurentlb authored and copybara-github committed Jun 13, 2019
1 parent ba12321 commit fdc2da7
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -531,20 +531,6 @@ public class StarlarkSemanticsOptions extends OptionsBase implements Serializabl
+ "will be available")
public boolean incompatibleRemoveNativeMavenJar;

@Option(
name = "incompatible_static_name_resolution_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, BUILD files use static name resolution (which can find errors in code "
+ "that is not executed). See https://github.com/bazelbuild/bazel/issues/8022")
public boolean incompatibleStaticNameResolutionInBuildFiles;

/** Used in an integration test to confirm that flags are visible to the interpreter. */
@Option(
name = "internal_skylark_flag_test_canary",
Expand Down Expand Up @@ -669,7 +655,6 @@ public StarlarkSemantics toSkylarkSemantics() {
.incompatibleRemapMainRepo(incompatibleRemapMainRepo)
.incompatibleRemoveNativeMavenJar(incompatibleRemoveNativeMavenJar)
.incompatibleRestrictNamedParams(incompatibleRestrictNamedParams)
.incompatibleStaticNameResolutionInBuildFiles(incompatibleStaticNameResolutionInBuildFiles)
.incompatibleStringJoinRequiresStrings(incompatibleStringJoinRequiresStrings)
.internalSkylarkFlagTestCanary(internalSkylarkFlagTestCanary)
.incompatibleDoNotSplitLinkingCmdline(incompatibleDoNotSplitLinkingCmdline)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,6 @@ public boolean flagValue(FlagIdentifier flagIdentifier) {

public abstract boolean incompatibleStringJoinRequiresStrings();

public abstract boolean incompatibleStaticNameResolutionInBuildFiles();

public abstract boolean internalSkylarkFlagTestCanary();

public abstract boolean incompatibleDoNotSplitLinkingCmdline();
Expand Down Expand Up @@ -273,7 +271,6 @@ public static Builder builderWithDefaults() {
.incompatibleRemapMainRepo(false)
.incompatibleRemoveNativeMavenJar(false)
.incompatibleRestrictNamedParams(false)
.incompatibleStaticNameResolutionInBuildFiles(true)
.incompatibleStringJoinRequiresStrings(true)
.internalSkylarkFlagTestCanary(false)
.incompatibleDoNotSplitLinkingCmdline(true)
Expand Down Expand Up @@ -363,8 +360,6 @@ public abstract Builder incompatibleDisallowRuleExecutionPlatformConstraintsAllo

public abstract Builder incompatibleStringJoinRequiresStrings(boolean value);

public abstract Builder incompatibleStaticNameResolutionInBuildFiles(boolean value);

public abstract Builder internalSkylarkFlagTestCanary(boolean value);

public abstract Builder incompatibleDoNotSplitLinkingCmdline(boolean value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,14 +402,12 @@ public static boolean checkBuildSyntax(
// Wrap the boolean inside an array so that the inner class can modify it.
final boolean[] success = new boolean[] {true};

if (env.getSemantics().incompatibleStaticNameResolutionInBuildFiles()) {
ValidationEnvironment venv = new ValidationEnvironment(env, true);
try {
venv.validateAst(statements);
} catch (ValidationException e) {
eventHandler.handle(Event.error(e.exception.getLocation(), e.exception.getMessage()));
return false;
}
ValidationEnvironment venv = new ValidationEnvironment(env, true);
try {
venv.validateAst(statements);
} catch (ValidationException e) {
eventHandler.handle(Event.error(e.exception.getLocation(), e.exception.getMessage()));
return false;
}

// TODO(laurentlb): Merge with the visitor above when possible (i.e. when BUILD files use it).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ private static StarlarkSemanticsOptions buildRandomOptions(Random rand) throws E
"--incompatible_remap_main_repo=" + rand.nextBoolean(),
"--incompatible_remove_native_maven_jar=" + rand.nextBoolean(),
"--incompatible_restrict_named_params=" + rand.nextBoolean(),
"--incompatible_static_name_resolution_in_build_files=" + rand.nextBoolean(),
"--incompatible_string_join_requires_strings=" + rand.nextBoolean(),
"--incompatible_restrict_string_escapes=" + rand.nextBoolean(),
"--internal_skylark_flag_test_canary=" + rand.nextBoolean());
Expand Down Expand Up @@ -217,7 +216,6 @@ private static StarlarkSemantics buildRandomSemantics(Random rand) {
.incompatibleRemapMainRepo(rand.nextBoolean())
.incompatibleRemoveNativeMavenJar(rand.nextBoolean())
.incompatibleRestrictNamedParams(rand.nextBoolean())
.incompatibleStaticNameResolutionInBuildFiles(rand.nextBoolean())
.incompatibleStringJoinRequiresStrings(rand.nextBoolean())
.incompatibleRestrictStringEscapes(rand.nextBoolean())
.internalSkylarkFlagTestCanary(rand.nextBoolean())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -681,12 +681,7 @@ public void testArgBothPosKey() throws Exception {

@Test
public void testStaticNameResolution() throws Exception {
newTest("--incompatible_static_name_resolution_in_build_files=true")
.testIfErrorContains("name 'foo' is not defined", "[foo for x in []]");

// legacy
new BuildTest("--incompatible_static_name_resolution_in_build_files=false")
.testStatement("str([foo for x in []])", "[]");
newTest().testIfErrorContains("name 'foo' is not defined", "[foo for x in []]");
}

@Test
Expand Down

0 comments on commit fdc2da7

Please sign in to comment.