Skip to content

Fix a nil crash and missing nil checks across the parser, type checker and RBS handling - #1245

Closed
apiology wants to merge 135 commits into
castwide:masterfrom
apiology:extract-1240-code-changes
Closed

apiology wants to merge 135 commits into
castwide:masterfrom
apiology:extract-1240-code-changes

Conversation

@apiology

@apiology apiology commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Problem: Strong-mode typechecking flags missing nil checks across the parser, type checker and RBS handling, one of which is a real crash.

The known crash involves parsing inline RBS:

class Foo
  #: # invalid RBS
  def bar; end
end
pin/method.rb:733:in `return_type_from_inline_rbs':
  undefined method `type' for nil:NilClass (NoMethodError)

The rest are paths the checker cannot prove safe; the guards are cheap and the declared types hold either way.

Solution: Guard the nils, return [] where an Array is declared, and call #fetch where the key cannot be missing so a bad index raises at the bug rather than downstream.

Where a Range slice's bounds are already guaranteed, delete_prefix/sub, a || '' fallback or Array#drop types it as String or Array rather than a nilable type.

Pin::Callable no longer declares its own return_type reader, so Base#return_type's ComplexType::UNDEFINED fallback applies to signatures and blocks built without a return type.

Alongside those: other typechecker-based linting.

🤖 Generated with Claude Code

Split out of the strong-level typechecking cleanup in castwide#1240: nil-guard
bug fixes, nil/false-vs-[] return-value corrections, dead duplicate
method removals (rbs_map/conversions.rb had two definitions each of
build_type and parts_of_function; only the second was ever live), and
Sorbet-narrowing local-variable extractions. castwide#1240 stays annotation
and CI-gate only; these are the actual behavior-touching hunks that
were mixed into that branch.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LYQc4tRAkDEfp6vZsvHaXr
apiology added a commit to apiology/solargraph that referenced this pull request Aug 2, 2026
The 28 non-comment hunks that touched actual Ruby behavior (nil-guard
fixes, return-value corrections, dead duplicate method removal,
Sorbet-narrowing refactors) now live in castwide#1245. This branch reverts
those hunks back to their pre-cleanup form and marks each resulting
strong-typecheck gap with an @sg-ignore comment referencing castwide#1245, so
this PR stays annotation- and CI-gate-only as requested.

Verified via solargraph typecheck --level strong: normalized diff
against the pre-revert state of this branch shows zero net-new
problems introduced by the revert (all reverted spots are covered by
the new ignores; remaining diffs are pre-existing version-drift noise
already present on this branch). Full test suite: 1618 examples, 0
failures.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LYQc4tRAkDEfp6vZsvHaXr
@apiology apiology changed the title Extract behavior changes and refactors from strong-typecheck cleanup Fix nil-safety, return-value, and dead-code bugs across parser/type-checker/RBS layers Aug 2, 2026
apiology added a commit to apiology/solargraph that referenced this pull request Aug 2, 2026
The comment block above require_all_unique_types_match_expected? was a
stale, hand-maintained tally of @sg-ignore reasons and counts. Recomputed
from a full grep over lib/**/*.rb: 745 total (was ~373), reflecting both
growth in the underlying campaign (e.g. "Need to add nil check here"
281 -> 465) and the new castwide#1245-deferred entries from this PR's split
(29 nil-check, 13 downcast, 6 return-value, 3 dead-code-removal).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LYQc4tRAkDEfp6vZsvHaXr
apiology added a commit to apiology/solargraph that referenced this pull request Aug 2, 2026
PR castwide#1201 disabled tuple/literal element-type inference wholesale to
fix specious-inference reports (castwide#1196). That's the root cause of a
broad swath of downstream nil-check/downcast/overload-resolution gaps
across the codebase, not just tuple indexing. Open PR castwide#1223 restores
the capability properly (with real reassignment tracking) rather than
leaving it off.

Determined the exact set empirically: test-merged castwide#1223's branch onto
this one and diffed `solargraph typecheck --level strong` output
before/after (line numbers stripped to avoid false positives from
line-count shifts). Every one of the 79 lines flagged "Unneeded
@sg-ignore comment" in that diff had its comment rewritten to
`# @sg-ignore https://github.com/castwide/solargraph/pull/1223`,
replacing whatever specific reason (or blank comment) was there
before - including one of this branch's own castwide#1245-deferred entries
(pin/block.rb), which turns out to be downstream of the same root
cause.

Updated the @sg-ignore count doc in TypeChecker::Rules to add this as
a third bucket and adjust the other two accordingly.

Verified: full test suite (1618 examples, 0 failures) and
`solargraph typecheck --level strong` both unchanged from before this
commit (comment-only diff, confirmed via normalized before/after
output comparison). Rubocop offenses on touched files identical
before and after (36, all pre-existing).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LYQc4tRAkDEfp6vZsvHaXr
apiology added a commit to apiology/solargraph that referenced this pull request Aug 2, 2026
Collapse the four different castwide#1245-deferred reason strings (nil-check,
downcast, return-value, dead-code-removal) down to one consistent
`# @sg-ignore https://github.com/castwide/solargraph/pull/1245`,
matching the castwide#1223 reference style and the repo's existing convention
of pointing an ignore straight at the PR that resolves it rather than
re-describing the reason inline.

Reverted the count doc in TypeChecker::Rules to the original flat
two-bucket format (no prose commentary) and regenerated the counts
using the actual ~/bin/solargraph-errors-group tool per the documented
recipe in ~/Dropbox/Shared/solargraph.md, rather than an ad-hoc filter.
The castwide#1223 and castwide#1245 buckets are now single flat count lines in
"pending code fixes," not broken out by what they used to be.

Verified: full test suite (1618 examples, 0 failures), rubocop clean,
and `solargraph typecheck --level strong` stable at 72 problems
(unchanged from before this commit).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LYQc4tRAkDEfp6vZsvHaXr
apiology added a commit to apiology/solargraph that referenced this pull request Aug 2, 2026
The 28 "flow sensitive typing should support case/when" /
"flow based typing needs to understand case when class pattern"
ignores in rbs_translator.rb and rbs_map/conversions.rb all describe
the same gap: the type checker doesn't narrow a case/when subject's
type inside each branch. Filed and confirmed as
castwide#1241 - rewrote all 28
to point there instead of restating the reason inline, matching the
castwide#1223/castwide#1245 convention.

Checked for issue coverage on the other "flow sensitive typing could
handle" categories too (attrs, redefinition, ||= on lvars, .class ==
.class, boolish support, etc.) - no clear existing issue found for
those via search, so left as-is. Also checked "Need to handle
duck-typed method calls on union types": issues #453/#511 looked like
a match at first glance but describe a different mechanism (YARD
`@return [#call]` duck-type tags, not union-type method resolution)
so left unlinked rather than mis-attribute it.

Regenerated the count doc using solargraph-errors-group per the
documented recipe. Verified via a clean stash/restore comparison
(not just before/after diffing, since consecutive typecheck runs
have shown transient non-determinism this session) that this
comment-only change introduces zero new problems: full test suite
1618 examples/0 failures, rubocop clean, typecheck stable at 72.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LYQc4tRAkDEfp6vZsvHaXr
apiology added a commit to apiology/solargraph that referenced this pull request Aug 2, 2026
Three of the largest remaining "flow sensitive typing could handle"
categories described coherent, reproducible gaps with no existing
tracking issue (searched castwide/solargraph issues first, no match):

- "flow sensitive typing needs to handle attrs" (30): a nil-guard on
  an attr_reader-style call doesn't narrow a later repeated call to
  the same accessor, since each call is treated as independent rather
  than as if it were a local variable. Filed as
  castwide#1249.
- "flow sensitive typing should be able to handle redefinition" (20):
  reassigning a variable to a value of a different (non-literal) type
  doesn't update its tracked type - distinct from castwide#1196/castwide#1223, which
  cover literal-value tracking through reassignment specifically for
  array/tuple indexing. Filed as
  castwide#1250.
- "flow sensitive typing needs to narrow down type with an if is_a?
  check" (12): narrower-scoped than castwide#1241 (case/when) - covers is_a?
  checks combined with && and elsif branches whose body doesn't see
  the narrowing established by its own condition. Filed as
  castwide#1251.

Rewrote all matching @sg-ignore comments to point at the new issues,
matching the castwide#1223/castwide#1245/castwide#1241 convention. Left the 4 sg-ignore notes
inside the disabled block in source/chain/literal.rb untouched (not
live directives) and the standalone @todo in shell.rb (different tag,
outside this doc's scope).

Regenerated the count doc via solargraph-errors-group. Verified: full
test suite (1618 examples, 0 failures), rubocop clean on all touched
files, and solargraph typecheck --level strong stable at 72 (checked
against a pre-edit baseline captured via stash, given transient
non-determinism observed between consecutive runs this session).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LYQc4tRAkDEfp6vZsvHaXr
apiology added a commit to apiology/solargraph that referenced this pull request Aug 2, 2026
CI's strong-typecheck job flagged one problem this PR introduced:
reverting the found_versions extraction (deferred to castwide#1245) earlier
this session dropped the @sg-ignore Need a downcast here comment that
covered it, since CI's fresh gem install resolves Gem::Version
differently than my local (stale) gem cache did.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LYQc4tRAkDEfp6vZsvHaXr
Per review: revert 6 workarounds added to dodge typecheck errors
(extracted variables, !!  casts, [] || default in place of
.fetch) back to their natural form, and record the actual
underlying limitation on each with a real slug or literal error
text instead of a vague placeholder:

- rbs_map/conversions.rb: Hash#fetch(key, default) leaks a
  generic<X> member into the declared return type even on a
  plain Hash{String => String} - tool-limitation:
  hash-fetch-default-generic-leak.
- opasgn_node.rb, node_chainer.rb, node_methods.rb: is_a?
  narrowing gaps already tracked elsewhere in this campaign
  (external-gem-class and predicate-wrapper variants).
- language_server/host.rb (x2): the boolish gap - a bare &&
  chain is not inferred as Boolean without an explicit cast.
- diagnostics/rubocop_helpers.rb: Gem::Specification#version
  resolves to String instead of Gem::Version here, a likely RBS
  stdlib gap, not traced further.

Fixed a real bug introduced while placing the last marker: a
comment inserted between two backslash-continued string literals
turned the second string into unreachable code (caught by
Lint/UnreachableCode) - switched the continuation to a plus
operator so a comment can sit between the operands safely.
Two pre-existing Style/MethodDefParentheses offenses sit close
enough to this PR's own changes that reviewdog's diff-based
rubocop check flagged them as part of this PR. Cosmetic
autocorrect, no behavior change.
Hash#[] is typed (_Key) -> V | nil in RBS since a generic lookup
can always miss. details is a literal hash built two lines above
with :qualified always present, so the miss case cannot happen at
runtime.

Hash#fetch(key), single-argument form, is typed to return V with
no nil in the union - it raises KeyError instead of returning nil
when the key is absent. Swapping to fetch drops the runtime-
impossible nil from the type and turns an accidental future
removal of the :qualified key into a loud KeyError rather than a
silent nil.
Solargraph::Parser.process_node returns a fixed, non-empty tuple, but
the strong typechecker treats .first on it like generic Array#first
and infers a nilable element type. That nilable type then cascades
through .select, .last, .nil?, and the instance_variable_set calls
below it.

Multiple assignment destructuring narrows to the declared tuple slot
type directly, avoiding the false nilable inference without changing
runtime behavior.
This branch was 14 commits behind master, which left the PR
mergeable: CONFLICTING and blocked GitHub Actions from ever
triggering a run on it. Resolved one real conflict in
namespace_node.rb's parameters_from_inline_rbs via rerere, keeping
master's position-based regex lookup combined with this branch's own
nil-safety guard layered on top. Every other file auto-merged clean.

SKIP=RuboCop,Solargraph: the pre-commit hooks flag 2 RuboCop findings
(source.rb:332, mapper.rb:149, both Style/RedundantArgument on
`.join('')`) and 7 Solargraph typecheck findings (source.rb:262,265,
315,328; mapper.rb:149; type_checker.rb:862; yard_map/mapper.rb:35)
as being on "modified lines." All 9 are confirmed present verbatim on
a plain, unmodified castwide/master checkout at this same commit --
verified directly, not assumed. They're pre-existing master content
that's simply new to this branch for the first time via this merge,
not anything this merge or PR 1245 introduces.

Full suite: 1646 examples, 0 failures.
Definition#process's last statement calls set_result, which is
declared void -- its actual return value (an assignment expression
result) is an implementation accident, not part of the contract.
The real value belongs in message.result, set by set_result as a
side effect.
undercover flagged 4 under-tested nodes added by this PR's diff:
StructAssignmentNode#class_name and DataAssignmentNode#class_name
never exercised their namespaced-constant branch, node_methods'
find_recipient_node_by_text fallback was invoked but always
returned nil before reaching its parsing logic, and Parameter's
typify_method_param never hit its unnamed-@param-by-index fallback
inside the method-stack loop.

Each spec targets the specific branch undercover reported as
uncovered:
- struct_definition_spec/clip_spec: assign to a namespaced constant
  (Foo::Baz = Struct.new/Data.define) instead of a bare one.
- cursor_spec: unparseable receiver/const/bare calls that force the
  text-based recipient fallback to actually find a match.
- parameter_spec: an overriding method whose own docstring has no
  @PARAM tag, falling back to an ancestor's unnamed @PARAM by index.
Shell#profile's definition_path block (building a Definition message,
calling process, printing result) had no test exercising it, per
undercover. vernier is an optional dependency not declared in the
gemspec, so stub it rather than requiring the real gem: fake the
Vernier constant and make #profile yield, so the block's own body
still runs for real against a fixture workspace.
apiology added a commit to apiology/solargraph that referenced this pull request Aug 29, 2026
Fixes the Kernel-visibility-adjacent shell.rb result/process bug and
the method_directive.rb tuple-.first bug that were failing Solargraph
/ strong on this branch (shell.rb:481, method_directive.rb:22-34).

Conflicts resolved by intent: kept HEAD's more advanced logic where
this branch had already superseded the incoming diff (type_checker.rb
kwarg_problems_for's dead argchain line dropped; data/struct
assignment node's per-line @sg-ignore suppressions restored after
incoming's extraction lost the nil-guard those need).

Added an @sg-ignore at pin/method.rb:759 for a pre-existing
Wrong-argument-type finding this merge's removal of a stale
@sg-ignore placeholder unmasks (RbsTranslator.to_complex_type's
own annotation bug, tracked separately, not fixed here per
integration-branches-no-direct-commits).
apiology added a commit to apiology/solargraph that referenced this pull request Aug 29, 2026
Several @sg-ignore comments introduced an ad hoc "tool-limitation:slug"
scheme with multi-paragraph prose instead of the short, plain-text
convention already established in TypeChecker::Rules. Reformat those
to match, remove two that were never needed (verified by deleting and
re-running strong typecheck), and fix two placeholder "Need to add nil
check here" comments by extracting the repeated hash lookup to a local
variable so flow-sensitive typing narrows it.

Also apply two suggested restructures verified safe by removing the
guard and re-running typecheck: TypeChecker#kwarg_problems_for's idx
always comes from the caller's own sig.parameters.each_with_index, so
.fetch(idx) replaces a nil check that can never trigger; and the
regex capture group in NamespaceNode#parameters_from_inline_rbs is not
optional, so nil is impossible there too (tagged with @sg-ignore since
MatchData#[] has no .fetch equivalent).

Removed a misused @type cast in struct_definition_spec.rb: Solargraph
infers the expression's type without it.
Several @sg-ignore markers turned out to be masking a simpler fix
rather than a real Solargraph gap:

- rubocop_helpers.rb: Gem::Specification#version.to_s replaces
  .version.version, which was the actual source of the generic<X>
  leak the ignore worked around.
- opasgn_node.rb: node.children.fetch(0) gives target a concrete,
  non-nil type, since op_asgn nodes always have three children.
- library.rb: Array#compact was dead code (ApiMap#source_map raises
  rather than returning nil), and next_map's intermediate local
  added nothing that the hash-assignment expression does not already
  return on its own.

resbody_node.rb reverts a local-variable extraction back to the
original repeated node.children[N] calls, tagging each flagged line
instead: the underlying gap (flow-sensitive typing does not narrow a
repeated Array#[] access) is real, so this keeps the diff smaller
than restructuring around it.

node_chainer.rb and conversions.rb replace descriptive prose ignores
with the tracked issue URLs (castwide#1251, castwide#1227) that
cover the same gaps, registered in rules.rb's tracked-gaps count.
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.
The spec asserted the literal string 'Result: [{:uri=>', Ruby's old
Hash#inspect punctuation for symbol keys. Ruby 3.4 changed the default
format to 'uri: ' shorthand, so the assertion failed on CI's Ruby 3.4
matrix entries while passing locally on 3.2.6. Content was correct on
both; only the inspect punctuation differed. Check for 'uri' and the
surrounding structure separately instead of the exact punctuation.
require_rubocop rescues Gem::MissingSpecVersionError and builds a
message listing the versions that are installed, but nothing exercised
that branch, so the block interpolating those versions had no coverage.

Requesting a version that cannot exist reaches it directly:
`require_rubocop('99.99.99')` raises InvalidRubocopVersionError with
"could not find 'rubocop' (= 99.99.99) - did find: [1.80.0]".

Full suite: 1654 examples, 0 failures, 67 pending. `rake undercover`
reports no missing coverage.
Metrics/AbcSize on Shell#profile was 110.7 against a max of 110, failing
the rubocop check on this PR. master already sits at 110.1; this branch
reads message.result instead of the return value of Definition#process,
which trades an assignment for a method call and pushes it over.

Moving the timing summary into a private method brings profile to 96.2.
83fda34 refactored Shell#profile to get Metrics/AbcSize under its
limit. That is production code, on a PR that exists to extract PR 1240's
code changes, changed to satisfy a linter.

The offence predates this branch: master's shell.rb measures 110.1
against a Max of 110, so any PR touching the file trips the cop. The
todo file is where that belongs, so regenerate it with the command its
own header records.
apiology and others added 4 commits October 23, 2026 14:04
ApiMap#var_at_location combines every visible pin for a variable, and
since castwide#1345 that includes an ancestor class ivar pin from another file.
The combined pin keeps one location but holds assignment nodes from
both files, and return_types_from_node clipped each node at the pin
location file. Positions past the end of that file raised
InvalidOffsetError: Method#block= assigns @block at a line beyond the
end of callable.rb, so a strong typecheck of pin/method.rb crashed.

Clip each assignment at the file its node came from.
The marker on Search#do_query sort cited castwide#1299, which master has now
merged, so strong typecheck reported it as an unneeded ignore.
Pin::Signature always gets a closure in lib code, and castwide#1393 makes a
missing one raise "Closure not set". Build the spec pin with a Method
closure, as Pin::Method does, so it keeps testing the undefined
return_type default once that lands.
The return_types_from_node fix duplicates 96f1339 on
castwide#1450. Matching it byte for byte lets the two PRs
merge in either order without conflict, and the strong_spec example on
castwide#1450 covers the crash, so drop the duplicate spec.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0121U2gRy7f9m4MpQd4gcCAs
@apiology
apiology marked this pull request as ready for review October 24, 2026 19:03
apiology and others added 3 commits October 24, 2026 16:49
castwide#1223 was closed as not planned, so these markers
pointed at no fix. stdlib.rb's #add errors are fixed by
castwide#1451 and its gsub error by castwide#1240's @PARAM tag;
chain.rb's equality_fields return type is fixed by castwide#1240's
`@return [::Array]` in equality.rb.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0121U2gRy7f9m4MpQd4gcCAs
castwide/master's castwide#1274 split a Pin::Signature.new call over two lines
in RbsTranslator, so CI's merged check reports ModuleLength 141/140
against this branch's tightened Max. Master's todo has Max 195;
tightening it isn't part of this PR.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0121U2gRy7f9m4MpQd4gcCAs
ApiMap#qualify and ApiMap::Store::Constants#qualify documented tag as
[String, nil], but no in-repo caller passes nil: the reference
resolvers in Pin::Method and Pin::Parameter pass a non-empty prefix
from String#rpartition. Narrowing the type to String lets the type
checker catch a nil argument at the call site.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0121U2gRy7f9m4MpQd4gcCAs
apiology added a commit to apiology/solargraph that referenced this pull request Oct 24, 2026
castwide#1245 declares tag as [String], which removes the
error this marker covers.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0121U2gRy7f9m4MpQd4gcCAs
apiology and others added 2 commits October 28, 2026 21:09
RbsCollection#raw_data returned whatever YAML.load_file parsed, and
Page#render returned whatever its Proc produced, so neither type was
known to the typechecker. Raise TypeError when the parsed lockfile is
not a Hash or its gems are not an Array of Hashes, and when a template
does not render a String. Tag raw_data and the gem hashes with their
shapes, and drop the bare sg-ignore and @type cast on render.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A convention can contribute pins with no location (solargraph-rails
Model pins do), and workspace/symbol then raised NoMethodError calling
filename on nil. Skip those pins, as document/symbol already does.

Hoist best_location into a local in workspace_symbol, definition,
type_definition and document_symbol so the nil check narrows it,
removing the sg-ignores there.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@apiology
apiology marked this pull request as draft October 29, 2026 15:00
apiology added a commit to apiology/solargraph that referenced this pull request Oct 29, 2026
Overlaying castwide#1245 (runtime shape checks on the
parsed rbs_collection lockfile and Page#render) on this branch makes
eight "Library method has no usable type" sg-ignores in
rbs_collection.rb and page.rb Unneeded at strong (verified). Strong CI
on an integration branch with castwide#1266 reports the two
"Need better generic inference here" sg-ignores in conversions.rb
Unneeded. Cite those PRs instead.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
apiology added a commit to apiology/solargraph that referenced this pull request Oct 30, 2026
Revert 9f4efb3, which guards Repo and RequirePaths against blank
subprocess output. It has nothing to do with Class.new block
receivers; the same commit lives in castwide#1288.

The restored JSON.parse lines carry the same sg-ignore markers as
castwide#1240, citing castwide#1245, for the typecheck problem
master already has there.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LTpguFfufaaEmy3yWcWsUi
Strong typecheck reports a wrong argument type for Hash#[]= at
resolve_and_cache: UniqueType#qualify turns the nested nil in
String, nil into ::NilClass, so the value type no longer matches.
castwide#1451 fixes the checker; ignore the line until it
lands.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LTpguFfufaaEmy3yWcWsUi
@apiology
apiology marked this pull request as ready for review October 30, 2026 12:24
@apiology
apiology marked this pull request as draft October 30, 2026 12:39
apiology and others added 4 commits October 30, 2026 08:40
The typecheck reported an unresolved call to map because the groups
value parsed from the bundle script JSON has no known type. A
bundle_hash helper, like bundle_array, raises TypeError on unexpected
data and gives the value a Hash type.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LTpguFfufaaEmy3yWcWsUi
The PR todo enables Naming/BlockForwarding with an exclude list, and
spec/language_server/progress_spec.rb, added on master in castwide#1475, is
not in it. Its send_request took an unused &block, which RuboCop
flags; no caller passes a block, so remove the parameter.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LTpguJfsWUBaw2hbPSiX3T
Master castwide#1468 moved lib/solargraph/convention/struct_definition.rb to
parser_gem/node_processors/struct_definition.rb, so the PR todo
exclusion no longer matched and StructNode#process (74/70 lines,
unchanged by this PR) was flagged by Metrics/MethodLength.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LTpguJfsWUBaw2hbPSiX3T
apiology added a commit to apiology/solargraph that referenced this pull request Nov 12, 2026
Revert 1244825. The guard has nothing to do with generic binding
or block signature merging, and castwide#1245 carries the
same guard.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LTpguJtoPAdynrXfRhqkMy
apiology added a commit to apiology/solargraph that referenced this pull request Nov 12, 2026
RBS declares version: as a required keyword on the library form of
EnvironmentLoader#add, so strong typecheck matched neither overload.
Also tag the library parameter as a String. The NilClass-vs-nil
mismatch the checker still reports is fixed by
castwide#1451. Taken from castwide#1245.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LTpguJtoPAdynrXfRhqkMy
@apiology
apiology marked this pull request as ready for review November 12, 2026 22:42
@apiology
apiology marked this pull request as draft November 12, 2026 22:42
apiology added a commit to apiology/solargraph that referenced this pull request Nov 13, 2026
castwide#1245 was split into smaller PRs, so its 183
citations no longer name what clears each error. Cite the PR whose
change clears the error: 148 now cite castwide#1494, castwide#1493, castwide#1479, castwide#1478 or
castwide#1392, and eight cite other open PRs that fix them (castwide#1395, castwide#1338,
castwide#1451, castwide#1259).

The 27 that no open PR fixes now carry the error they suppress, or the
rules.rb slug for that error (node.children arity, Array#first/#last,
Hash#[]). repo.rb:108 is among them because castwide#1231, which would fix
it, is closed.

The rules.rb census drops the castwide#1245 line, and the slug lines touched
here now match their count in the code.
@apiology apiology closed this Nov 13, 2026
castwide pushed a commit that referenced this pull request Nov 19, 2026
YARD has no @!domain directive registered, so its parser drops the tag
before Solargraph sees it: DomainDirective never ran, and
Namespace#domains, Store#domains and the ApiMap loop over them only ever
saw empty arrays. Remove them and the @!domain entry in the mapper
regexp.

Also remove YardMap::Cache, which nothing references, and
External#rbs_collection_paths and #rbs_collection_config_path, which
have no callers and would raise NoMethodError on
read_rbs_collection_paths if called.

Conventions still contribute domains through Environ; that path is
unchanged.

Split out of #1245.
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