Skip to content

Add missing @Flag initializer in example#657

Merged
natecook1000 merged 1 commit into
apple:mainfrom
cg-soft:main
Jul 29, 2024
Merged

Add missing @Flag initializer in example#657
natecook1000 merged 1 commit into
apple:mainfrom
cg-soft:main

Conversation

@cg-soft
Copy link
Copy Markdown
Contributor

@cg-soft cg-soft commented Jul 26, 2024

The documentation as presented doesn't compile. An initializer is required for a boolean flag.

rdar://132579907

Checklist

  • I've added at least one test that validates that my change is working, if appropriate
  • I've followed the code style of the rest of the project
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary

The documentation as presented doesn't compile. An initializer is
required for a boolean flag.

rdar://132579907
@rauhul
Copy link
Copy Markdown
Collaborator

rauhul commented Jul 26, 2024

I can't remember if omitting the initial value is intended to work, @natecook1000 do you recall?

@cg-soft
Copy link
Copy Markdown
Contributor Author

cg-soft commented Jul 29, 2024

@rauhul it definitely does not work. Leaving out the initial value makes it assume it's an Int, and I get this error:

error: property type 'Bool' does not match 'wrappedValue' type 'Int'
    var verbose: Bool
        ^~~~~~~

@natecook1000
Copy link
Copy Markdown
Member

Right! I think you can only omit the default false value when you specify an inversion (like a --foo/--no-foo pair), which makes specifying one of those values required.

@natecook1000 natecook1000 enabled auto-merge (squash) July 29, 2024 20:41
@natecook1000
Copy link
Copy Markdown
Member

@swift-ci Please test

@natecook1000 natecook1000 merged commit e3d8a3d into apple:main Jul 29, 2024
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.

3 participants