-
Notifications
You must be signed in to change notification settings - Fork 379
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
swift-format fails to parse valid swift code #2648
Comments
Synced to Apple’s issue tracker as rdar://127750606 |
This code is using typed throws, which isn't supported by any released Xcode compiler that I'm aware of (it's still an experimental feature last time I checked). Do the open-source builds enable it by default? Since we just use swift-syntax to parse, the error is coming out of there. We might need to provide a command line flag to pass experimental features through to swift-syntax's parser if we want to support pre-release syntax. |
Typed throws isn't experimental in main or 6.0, I assume this is just a swift-syntax parsing bug - will move to there. |
Lookahead was not consuming typed throw's error argument during lookahead for closures. `atFunctionTypeArrow` did mostly handle it, but only consumed a single token and thus wouldn't match `throws(any Error)`. Handle this in `consumeEffectsSpecifiers` and then use this for both. Fixes apple#2648. Resolves rdar://127750606.
Lookahead was not consuming typed throw's error argument during lookahead for closures. `atFunctionTypeArrow` did mostly handle it, but only consumed a single token and thus wouldn't match `throws(any Error)`. Handle this in `consumeEffectsSpecifiers` and then use this for both. Fixes apple#2648. Resolves rdar://127750606. (cherry picked from commit 5887f40)
Thanks for fixing this! |
The following snippet fails to parse in
swift-format
butswiftc
is able to compile it:repro:
The text was updated successfully, but these errors were encountered: