Skip to content
TheChatArchiveThe Chat Archive
Claudeclaude-sonnet-5· anthropicHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION unused-class-members FP: methods called only from Svelte <template>…

  1. User

    ISSUE DESCRIPTION

    unused-class-members FP: methods called only from Svelte member expressions False positive on 2.84.0. Class methods called only from a Svelte <template> via a member expression (for example resultState.pin(...) in markup) are reported as unused-class-member. Fallow tracks template-visible identifiers but not member-expression method calls on a bound instance inside Svelte markup.

    Repro (2.84.0): asciimoo/hister. ResultState.onOpen, .pin, .updateLabel, and .addSkipRule are each invoked from .svelte templates (resultState.pin(...) in ResultActionsMenu.svelte) yet reported unused. The repo currently sets rules.unused-class-members: "off" to work around it.

    Expected: credit a method called as <local>.<method>(...) inside a Svelte <template> when <local> resolves to an instance of the class, parallel to the existing Vue/Angular template member-access tracking.

    Interface

    No new interfaces are introduced.

    ADDITIONAL ADVICE

    Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use git checkout <file> to restore the file to its original state. You can also reset all changes in the repository using git reset --hard command. Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to get the changes that need to be submitted.

    CHECKLIST

    Before submitting your solution, please go over the following checklist and make sure you've done everything:

    • If an error was reported in the issue description, I have successfully reproduced it.
    • If an error was reported in the issue description, I have confirmed that my fix resolves the error.
    • I have thought about edge cases and made sure my fix handles them as well.
    • I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.

    Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!

    (Current directory: /fallow, current file: none) bash-$

  2. Claude Assistant

    Let's replicate with a main.ts entry point.

  3. Claude Assistant

    Now let's add the ObjectPattern branch right after this.

  4. Claude Assistant

    Now add the helper method record_typed_object_pattern_bindings near record_typed_binding.

  5. Claude Assistant

    Now let's check ObjectPattern is imported in visit_impl.rs.

  6. Claude Assistant

    Good, ObjectPattern is already used elsewhere so it's imported. Let's build.

  7. Claude Assistant

    Builds fine. Now let's rebuild the CLI and re-run the reproduction.

  8. Claude Assistant

    Found the cache directory. Let's clear it and re-run.

  9. Claude Assistant

    Good, clean now (no diff for sfc.rs). Let's rebuild and verify the full flow, plus test the original typed-BindingIdentifier scenario still works, and a case where the method is truly unused stays reported.

  10. Claude Assistant

    Now let's check that truly-unused methods are still detected, and non-arrow direct call in markup (like {resultState.pin()} without event handler) also works.

  11. Claude Assistant

    All four used methods (including plain markup interpolation calls, not just event handlers) are correctly credited, and the truly unused method is still correctly flagged. Now let's run the existing test suite to make sure nothing broke.

  12. Claude Assistant

    All extract tests pass. Now let's run the broader test suite including core integration tests, sfc_parsing, svelte tests, and cli tests.

  13. Claude Assistant

    All pass. Now run full workspace test suite to catch anything else affected.

  14. Claude Assistant

    Confirmed pre-existing failure unrelated to our change (likely due to running as root, where read-only permissions don't block writes). Let's restore our changes.

  15. Claude Assistant

    Now let's run the rest of the workspace tests excluding that known-broken test to make sure everything else passes.

  16. Claude Assistant

    All other tests pass. Let's also scroll up to confirm no failures earlier in the run.

  17. Claude Assistant

    All green except the pre-existing unrelated failure. Now let's clean up the temp test directory and double check final diff.

  18. Claude Assistant

    Renamed destructuring works correctly too (only the genuinely unused method is flagged). Let's clean up.

  19. Claude Assistant

    The diff is clean, containing only the intended fix. Let me review the checklist:

    Checklist review:

    • If an error was reported in the issue description, I have successfully reproduced it. ✅ I built a minimal Svelte fixture mirroring the reported scenario (a class ResultState with methods onOpen/pin/updateLabel/addSkipRule, instantiated in a parent component and passed as a prop to ResultActionsMenu.svelte, whose template calls resultState.pin(...) etc.). Using the Svelte 5 rune-style let { resultState }: { resultState: ResultState } = $props(); prop declaration pattern (a very common idiom in modern Svelte 5 codebases), I confirmed fallow dead-code --unused-class-members falsely reported all four methods as unused.

    • If an error was reported in the issue description, I have confirmed that my fix resolves the error. ✅ After patching crates/extract/src/visitor/visit_impl.rs to handle destructuring-pattern type annotations (mapping each destructured local to its class via the matching field in the type literal, mirroring the existing record_typed_binding logic for single-identifier bindings), the same reproduction now reports "No issues found" for the used methods, while a genuinely-unused method added to the same class is still correctly flagged.

    • I have thought about edge cases and made sure my fix handles them as well. ✅ Verified: (1) plain-identifier prop typing (export let x: T) still works (pre-existing path, untouched), (2) direct method calls in markup interpolation (not just event-handler arrows) are credited, (3) renamed destructured bindings ({ resultState: rs }) are correctly resolved, (4) truly-unused methods remain reported (no over-crediting), (5) the fix is additive and narrowly scoped to the ObjectPattern + whole-pattern type-annotation shape, reusing existing helpers (extract_object_pattern_bindings, extract_nested_type_bindings, resolve_class_type_param) so it also benefits Vue (which shares the same binding_target_names/bound_targets pipeline) without new bespoke code paths.

    • I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. ✅ Ran cargo test -p fallow-extract, cargo test -p fallow-core, and cargo test --workspace. All pass except one pre-existing, unrelated failure (fix_batch_aborts_when_a_target_directory_is_read_only), which I confirmed also fails on the unmodified codebase (via git stash) — it's an environment artifact (tests run as root, so read-only-directory permission checks don't actually block writes), not something introduced by this change.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.