Skip to content

Commit

Permalink
Convert values to Starlark values when concating string_list_dict
Browse files Browse the repository at this point in the history
type.

This is because Dict checks that all the values put in it are Starlark
valid values. But string_list_dict value is of type List<String>, when
Java's List isn't a Starlark value.

Fixes bazelbuild#23065
  • Loading branch information
lior10r committed Aug 26, 2024
1 parent 39481ad commit 0720678
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ public Object copyAndLiftStarlarkValue(
public Map<KeyT, ValueT> concat(Iterable<Map<KeyT, ValueT>> iterable) {
Dict.Builder<KeyT, ValueT> output = new Dict.Builder<>();
for (Map<KeyT, ValueT> map : iterable) {
output.putAll(map);
output.putAll(cast(Attribute.valueToStarlark(map)));
}
return output.buildImmutable();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,8 @@ public void testStringListDict() throws Exception {
assertThat(converted).isEqualTo(expected);
assertThat(converted).isNotSameInstanceAs(expected);
assertThat(collectLabels(Types.STRING_LIST_DICT, converted)).isEmpty();

assertThat(Types.STRING_LIST_DICT.concat(Arrays.asList(converted)));
}

@Test
Expand Down

0 comments on commit 0720678

Please sign in to comment.