Skip to content

Commit

Permalink
Flip the flag --incompatible_disallow_dict_lookup_unhashable_keys
Browse files Browse the repository at this point in the history
Fixes #9184

RELNOTES:
  incompatible_disallow_dict_lookup_unhashable_keys is enabled by default
  #9184
PiperOrigin-RevId: 280659890
  • Loading branch information
laurentlb authored and copybara-github committed Nov 15, 2019
1 parent bea9d25 commit b31d832
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ public class StarlarkSemanticsOptions extends OptionsBase implements Serializabl

@Option(
name = "incompatible_disallow_dict_lookup_unhashable_keys",
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,6 +284,7 @@ public static Builder builderWithDefaults() {
.incompatibleRestrictStringEscapes(false)
.incompatibleDisallowDictLookupUnhashableKeys(false)
.incompatibleUseCcConfigureFromRulesCc(false)
.incompatibleDisallowDictLookupUnhashableKeys(true)
.build();

/** Builder for {@link StarlarkSemantics}. All fields are mandatory. */
Expand Down
13 changes: 6 additions & 7 deletions src/test/starlark/testdata/dict.sky
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,16 @@ assert_eq(() in {}, False)
assert_eq("a" in dict(a=1), True)
---

# should fail after --incompatible_disallow_dict_lookup_unhashable_keys is flipped to true
# unhashable types

{} in {} ## unhashable type: 'dict'
{} in {} ### unhashable type: 'dict'
---
[] in {} ## unhashable type: 'list'
[] in {} ### unhashable type: 'list'
---
len in {} ## unhashable type: 'function'
len in {} ### unhashable type: 'function'
---
{}.get([]) ## unhashable type: 'list'
{}.get([]) ### unhashable type: 'list'
---
dict().get({}) ## unhashable type: 'dict'
dict().get({}) ### unhashable type: 'dict'
---
{1: 2}.get(len) ## unhashable type: 'function'
{1: 2}.get(len) ### unhashable type: 'function'

0 comments on commit b31d832

Please sign in to comment.