Skip to content

[Feature #22108] Support computed hash keys with (expr): syntax#4132

Open
yertto wants to merge 1 commit into
ruby:mainfrom
yertto:feature/computed-hash-keys
Open

[Feature #22108] Support computed hash keys with (expr): syntax#4132
yertto wants to merge 1 commit into
ruby:mainfrom
yertto:feature/computed-hash-keys

Conversation

@yertto

@yertto yertto commented Jun 12, 2026

Copy link
Copy Markdown

Add support for computed property keys in hash literals:

h = { (expression): value }

In parse_assocs, when the default case encounters a PM_PARENTHESES_NODE key followed by PM_TOKEN_COLON with no intervening space, treat it as a computed hash key association.

This is the PRISM counterpart to ruby/ruby#17299, which implements the same syntax in the CRuby parse.y parser.

Assisted-by: OpenCode 1.17.3 (opencode/big-pickle)

Add support for computed property keys in hash literals:

```ruby
h = { (expression): value }
```

In parse_assocs, when the default case encounters a
PM_PARENTHESES_NODE key followed by PM_TOKEN_COLON with no
intervening space, treat it as a computed hash key association.
This is the PRISM counterpart to ruby/ruby#17299, which implements
the same syntax in the CRuby parse.y parser.

Assisted-by: OpenCode 1.17.3 (opencode/big-pickle)
@yertto yertto force-pushed the feature/computed-hash-keys branch from 025306e to 589d0ad Compare June 12, 2026 13:45
@yertto yertto marked this pull request as ready for review June 12, 2026 13:46
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

Successfully merging this pull request may close these issues.

1 participant