Conversation
d4169d6 to
77780ea
Compare
8b80a5f to
a28f619
Compare
|
|
||
| /// With [FinderOptions.transitive], the finding whose removal deletes this | ||
| /// declaration's last reference, as `qualifiedName (file:line)`. | ||
| final String? onlyReferencedFrom; |
There was a problem hiding this comment.
Couldn't transitively dead declaration be referenced by multiple dead declarations?
There was a problem hiding this comment.
It could, and the field was wrong about it — fixed in 46be3f7.
_onlyReferencedFrom returned on the first reference that landed in a dead span, so with several dead referrers it named whichever one the analysis server happened to list first: arbitrary, and the name asserted it was the only one.
It is now the list of all of them, deduplicated and sorted by source position (the server's order isn't). Rendering: the text and GitHub reports show the first plus a count, the JSON carries the whole list.
24:6 function _sharedByDeadRoots (private) (only referenced from dead _deadRoot (…:6) and 1 more)
"onlyReferencedFrom": ["_deadRoot (lib/scenarios/transitive.dart:6)",
"_secondDeadRoot (lib/scenarios/transitive.dart:20)"]The fixture gained _sharedByDeadRoots, called from two dead roots, and the test asserts both are named in source order.
Generated by Claude Code
Ciach ran the server session and also collected candidates, fetched what the verdict reads, decided each finding, and spelled it: 1000 lines with five jobs. Each is now a collaborator, and Ciach keeps the session and the pipeline. - CandidateCollector: which declarations get checked — the symbol walk, the option filters, entry points and their containers. - ReferenceFetch: the server round trips — references, tokens, syntax nodes — into the SourceIndex. - Settler: from references to sorted findings. - Verdict: what becomes of one unused candidate — suppressed, report-only, or a finding — and its hints. A move, not a change: the tests and the verbose narration are the same. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011fqaUyaQtY7AkuTYBjAUJv
The text a removal deletes keeps nothing alive. With `--transitive`, the settler runs in rounds: each drops the references inside the previous round's removable findings and classifies again, until nothing changes — one run, no new reference queries: the cross-library probe covers only newly emptied names, override and superclass lookups are memoized. Round one is the plain result, so the default output is unchanged. Only findings `--remove` would delete count as gone, so the set the report assumes deleted is the set removed. A finding dead only because its container is goes unreported with the container. Each finding this adds names every dead declaration it hangs on (`onlyReferencedFrom`), in source order — several may reference the same one. Off by default: a false positive takes everything only it referenced with it. A cycle keeps itself alive; that is #65. Closes #58. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011fqaUyaQtY7AkuTYBjAUJv
46be3f7 to
55c60ee
Compare
|
Closed in favour of #72: the stack was reordered so the finder split (#71) comes first and Generated by Claude Code |
Closes #58. Stacked on #70 (the finder split), so the rounds land inside
settler.dart; retarget once it merges.The text a removal deletes keeps nothing alive. With
--transitiveeach round drops the references inside the previous round's removable findings and classifies again, until nothing changes. One run, no new reference queries (the cross-library probe covers only newly emptied names; override and superclass lookups are memoized), works in a plain report too. Default output is unchanged.dead_spans.dart: the deleted text as a per-file span index. Only non-removalBlockedfindings contribute, so the set the report assumes deleted is exactly what--removedeletes.settler.dart:settleloops_rounduntil the span set is stable (cap 16; the set only grows);_liveRefs,_onlyReferencedFrom, memoized overrides and probe names.CrossLibraryReferences.merged/.where.UnusedDeclaration.onlyReferencedFrom: every dead declaration it hangs on, in source order (text and-f githubshow the first plus a count;-f jsonthe list).--[no-]transitive,transitive:inciach.yaml. Off by default.scenarios/transitive.dart+ tests, including: after--removeon a copy, a second run has nothing left to remove; a helper two dead roots call names both. A mutually recursive pair stays — Report dead reference cycles (reachability from live roots) #65.🤖 Generated with Claude Code
https://claude.ai/code/session_011fqaUyaQtY7AkuTYBjAUJv