Skip to content

Conversation

CodaFi
Copy link
Contributor

@CodaFi CodaFi commented Aug 4, 2022

This represents labeled statements as an explicit kind of statement and removes the Labeled trait. Any kind of statement is allowed to be labeled in the tree, but we specifically diagnose the syntax elements that aren't allowed to have labels. This homogenizes the way clients deal with statement labels and also makes parser recovery quite a bit easier in the case where we have a label but no actual statement following it.

@CodaFi
Copy link
Contributor Author

CodaFi commented Aug 4, 2022

swiftlang/swift-syntax#556

@swift-ci please smoke test

@CodaFi
Copy link
Contributor Author

CodaFi commented Aug 4, 2022

swiftlang/swift-syntax#556

@swift-ci please smoke test

@CodaFi CodaFi closed this Aug 4, 2022
@CodaFi CodaFi reopened this Aug 4, 2022
Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like an improvement to me 👍

@CodaFi
Copy link
Contributor Author

CodaFi commented Aug 5, 2022

swiftlang/swift-syntax#556

@swift-ci please smoke test

@CodaFi
Copy link
Contributor Author

CodaFi commented Aug 5, 2022

swiftlang/swift-syntax#556

@swift-ci please smoke test macOS

1 similar comment
@CodaFi
Copy link
Contributor Author

CodaFi commented Aug 5, 2022

swiftlang/swift-syntax#556

@swift-ci please smoke test macOS

This represents labeled statements as an explicit kind of statement and removes the Labeled trait. Any kind of statement is allowed to be labeled in the tree, but we specifically diagnose the syntax elements that aren't allowed to have labels. This homogenizes the way clients deal with statement labels and also makes parser recovery quite a bit easier in the case where we have a label but no actual statement following it.
@CodaFi
Copy link
Contributor Author

CodaFi commented Aug 5, 2022

swiftlang/swift-syntax#556

@swift-ci please smoke test macOS

@CodaFi
Copy link
Contributor Author

CodaFi commented Aug 5, 2022

swiftlang/swift-syntax#556

@swift-ci please smoke test

@CodaFi CodaFi merged commit 7fbcd8f into swiftlang:main Aug 6, 2022
@CodaFi CodaFi deleted the label-maker branch August 6, 2022 01:42
Comment on lines 21 to +23
# while-stmt -> label? ':'? 'while' condition-list code-block ';'?
Node('WhileStmt', kind='Stmt',
traits=['WithCodeBlock', 'Labeled'],
traits=['WithCodeBlock'],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the specifications be updated as well?

Copy link
Contributor Author

@CodaFi CodaFi Sep 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What specification are you referring to? The "grammar" is still correct - we don't necessarily want the notion of a "labeled statement" in the formal grammar since not all the statements support labels!

Copy link
Collaborator

@AnthonyLatsis AnthonyLatsis Sep 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was referring to the comment in the above preview (ditto the other nodes you modified), not the actual grammar in the language reference, although, curiously, it does have a notion of a labeled statement too.

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