Commit bbaf7f9
Narrow bare, implicit-self attr_reader-style accessor calls
A nil-guard on a bare call (e.g. 'return nil if steps.nil?', where
steps is an argless method like an attr_reader) previously left a
later call to the same accessor (e.g. 'steps.empty?') unnarrowed --
FlowSensitiveTyping's chain-narrowing (added for explicit-receiver
chains like 'pin.location') only resolved a single-word chain via
find_var, which looks up tracked local/instance variables and can
never match a method call.
chain_pin now recognizes when a length-1 chain word actually came
from a :send node (a method call, since the parser only emits :lvar
for names already assigned as locals in scope) rather than an :lvar
node, and synthesizes a pin rooted at the enclosing closure instead
of a variable's. FlowSensitiveTyping now takes that closure as a
constructor argument from each node processor's `region.closure`.
process_call_chain's bare-truthy-check handling is extended from
chain_words.length >= 2 to length >= 1 for the same reason, so
'return nil unless steps' narrows the same way 'return nil if
steps.nil?' does.
SKIP=Solargraph: this branch (castwide#1258, unmerged)
already has 28 pre-existing `solargraph typecheck --level strong`
problems in these files before this commit; this change adds none
(verified line-by-line against the pre-existing baseline).
Fixes castwide#1258 (comment)
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PMbuVPLPj8CjHG8EkEQjrh1 parent 2190a35 commit bbaf7f9
6 files changed
Lines changed: 92 additions & 15 deletions
File tree
- lib/solargraph/parser
- parser_gem/node_processors
- spec/parser
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
13 | 17 | | |
14 | 18 | | |
15 | 19 | | |
16 | 20 | | |
| 21 | + | |
17 | 22 | | |
18 | 23 | | |
19 | 24 | | |
| |||
340 | 345 | | |
341 | 346 | | |
342 | 347 | | |
343 | | - | |
344 | | - | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
345 | 352 | | |
346 | 353 | | |
347 | 354 | | |
| |||
356 | 363 | | |
357 | 364 | | |
358 | 365 | | |
359 | | - | |
360 | | - | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
361 | 379 | | |
362 | 380 | | |
363 | 381 | | |
| |||
372 | 390 | | |
373 | 391 | | |
374 | 392 | | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
375 | 413 | | |
376 | 414 | | |
377 | 415 | | |
| |||
501 | 539 | | |
502 | 540 | | |
503 | 541 | | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | | - | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
508 | 547 | | |
509 | 548 | | |
510 | 549 | | |
| |||
518 | 557 | | |
519 | 558 | | |
520 | 559 | | |
521 | | - | |
| 560 | + | |
522 | 561 | | |
523 | 562 | | |
524 | 563 | | |
| |||
576 | 615 | | |
577 | 616 | | |
578 | 617 | | |
579 | | - | |
| 618 | + | |
580 | 619 | | |
581 | 620 | | |
582 | 621 | | |
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1075 | 1075 | | |
1076 | 1076 | | |
1077 | 1077 | | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
1078 | 1112 | | |
1079 | 1113 | | |
1080 | 1114 | | |
| |||
0 commit comments