Fix positional skipping for grouped conflicts with allow_missing_positional#6378
Draft
jeremy99981 wants to merge 2 commits into
Draft
Fix positional skipping for grouped conflicts with allow_missing_positional#6378jeremy99981 wants to merge 2 commits into
jeremy99981 wants to merge 2 commits into
Conversation
Member
|
Moving to a draft as #1794 is not marked as being ready for implementation. |
ded0f67 to
03ffbe1
Compare
Author
|
Thanks for the heads-up, understood. I’ll keep this as draft until #1794 is marked ready for implementation. |
Member
|
@jeremy99981 Design needs to be agreed upon first in the issue. Can you please add a detailed comment about your design on that issue? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes #1794.
Problem:
When
allow_missing_positional(true)is used with anArgGroup, values can still be assigned to a positional that conflicts with an already-present option from the same group. In multi-positional cases, this causes an avoidableArgumentConflictinstead of advancing to the next valid positional.Cause:
Positional skipping logic only considered syntax cues (like whether the next token looked like an option/subcommand), not whether the current positional was already in conflict with arguments that had been parsed.
Solution:
allow_missing_positionalis enabled.ArgGroupmembership conflicts.issue_1794parse-behavior test and add a new regression test for multiple conflicting positionals (pos1,pos2,option1) ensuring the value lands onpos3.Testing:
cargo test --test builder issue_1794 -- --nocapturecargo test --test builder groups::cargo test --test builder allow_missing_positionalcargo fmt --all --checkcargo test --test builderNotes:
If this issue is still eligible for the IssueHunt bounty, I’m happy to follow the project’s normal bounty redemption process after review and merge.