-
Notifications
You must be signed in to change notification settings - Fork 354
Open
Description
The following should be supported but isn't:
@Flag(help: "...")
var writeEmptyFiles: Bool?
The error is
Referencing initializer 'init(name:help:)' on 'Flag' requires the types 'Bool?' and 'Int' be equivalent
It turns out the inversion parameter is required, so the following works:
@Flag(inversion: .prefixedEnableDisable, help: "")
var writeEmptyFiles: Bool?
this seems somewhat accidental? Are we just missing an initializer with defaulted inversion?
ArgumentParser version: 0.1.0 or the main branch, for example.
Swift version: swift-driver version: 1.139 Apple Swift version 6.2 (swiftlang-6.3.0.101.15 clang-2100.0.101.15); arm64-apple-macosx26.0
Checklist
- Reproduces on main
- I've searched for existing GitHub issues
Steps to Reproduce
The snippets above are enough to repro
Expected behavior
We should support just @Flag() on optional boolean fields
Actual behavior
fails to compile
Metadata
Metadata
Assignees
Labels
No labels