Skip to content

Commit

Permalink
Enable the flag incompatible_disallow_hashing_frozen_mutables
Browse files Browse the repository at this point in the history
Fixes #7800

RELNOTES: The flag incompatible_disallow_hashing_frozen_mutables is enabled (#7800)
PiperOrigin-RevId: 264659899
  • Loading branch information
laurentlb authored and copybara-github committed Aug 21, 2019
1 parent a28512b commit f01b863
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ public class StarlarkSemanticsOptions extends OptionsBase implements Serializabl

@Option(
name = "incompatible_disallow_hashing_frozen_mutables",
defaultValue = "false",
defaultValue = "true",
documentationCategory = OptionDocumentationCategory.STARLARK_SEMANTICS,
effectTags = {OptionEffectTag.BUILD_FILE_SEMANTICS},
metadataTags = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public static Builder builderWithDefaults() {
.incompatibleDepsetForLibrariesToLinkGetter(true)
.incompatibleRestrictStringEscapes(false)
.incompatibleDisallowDictLookupUnhashableKeys(false)
.incompatibleDisallowHashingFrozenMutables(false)
.incompatibleDisallowHashingFrozenMutables(true)
.build();

/** Builder for {@link StarlarkSemantics}. All fields are mandatory. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,27 +428,6 @@ public void configKeyTypeChecking_None() throws Exception {
"Invalid key: None. select keys must be label references");
}

@Test
public void configKeyTypeChecking_Dict() throws Exception {
reporter.removeHandler(failFastHandler); // Expect errors.
// If we embed a {} literal directly into the select, it fails with a Skylark error before
// we even get to select's type checking (since {} isn't a valid hashable type for the
// dictionary Skylark passes to the select function's invoke method). We can get around that
// by freezing the dict from an external .bzl file.
scratch.file("java/foo/external_dict.bzl",
"m = {}",
"def external_dict():",
" return m");
scratch.file("java/foo/BUILD", "dict_key",
"load('//java/foo:external_dict.bzl', 'external_dict')",
"java_library(",
" name = 'dict_key',",
" srcs = select({external_dict(): ['a.java']})",
")");
assertTargetError("//java/foo:dict_key",
"Invalid key: {}. select keys must be label references");
}

@Test
public void selectWithoutConditionsMakesNoSense() throws Exception {
reporter.removeHandler(failFastHandler); // Expect errors.
Expand Down

0 comments on commit f01b863

Please sign in to comment.