Skip to content

Commit

Permalink
Fix for @Option(transform:) with optional type (apple#619)
Browse files Browse the repository at this point in the history
Due to the restructuring in apple#477, there was ambiguity between the
unconstrained `@Option` initializer that uses a transform (but no
initial value) and the one that is constrained to the property being
optional. This marks the unconstrained version as disfavored, which
allows overload resolution to select the optional version when
appropriate.

Also fixes this for `@Argument` and improves documentation
consistency for `@Option`.

Fixes apple#618.
Rate limit · GitHub

Access has been restricted

You have triggered a rate limit.

Please wait a few minutes before you try again;
in some cases this may take up to an hour.

natecook1000 authored Mar 5, 2024
1 parent 1c8215f commit 7191549
Showing 4 changed files with 200 additions and 98 deletions.
Original file line number Diff line number Diff line change
@@ -2,15 +2,15 @@

## Topics

### Single Options
### Single-Value Options

- ``init(name:parsing:help:completion:)-7slrf``
- ``init(name:parsing:help:completion:)-4yske``
- ``init(name:parsing:help:completion:)-7slrf``
- ``init(wrappedValue:name:parsing:help:completion:)-7ilku``
- ``init(name:parsing:help:completion:transform:)-2wf44``
- ``init(name:parsing:help:completion:transform:)-25g7b``
- ``init(wrappedValue:name:parsing:help:completion:transform:)-2llve``
- ``SingleValueParsingStrategy``
- ``init(wrappedValue:name:parsing:help:completion:)-7ilku``

### Array Options

1 change: 1 addition & 0 deletions Sources/ArgumentParser/Parsable Properties/Argument.swift
Original file line number Diff line number Diff line change
@@ -414,6 +414,7 @@ extension Argument {
/// - transform: A closure that converts a string into this property's
/// element type or throws an error.
@preconcurrency
@_disfavoredOverload
public init(
help: ArgumentHelp? = nil,
completion: CompletionKind? = nil,
Rate limit · GitHub

Access has been restricted

You have triggered a rate limit.

Please wait a few minutes before you try again;
in some cases this may take up to an hour.

0 comments on commit 7191549

Please sign in to comment.