Skip to content

fix: include first overload when searching for matching completions - #118

Merged
bobbylight merged 1 commit into
masterfrom
fix/issue-101-overload-search-off-by-one
Aug 3, 2026
Merged

fix: include first overload when searching for matching completions#118
bobbylight merged 1 commit into
masterfrom
fix/issue-101-overload-search-off-by-one

Conversation

@bobbylight

Copy link
Copy Markdown
Owner

Summary

  • Fixes an off-by-one error in AbstractCompletionProvider.getCompletionsImpl() where the backward search for sibling overloads used pos>0 instead of pos>=0, causing the completion at index 0 of a matching group to be silently dropped from results.
  • Adds a regression test that reproduces the bug with three completions sharing the same input text.

Fixes #101

Test plan

  • Added AbstractCompletionProviderTest#getCompletions_allOverloadsReturned_evenTheFirstOneInTheList, verified it fails against the pre-fix code and passes with the fix.
  • ./gradlew :AutoComplete:test passes.

The backward search for sibling overloads in getCompletionsImpl()
stopped at pos>0 instead of pos>=0, so the completion at index 0 of
a matching group was never checked or added, even when it matched.

Fixes #101
@bobbylight
bobbylight marked this pull request as ready for review August 3, 2026 01:34
@bobbylight bobbylight self-assigned this Aug 3, 2026
@bobbylight bobbylight added the bug label Aug 3, 2026
@bobbylight bobbylight added this to the 4.0.0 milestone Aug 3, 2026
@bobbylight
bobbylight merged commit fbbd2e2 into master Aug 3, 2026
4 checks passed
@bobbylight
bobbylight deleted the fix/issue-101-overload-search-off-by-one branch August 3, 2026 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Why the the pos must be greater than 0?

1 participant