Skip to content

Dispatch Bundler::StubSpecification#stub via send to avoid @sg-ignore flip - #80

Closed
apiology wants to merge 1 commit into
masterfrom
fix-gemspecs-stub-dynamic-dispatch
Closed

apiology wants to merge 1 commit into
masterfrom
fix-gemspecs-stub-dynamic-dispatch

Conversation

@apiology

@apiology apiology commented Sep 2, 2026

Copy link
Copy Markdown
Owner

Claude: opened on behalf of Vince Broz.

gemspecs.rb's respond_to?(:stub) guard is legitimate (different
Bundler versions vary on whether Bundler::StubSpecification has
this method), but the direct .stub call after it produces a
config-dependent Unneeded/needed @sg-ignore flip: rspec-mocks makes
Object#stub visible to Solargraph's static analysis whenever
solargraph-rspec is loaded as a plugin, changing what
respond_to?(:stub) narrows to. Dispatching via .send(:stub) isn't
subject to the same static narrowing, so the check passes cleanly
either way and the ignore marker is no longer needed.

respond_to?(:stub) is a legitimate guard: different Bundler versions
vary on whether Bundler::StubSpecification exposes it. The direct
.stub call after the guard produced a config-dependent Unneeded/
needed @sg-ignore flip, because rspec-mocks adds Object#stub whenever
solargraph-rspec is loaded as a plugin, changing what respond_to?
narrows to for static analysis. Dispatching via .send(:stub) isn't
subject to that narrowing, so the ignore comment is no longer needed.
@apiology

apiology commented Sep 2, 2026

Copy link
Copy Markdown
Owner Author

Claude: Superseded by castwide/solargraph#1245 - same fix cherry-picked onto its extract-1240-code-changes branch as commit c146835. Closing this standalone PR.

@apiology apiology closed this Sep 2, 2026
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