Narrow match_arg overload to str-only when several_ok=False#51
Open
Copilot wants to merge 2 commits into
Open
Conversation
The first overload previously accepted `str | Iterable[str]` for the `arg` parameter when `several_ok=False`, but passing an Iterable with `several_ok=False` raises ValueError at runtime. This change narrows the type to just `str` so the type system correctly reflects the runtime behavior, catching invalid calls at type-check time. Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Overload match_arg based on several_ok
Narrow Mar 19, 2026
match_arg overload to str-only when several_ok=False
nathanjmcdougall
approved these changes
Mar 19, 2026
|
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.

0 New Issues
0 Fixed Issues
0 Accepted Issues
The first
match_argoverload acceptedstr | Iterable[str]forargwhenseveral_ok=False, but passing an iterable withseveral_ok=FalseraisesValueErrorat runtime. The type signature should reflect this constraint.argfromstr | Iterable[str]tostrin theseveral_ok: Literal[False]overload# type: ignore[call-overload]to tests that intentionally exercise the invalid-type error pathOriginal prompt
match_argshould be overloaded based onseveral_ok#31📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.