Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug assert to catch AsyncParseableCommand hierarchy issues #433

Closed
rauhul opened this issue Mar 25, 2022 · 4 comments
Closed

Debug assert to catch AsyncParseableCommand hierarchy issues #433

rauhul opened this issue Mar 25, 2022 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@rauhul
Copy link
Contributor

rauhul commented Mar 25, 2022

It would be nice to add a code path in debug mode that asserts if a user has accidentally included an AsyncParseableCommand nested under a Sync one, as the async run entry point will not be called in this case.

@rauhul rauhul added enhancement New feature or request good first issue Good for newcomers labels Mar 25, 2022
@KeithBird
Copy link
Contributor

It would be nice to add a code path in debug mode that asserts if a user has accidentally included an AsyncParseableCommand nested under a Sync one, as the async run entry point will not be called in this case.

typo: AsyncParseableCommand -> AsyncParsableCommand 😊

@KeithBird
Copy link
Contributor

Does the following code correctly express this issue?

struct Math: ParsableCommand {
  static var configuration = CommandConfiguration(
    subcommands: [Add.self]
  )

  struct Add: AsyncParsableCommand {
    @Argument() var values: [Int] = []
  }
}

// Error: `Add` subcommand can't run asynchronously in `Math`

@MarcoEidinger
Copy link
Contributor

@rauhul is the issue fixed with #436 ? Then issue can be closed

@rauhul
Copy link
Contributor Author

rauhul commented Aug 7, 2022

Yes, good catch, verified locally.

@rauhul rauhul closed this as completed Aug 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants