Skip to content

Rip designated types out of the AST #38728

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

Merged
merged 2 commits into from
Aug 4, 2021

Conversation

beccadax
Copy link
Contributor

@beccadax beccadax commented Aug 3, 2021

Designated types were removed from the constraint solver in #34315, but they are currently still represented in the AST and fully checked. This change removes them as completely as possible without breaking source compatibility (mainly with old swiftinterfaces) or changing the SwiftSyntax tree. Designated types are still parsed when the feature is enabled, but they are dropped immediately and a warning is diagnosed. During decl checking we also still check if the precedence group is really a designated type, but only so that we can diagnose a warning and fall back to DefaultPrecedence if a precedence group fails to resolve and designated types were enabled.

This change also fixes an apparent bug in the parser where we did not diagnose operator declarations that contained a : followed by a non-identifier token.

Part of work on #34556.

@beccadax beccadax requested a review from hborla August 3, 2021 05:32
@beccadax beccadax force-pushed the designated-survivor branch from 7661ef3 to 72cb1de Compare August 3, 2021 05:33
@beccadax
Copy link
Contributor Author

beccadax commented Aug 3, 2021

@swift-ci please test

@beccadax
Copy link
Contributor Author

beccadax commented Aug 3, 2021

@swift-ci please test

@slavapestov
Copy link
Contributor

Nice, thanks!

Designated types were removed from the constraint solver in swiftlang#34315, but they are currently still represented in the AST and fully checked. This change removes them as completely as possible without breaking source compatibility (mainly with old swiftinterfaces) or changing the SwiftSyntax tree. Designated types are still parsed, but they are dropped immediately and a warning is diagnosed. During decl checking we also still check if the precedence group is really a designated type, but only so that we can diagnose a warning and fall back to DefaultPrecedence.

This change also fixes an apparent bug in the parser where we did not diagnose operator declarations that contained a `:` followed by a non-identifier token.
It's not strictly necessary for source compatibility, since removing it just means that (in a not-officially-supported compiler mode) we will accept code we would previously have rejected.
@beccadax beccadax force-pushed the designated-survivor branch from ac0eccd to ec05421 Compare August 3, 2021 23:14
@beccadax
Copy link
Contributor Author

beccadax commented Aug 3, 2021

@swift-ci smoke test and merge

@swift-ci swift-ci merged commit 6964a7d into swiftlang:main Aug 4, 2021
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.

4 participants