Skip to content
TheChatArchiveThe Chat Archive
GLMz-ai/glm-5.2· unknownHugging 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. GLM Assistant

    Let me start by exploring the repository structure to understand what we're working with.

  3. GLM Assistant

    This is a Rust project (Fallow linter). Let me explore the structure further.

  4. GLM Assistant

    There's a sfc_template directory. Let me explore it.

  5. GLM Assistant

    Now let me look at the svelte.rs and vue.rs files to understand the bound_targets concept and member access tracking.

  6. GLM Assistant

    The file is long. Let me look at the shared.rs file for the bound_targets handling.

  7. GLM Assistant

    Let me look at the template_usage.rs file to understand the bound_targets logic.

  8. GLM Assistant

    Now let me find where bound_targets is computed and how collect_template_usage_with_bound_targets is called.

  9. GLM Assistant

    Let me look at binding_target_names to understand what bound targets are detected.

  10. GLM Assistant

    Let me look at the apply_template_usage function in sfc.rs.

  11. GLM Assistant

    Let me look at how binding_target_names collects class instances in visit_impl.rs.

  12. GLM Assistant

    Let me look at how new SomeClass() creates a binding_target_names entry. Let me search for the relevant code.

  13. GLM Assistant

    Let me look at how member_accesses flow into unused-class-members analysis.

  14. GLM Assistant

    Let me look at the false_positive_fixes.rs integration test file.

  15. GLM Assistant

    Let me look at how member_accesses are matched against class members in unused_members.rs.

  16. GLM Assistant

    Let me look at the main accessed_members logic around line 1540.

  17. GLM Assistant

    Let me look at existing Svelte integration tests to understand the test setup.

  18. GLM Assistant

    There's an existing test that works for attribute handler case. Let me write a reproduction to check the markup expression case. First, let me see the parse_sfc helper.

  19. GLM Assistant

    Let me create a temporary reproduction test to check the markup expression case.

  20. GLM Assistant

    Let me check the tests module structure.

  21. GLM Assistant

    I need to register my repro module. Let me check the tests mod.rs and add it temporarily.

  22. GLM Assistant

    Now let me check the crate name for the extract crate (fallow_extract or fallow-extract).

  23. GLM Assistant

    Both simple cases pass. The issue must involve a more specific pattern. Let me look at the full svelte.rs apply_tag and apply_markup_tag functions.

  24. GLM Assistant

    Let me look at the helper functions merge_markup_brace_usage, merge_attribute_value_usage, and directive_binding_name.

  25. GLM Assistant

    The extraction layer works. The issue may be in the core analysis layer. Let me write a full integration test reproducing the end-to-end flow. Let me look at the integration test infrastructure.

  26. GLM Assistant

    There's a Vue fixture for this. Let me find the vue-project fixture and the Counter class setup.

  27. GLM Assistant

    Let me check if there's a svelte-project fixture with a similar pattern.

  28. GLM Assistant

    The svelte-project fixture has the same pattern. Let me check the existing tests for this fixture.

  29. GLM Assistant

    Let me search the changelog and repo for references to this issue or hister.

  30. GLM Assistant

    The existing tests use onclick={() => counter.bump()} (handler) and {counter.value} (property access). The issue is about method CALLS in markup text. Let me create a temp fixture to test the full integration flow end-to-end.

  31. GLM Assistant

    Now let me look at the common test helpers to write an integration test.

  32. GLM Assistant

    Let me check how the integration_test module is organized.

  33. GLM Assistant

    Let me create a temporary integration test and register it.

  34. GLM Assistant

    The new ResultState() pattern works end-to-end. The bug must be a different instantiation pattern. Let me examine the typed-instance-binding mechanism, since the issue says "when <local> resolves to an instance of the class".

  35. GLM Assistant

    This propagate_accesses_through_typed_instance_bindings handles the case where a class has a typed member like service: MyService and this.service.foo() is called. It uses class_heritage.instance_bindings. This is for the Angular DI case where constructor-injected services have types.

    Let me look at the rest of propagate_accesses_through_typed_instance_bindings.

  36. GLM Assistant

    Let me look at how INSTANCE_EXPORT_SENTINEL is emitted - this seems relevant for exported instances.

  37. GLM Assistant

    Let me look at how the INSTANCE_EXPORT_SENTINEL is emitted in visitor/mod.rs around line 470-510.

  38. GLM Assistant

    Let me check whether the SFC path calls the finalize steps like record_exported_instance_bindings. Let me look at merge_into and the finalize flow.

  39. GLM Assistant

    The SFC path handles in-file instances. Now let me test the SINGLETON pattern: an exported instance in a .ts file imported into Svelte. Let me update my fixture.

  40. GLM Assistant

    Interesting! With the singleton pattern, NOTHING is reported unused (including unusedMethod) - that's over-crediting. Let me look at the full propagate_accesses_through_instance_exports.

  41. GLM Assistant

    Let me test the Svelte 5 runes hypothesis - let resultState = $state(new ResultState()). Let me update the fixture.

  42. GLM Assistant

    I've reproduced the FP! With Svelte 5 runes let resultState = $state(new ResultState()), the methods are reported as unused because $state(new ResultState()) doesn't register resultState → ResultState in binding_target_names. Let me look at the visitor's variable declaration handling to find the right fix.

  43. GLM Assistant

    There's a try_extract_factory_new_class helper for wrapper patterns. Let me look at it.

  44. GLM Assistant

    I've reproduced the FP. Now let me check if there's existing handling for Svelte runes or type-preserving wrappers.

  45. GLM Assistant

    No existing rune handling. Let me check the oxc Argument enum variants to design the helper correctly.

  46. GLM Assistant

    Argument::as_expression() exists. Let me look at how it's used and check the existing helper file structure.

  47. GLM Assistant

    Let me look at the helpers.rs imports and the existing factory helper signature to design a new helper.

  48. GLM Assistant

    Let me verify the Argument::as_expression method and look at how the existing factory helper handles arguments.

  49. GLM Assistant

    Argument inherits all Expression variants including NewExpression, and as_expression() exists. Now let me implement the fix. First, add a helper in helpers.rs.

  50. GLM Assistant

    Let me add CallExpression to the helpers.rs imports and add the new helper function.

  51. GLM Assistant

    Now let me add the new helper function after the factory helper. Let me view the area after extract_new_class_from_return_body.

  52. GLM Assistant

    Now let me add the call site in visit_impl.rs after the array-destructure factory block.

  53. GLM Assistant

    Let me view the array-destructure block to find the insertion point.

  54. GLM Assistant

    Now let me build and run my reproduction test.

  55. GLM Assistant

    The fix works for $state. Let me also test Vue ref(new Counter()) and verify I haven't broken existing tests. Let me extend my temp test with a Vue ref case.

  56. GLM Assistant

    Both Svelte $state and Vue ref now work, and unused methods are still reported. Let me run the extract crate tests and broader SFC tests to check for regressions.

  57. GLM Assistant

    All extract tests pass. Now let me run the core SFC integration tests.

  58. GLM Assistant

    Now let me run the unused_members unit tests and the broader integration suite.

  59. GLM Assistant

    All 525 integration tests pass. Let me run the core lib tests and the full false_positive_fixes suite.

  60. GLM Assistant

    Let me check how resolve_bound_member_accesses handles chained access to ensure my fix doesn't mis-credit .value for refs.

  61. GLM Assistant

    Let me look at resolve_bound_object_name to understand chain handling.

  62. GLM Assistant

    Let me check how the visitor collects chained member accesses for counter.value.bump().

  63. GLM Assistant

    Let me check static_member_object_name.

  64. GLM Assistant

    Let me also test the prop-based scenario (export let resultState: ResultState) to see if it's also an FP and whether my fix covers it.

  65. GLM Assistant

    The general approach risks a .value false negative for Vue ref (which returns Ref<T>, needing .value). Svelte $state returns the instance directly. Let me make the helper use an allowlist of wrappers that return the instance directly (no .value/$ indirection). Let me update the helper.

  66. GLM Assistant

    Now let me update the temp Vue fixture to use reactive (in the allowlist) instead of ref.

  67. GLM Assistant

    All pass. Let me run the full extract and core test suites with the allowlist to confirm no regressions.

  68. GLM Assistant

    Let me also check the typed-local case (let resultState: ResultState with no init), which might be another FP pattern. Let me look at record_typed_binding and how typed bindings flow.

  69. GLM Assistant

    instance_bindings is a Vec<(String, String)> on ClassHeritageInfo (for class fields). record_typed_binding is for class members (constructor params / class fields). Let me check record_typed_binding to see if it ALSO handles module-level typed locals.

    Let me look at record_typed_binding.

  70. GLM Assistant

    record_typed_binding already handles typed locals (that's why the prop case works pre-existing). My fix fills exactly the $state/wrapper gap. Let me run the graph and cli test suites to be safe, since the visitor is shared.

  71. GLM Assistant

    One cli test failed - resolves_yarn_sidecar_without_node_modules_bin. This seems unrelated to my change. Let me verify it's pre-existing by stashing my changes.

  72. GLM Assistant

    When run in isolation (original code) it passes. Let me run the yarn test in isolation WITH my changes to check if it's a test-ordering/environment issue, not my change.

  73. GLM Assistant

    It passes in isolation with my changes too — it's a flaky test-ordering issue, not my change. Let me confirm by re-running the full cli lib suite.

  74. GLM Assistant

    Confirmed flaky — now passes. Let me run clippy and fmt checks since the repo enforces them.

  75. GLM Assistant

    The only clippy warnings are from my temp test file (which I'll remove). My actual changes are clean. Now let me clean up all temporary test files and fixtures.

  76. GLM Assistant

    Only my two source files are modified. Let me re-run clippy and fmt to confirm clean.

  77. GLM Assistant

    Clippy and fmt clean. Let me re-run the key test suites after cleanup to confirm everything passes.

  78. GLM Assistant

    Let me do a final end-to-end verification with a temp fixture, then remove it.

  79. GLM Assistant

    Let me fix the module registration - I'll place it after mod common;.

  80. GLM Assistant

    The fix works end-to-end. onOpen, pin, addSkipRule are credited; unusedMethod (and updateLabel which isn't called) correctly reported. Now let me clean up the temp verification files.

  81. GLM Assistant

    Only my two source files are modified. Let me do a final review of the diff.

  82. GLM Assistant

    The comment in visit_impl.rs mentions ref(new C()) which is actually excluded by my allowlist. Let me fix the comment to be accurate.

  83. GLM Assistant

    Clean. Let me run the final test suite to confirm.

  84. GLM Assistant

    All tests pass. Let me run the core lib tests once more and view the final diff.

  85. GLM Assistant

    All tests pass. Let me do a final review of the complete diff.

  86. GLM Assistant

    The CHANGELOG mentions cache version bumps for similar fixes (since member_accesses output changes). My fix changes binding_target_names → member_accesses output, so I should bump the extraction cache version. Let me find it.

  87. GLM Assistant

    I should bump the extraction cache version since my fix changes the extracted member_accesses output. Let me bump to 103.

  88. GLM Assistant

    Let me check if any tests assert on the cache version number that might break with the bump.

  89. GLM Assistant

    Let me check the extract cache tests that might reference the version number.

  90. GLM Assistant

    The cache tests use the constant, not hardcoded values, and my change doesn't alter struct sizes. Let me run the extract cache tests and full suite to confirm.

  91. GLM Assistant

    Let me run the core caching integration tests (they test cache round-trip/version invalidation).

  92. GLM Assistant

    All caching tests pass. Let me run fmt and clippy once more on the final changes.

  93. GLM Assistant

    Let me do a final full test run to confirm everything is green after all changes.

  94. GLM Assistant

    All green. Let me review the complete final diff.

  95. GLM Assistant

    Let me do a final check that no temporary files remain and confirm the final state.

  96. GLM Assistant

    Only the 3 source files are modified, no temp files remain. Let me run a couple more dependent-crate tests (lsp, config) to be thorough since the visitor is shared.

  97. GLM Assistant

    fallow-lsp is a binary crate. Let me run its tests.

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