Skip to content

Commit

Permalink
Remove the flag --incompatible_disallow_dict_lookup_unhashable_keys
Browse files Browse the repository at this point in the history
The flag was flipped to True in November.
#9184

RELNOTES: The flag --incompatible_disallow_dict_lookup_unhashable_keys is removed.
PiperOrigin-RevId: 289431363
  • Loading branch information
laurentlb authored and copybara-github committed Jan 13, 2020
1 parent 6a0f07d commit e8ca0fe
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -329,20 +329,6 @@ public class StarlarkSemanticsOptions extends OptionsBase implements Serializabl
help = "If true, disables all license checking logic")
public boolean incompatibleDisableThirdPartyLicenseChecking;

@Option(
name = "incompatible_disallow_dict_lookup_unhashable_keys",
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, dict key lookups using `in` or `dict.get` will fail with unhashable"
+ " types.")
public boolean incompatibleDisallowDictLookupUnhashableKeys;

@Option(
name = "incompatible_disallow_empty_glob",
defaultValue = "false",
Expand Down Expand Up @@ -679,8 +665,6 @@ public StarlarkSemantics toSkylarkSemantics() {
.incompatibleUseCcConfigureFromRulesCc(incompatibleUseCcConfigureFromRulesCc)
.incompatibleDepsetForLibrariesToLinkGetter(incompatibleDepsetForLibrariesToLinkGetter)
.incompatibleRestrictStringEscapes(incompatibleRestrictStringEscapes)
.incompatibleDisallowDictLookupUnhashableKeys(
incompatibleDisallowDictLookupUnhashableKeys)
.build();
return INTERNER.intern(semantics);
}
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/com/google/devtools/build/lib/syntax/Dict.java
Original file line number Diff line number Diff line change
Expand Up @@ -523,9 +523,7 @@ public final boolean containsKey(Object key, Location loc) throws EvalException
@Override
public final boolean containsKey(Object key, Location loc, StarlarkThread thread)
throws EvalException {
if (thread.getSemantics().incompatibleDisallowDictLookupUnhashableKeys()) {
EvalUtils.checkHashable(key);
}
EvalUtils.checkHashable(key);
return this.containsKey(key);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,6 @@ public boolean flagValue(FlagIdentifier flagIdentifier) {

public abstract boolean incompatibleRestrictStringEscapes();

public abstract boolean incompatibleDisallowDictLookupUnhashableKeys();

public abstract boolean experimentalAllowTagsPropagation();

public abstract boolean incompatibleUseCcConfigureFromRulesCc();
Expand Down Expand Up @@ -288,9 +286,7 @@ public static Builder builderWithDefaults() {
.incompatibleDoNotSplitLinkingCmdline(true)
.incompatibleDepsetForLibrariesToLinkGetter(true)
.incompatibleRestrictStringEscapes(false)
.incompatibleDisallowDictLookupUnhashableKeys(false)
.incompatibleUseCcConfigureFromRulesCc(false)
.incompatibleDisallowDictLookupUnhashableKeys(true)
.build();

/** Builder for {@link StarlarkSemantics}. All fields are mandatory. */
Expand Down Expand Up @@ -378,8 +374,6 @@ public abstract static class Builder {

public abstract Builder incompatibleRestrictStringEscapes(boolean value);

public abstract Builder incompatibleDisallowDictLookupUnhashableKeys(boolean value);

public abstract Builder incompatibleUseCcConfigureFromRulesCc(boolean value);

public abstract StarlarkSemantics build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ private static StarlarkSemanticsOptions buildRandomOptions(Random rand) throws E
"--incompatible_run_shell_command_string=" + rand.nextBoolean(),
"--incompatible_visibility_private_attributes_at_definition=" + rand.nextBoolean(),
"--incompatible_restrict_string_escapes=" + rand.nextBoolean(),
"--incompatible_disallow_dict_lookup_unhashable_keys=" + rand.nextBoolean(),
"--incompatible_use_cc_configure_from_rules_cc=" + rand.nextBoolean(),
"--internal_skylark_flag_test_canary=" + rand.nextBoolean());
}
Expand Down Expand Up @@ -212,7 +211,6 @@ private static StarlarkSemantics buildRandomSemantics(Random rand) {
.incompatibleRunShellCommandString(rand.nextBoolean())
.incompatibleVisibilityPrivateAttributesAtDefinition(rand.nextBoolean())
.incompatibleRestrictStringEscapes(rand.nextBoolean())
.incompatibleDisallowDictLookupUnhashableKeys(rand.nextBoolean())
.incompatibleUseCcConfigureFromRulesCc(rand.nextBoolean())
.internalSkylarkFlagTestCanary(rand.nextBoolean())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3075,8 +3075,6 @@ public void testRecursiveImport2() throws Exception {

@Test
public void testUnhashableInDictForbidden() throws Exception {
setSkylarkSemanticsOptions("--incompatible_disallow_dict_lookup_unhashable_keys=true");

scratch.file("test/extension.bzl", "y = [] in {}");

scratch.file("test/BUILD", "load('//test:extension.bzl', 'y')", "cc_library(name = 'r')");
Expand All @@ -3088,8 +3086,6 @@ public void testUnhashableInDictForbidden() throws Exception {

@Test
public void testDictGetUnhashableForbidden() throws Exception {
setSkylarkSemanticsOptions("--incompatible_disallow_dict_lookup_unhashable_keys=true");

scratch.file("test/extension.bzl", "y = {}.get({})");

scratch.file("test/BUILD", "load('//test:extension.bzl', 'y')", "cc_library(name = 'r')");
Expand All @@ -3099,17 +3095,6 @@ public void testDictGetUnhashableForbidden() throws Exception {
assertContainsEvent("unhashable type: 'dict'");
}

@Test
public void testUnhashableLookupDict() throws Exception {
setSkylarkSemanticsOptions("--incompatible_disallow_dict_lookup_unhashable_keys=false");

scratch.file("test/extension.bzl", "y = [[] in {}, {}.get({})]");

scratch.file("test/BUILD", "load('//test:extension.bzl', 'y')", "cc_library(name = 'r')");

getConfiguredTarget("//test:r");
}

@Test
public void testDisabledPartitionDefaultParameter() throws Exception {
scratch.file("test/extension.bzl", "y = 'abc'.partition()");
Expand Down

0 comments on commit e8ca0fe

Please sign in to comment.