Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing CONTAINS_SPLAT counterpart for Hash nodes #3057

Open
amomchilov opened this issue Sep 12, 2024 · 1 comment
Open

Missing CONTAINS_SPLAT counterpart for Hash nodes #3057

amomchilov opened this issue Sep 12, 2024 · 1 comment

Comments

@amomchilov
Copy link
Contributor

Arrays have the PM_ARRAY_NODE_FLAGS_CONTAINS_SPLAT flag, which tells you if there's a *splat, or if all the elements are just plain elements.

prism/config.yml

Lines 661 to 664 in acfeade

- name: ArrayNodeFlags
values:
- name: CONTAINS_SPLAT
comment: "if array contains splat nodes"

There's nothing equivalent to this for PM_HASH_NODE or PM_KEYWORD_HASH_NODE for knowing whether or not there's a **splat, so each element needs to always be type-checked for PM_ASSOC_NODE vs PM_ASSOC_SPLAT_NODE.

@kddnewton
Copy link
Collaborator

@amomchilov is this something you would need for Sorbet? I'm trying to figure out the use-case here. The flags in the array are because you might be able to get away with not duplicating an array if there's a splat, so it's mostly a compiler-level concern.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants