Skip to content

Conversation

@radik878
Copy link

  • The small-vector branch of get_var_loc always returned Err, even when the searched Variable existed, causing AddAssign<(F, Variable)> to insert duplicates instead of summing coefficients.
  • This change aligns the linear-search behavior with binary_search semantics: Ok(i) when equal, Err(i) at the first greater element, Err(len) if not found.
  • Ensures LC invariants during incremental construction for short combinations and prevents duplicate entries that inflate LC weight.

@Pratyush
Copy link
Member

Can you please add a test which demonstrates that the old code was broken? Ideally by splitting the change into two commits: the first with the test, and the second with the fix?

@radik878
Copy link
Author

Can you please add a test which demonstrates that the old code was broken? Ideally by splitting the change into two commits: the first with the test, and the second with the fix?

Added a test case, but wanted to ask you, is this ok if the first commit with the fix, and second with test? or it neccessarily shoud be first with test and second with fix?

@Pratyush
Copy link
Member

Sure.

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.

2 participants