Skip to content

Commit

Permalink
Fix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
harupy committed Jan 21, 2023
1 parent 2d01993 commit f2ffe12
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ast/asdl_rs.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,9 @@ def visitField(self, field, parent, vis, depth, constructor=None):
if fieldtype and fieldtype.boxed and (not (parent.product or field.seq) or field.opt):
typ = f"Box<{typ}>"
if field.opt or (
# Add `Option` to allow `Dict.keys` to contain `None` for dictionary unpacking
# in a dict literal.
# When a dictionary literal contains dictionary unpacking (e.g., `{**d}`),
# the expression to be unpacked goes in `values` with a `None` at the corresponding
# position in `keys`. To handle this, the type of `keys` needs to be `Option<Vec<T>>`.
constructor == "Dict" and field.name == "keys"
):
typ = f"Option<{typ}>"
Expand Down

0 comments on commit f2ffe12

Please sign in to comment.