Skip to content

fix: handle declaration merging and function overloads correctly#13

Merged
TonyStef merged 1 commit intomainfrom
fix/declaration-merging-overloads
Mar 24, 2026
Merged

fix: handle declaration merging and function overloads correctly#13
TonyStef merged 1 commit intomainfrom
fix/declaration-merging-overloads

Conversation

@TonyStef
Copy link
Copy Markdown
Owner

Summary

  • Declaration merging: interface User { name } + interface User { age } — removing one declaration now correctly flags as modified (not deleted), since User still exists via the other declaration.
  • Deduplication: Deleted files with multiple declarations of the same symbol produce one deletion entry, not one per declaration.
  • Signature comparison: Uses group-based comparison (sorted signature sets) instead of comparing individual old symbols against a single Map entry. Prevents false modification flags.
  • Function overloads: Overload signatures (without body) aren't extracted by tree-sitter — only the implementation is tracked. Removing an overload while keeping the implementation is correctly invisible. Documented in test.

Test plan

  • 58/58 tests pass (2 new integration tests)
  • Typecheck clean
  • Biome lint clean
  • Build clean

- Group symbols by name+kind before comparing old vs new file versions.
  A symbol is deleted only when ALL declarations are removed, not when
  one of several merged declarations disappears.
- Deduplicate deleted symbols for fully removed files (2 interface User
  declarations → 1 deletion, not 2).
- Compare signature sets across groups: if the set of signatures changed,
  flag as modified. Prevents false modification flags from comparing
  individual declarations against a single map entry.
- Function overload signatures (without body) are not extracted by
  tree-sitter — only the implementation function is tracked. Removing
  an overload signature while keeping the implementation is correctly
  invisible to the tool.
@TonyStef TonyStef merged commit 0a578c4 into main Mar 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant