Skip to content

Include the trailing ? in a keyword key's symbol location - #3043

Merged
soutaro merged 1 commit into
masterfrom
keyword-key-question-location
Jul 29, 2026
Merged

Include the trailing ? in a keyword key's symbol location#3043
soutaro merged 1 commit into
masterfrom
keyword-key-question-location

Conversation

@soutaro

@soutaro soutaro commented Jul 29, 2026

Copy link
Copy Markdown
Member

parse_keyword_key interns foo? as the key of foo?: Integer, but built the symbol's location from the name token alone, so the range stopped one character short of the name it belongs to. This extends it over the ?.

🤖 Generated with Claude Code

`parse_keyword_key` handles keys like `foo?:`, where the `?` is part of
the method-name-ish key: it interns `foo?` as the constant, but built the
symbol node's location from `current_token` alone, so the location covered
`foo` and stopped short of the `?`.

Extend the range to the end of the `?` token so the location matches the
name it is the location of.

This is not observable from Ruby -- `rbs_ast_symbol_t` is translated with
`ID2SYM` and the wasm serializer writes only the `constant_id`, both of
which drop the location. It matters for consumers that read the C AST
directly, such as the Rust crate's owned AST.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@soutaro soutaro added this to the RBS 4.1.x milestone Jul 29, 2026
@soutaro
soutaro enabled auto-merge July 29, 2026 08:51
@soutaro
soutaro added this pull request to the merge queue Jul 29, 2026
Merged via the queue into master with commit 95c0e82 Jul 29, 2026
26 of 30 checks passed
@soutaro
soutaro deleted the keyword-key-question-location branch July 29, 2026 08:55
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