Don't let a bracketed comment in a class body drop its superclass - #1301
Open
apiology wants to merge 1 commit into
Open
Don't let a bracketed comment in a class body drop its superclass#1301apiology wants to merge 1 commit into
apiology wants to merge 1 commit into
Conversation
`parameters_from_inline_rbs` scanned the entire class body for
`#[...]`, so any bracketed comment in the body was read as the
superclass's type arguments. `# [:b, { c: :d }]` produced the
superclass name `Base<:b, { c: :d`, which resolves to nothing, and
every inherited method in the class then reported `Unresolved call` —
including on lines above the comment.
Match only where ruby/rbs's inline syntax puts it: directly after the
superclass, on the same line, `#[` with no space, with a closing `]`
required. `class Foo < Array # [String]` is now an ordinary comment.
Also removes a leftover debug `logger.warn` from
castwide#1173.
Fixes castwide#1300
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NtwP1oKRXfJAbPQrPHm5oU
apiology
added a commit
to apiology/solargraph
that referenced
this pull request
Aug 15, 2026
…op its superclass
apiology
marked this pull request as ready for review
August 17, 2026 21:30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1300
An ordinary comment anywhere in a class body could silently remove that
class's superclass:
Every inherited method then reports
Unresolved call, including on linesabove the comment, so the reported locations point nowhere near the cause.
parameters_from_inline_rbsregex-scanned the whole class body for#[...],so any bracketed comment was read as the superclass's inline RBS type
arguments.
# [:b, { c: :d }]yields the superclass nameBase<:b, { c: :d,which resolves to nothing.
The annotation is now only read where ruby/rbs's inline
syntax defines it —
directly after the superclass, on the same line,
#[with no space — and aclosing
]is required.Tightening worth noting:
class Foo < Array # [String](space after the#)is now an ordinary comment rather than a type annotation.
Also removes a leftover debug
logger.warnfrom#1173.
🤖 Generated with Claude Code
https://claude.ai/code/session_01NtwP1oKRXfJAbPQrPHm5oU