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

Generic typed errors cannot be used without appearing outside the "throws argument". #74383

Open
JessyCatterwaul opened this issue Jun 13, 2024 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. typed throws Feature → error handling → throws & rethrows: Typed throws

Comments

@JessyCatterwaul
Copy link

JessyCatterwaul commented Jun 13, 2024

Description / Reproduction

If a generic error is "used in the function signature", the code compiles:

func ƒ<Error: Swift.Error>(_: Error) throws(Error) { }

But otherwise, no.

func ƒ<Error: Swift.Error>() throws(Error) { } // ❌ Generic parameter 'Error' is not used in function signature
func ƒ() throws(some Error) { } // ❌ 'some' types are only permitted in properties, subscripts, and functions

Expected behavior

SE-0413 says it should work.

Environment

swift-driver version: 1.109.2 Apple Swift version 6.0 (swiftlang-6.0.0.3.300 clang-1600.0.20.10)
Target: arm64-apple-macosx14.0

@JessyCatterwaul JessyCatterwaul added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels Jun 13, 2024
@hborla hborla added typed throws Feature → error handling → throws & rethrows: Typed throws and removed triage needed This issue needs more specific labels labels Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. typed throws Feature → error handling → throws & rethrows: Typed throws
Projects
None yet
Development

No branches or pull requests

2 participants