Commit 2190a35
Replace generic nil-check suppressions with real fixes/explanations
Every "Need to add nil check here" ignore this PR had introduced is
now either gone or replaced with a comment explaining why a real
check is not needed:
- Fixed the actual bug: type_name did not handle a :cbase root (the
leading '::' in a fully-qualified constant like ::Integer), so
`x.is_a?(::Foo)` guards never narrowed anywhere in this file --
parsing '::Foo' silently produced no type name at all. That is why
the node.is_a?(::Parser::AST::Node) guard at the top of
parse_receiver_chain was not narrowing node for the rest of the
method. Fixing it made 7 of 9 ignores in that method unnecessary.
- Added a real nil-check for the one Array#[range] slice that is
legitimately nilable per its own type (children[2..].empty?).
- The remaining two ignores (a node.children element, and
Range.from_node(node).start) get explanatory comments instead of
the generic placeholder -- both match an existing, already-accepted
pattern elsewhere in this same file.
Also added a regression spec for the type_name fix.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KGu6zb5faStTC754PxMUSA1 parent 9445d1f commit 2190a35
2 files changed
Lines changed: 36 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
264 | 264 | | |
265 | 265 | | |
266 | 266 | | |
267 | | - | |
268 | 267 | | |
269 | | - | |
270 | 268 | | |
271 | | - | |
272 | | - | |
273 | | - | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
274 | 272 | | |
275 | | - | |
276 | 273 | | |
277 | | - | |
278 | 274 | | |
279 | 275 | | |
280 | | - | |
281 | 276 | | |
282 | 277 | | |
283 | 278 | | |
284 | | - | |
285 | 279 | | |
286 | 280 | | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
287 | 285 | | |
288 | 286 | | |
289 | 287 | | |
| |||
305 | 303 | | |
306 | 304 | | |
307 | 305 | | |
308 | | - | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
309 | 310 | | |
310 | 311 | | |
311 | 312 | | |
| |||
519 | 520 | | |
520 | 521 | | |
521 | 522 | | |
522 | | - | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
523 | 526 | | |
524 | 527 | | |
525 | 528 | | |
| |||
551 | 554 | | |
552 | 555 | | |
553 | 556 | | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
554 | 560 | | |
555 | 561 | | |
556 | 562 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1103 | 1103 | | |
1104 | 1104 | | |
1105 | 1105 | | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
1106 | 1125 | | |
0 commit comments