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

Parse most of the # things (#line, #keyPath, #colorLiteral, etc.) as macro expansion expressions #1123

Closed
wants to merge 4 commits into from

Conversation

DougGregor
Copy link
Member

All of these custom expression kinds can be represented by macro expansion expressions, so drop their custom syntax nodes and parsing logic and use the general macro-expansion expression nodes.

@DougGregor DougGregor requested a review from ahoppen as a code owner December 7, 2022 22:26
@DougGregor
Copy link
Member Author

@swift-ci please test

Instead, they'll be parsed as a macro expansion expression.
... along with __LINE__, __FILE__, etc., which have no business being
keywords. This can be handled in semantic analysis.
@DougGregor
Copy link
Member Author

swiftlang/swift#62489

@swift-ci please test

@DougGregor
Copy link
Member Author

And... this breaks swift-format:

user/build/buildbot_incremental/unified-swiftpm-build-linux-x86_64/x86_64-unknown-linux-gnu/release/SwiftFormatRules.build/ValidateDocumentationComments.swift.o -o /home/build-user/build/buildbot_incremental/unified-swiftpm-build-linux-x86_64/x86_64-unknown-linux-gnu/release/SwiftFormatRules.build/VarDeclSyntax+Convenience.swift.o/home/build-user/swift-format/Sources/SwiftFormatPrettyPrint/TokenStreamCreator.swift:1212:31: error: cannot find type 'ObjcKeyPathExprSyntax' in scope  override func visit(_ node: ObjcKeyPathExprSyntax) -> SyntaxVisitorContinueKind {                              ^~~~~~~~~~~~~~~~~~~~~/home/build-user/swift-format/Sources/SwiftFormatPrettyPrint/TokenStreamCreator.swift:1212:17: error: method does not override any method from its superclass  override func visit(_ node: ObjcKeyPathExprSyntax) -> SyntaxVisitorContinueKind {  ~~~~~~~~      ^/home/build-user/swift-format/Sources/SwiftFormatPrettyPrint/TokenStreamCreator.swift:1216:31: error: cannot find type 'ObjectLiteralExprSyntax' in scope  override func visit(_ node: ObjectLiteralExprSyntax) -> SyntaxVisitorContinueKind {                              ^~~~~~~~~~~~~~~~~~~~~~~/home/build-user/swift-format/Sources/SwiftFormatPrettyPrint/TokenStreamCreator.swift:1216:17: error: method does not override any method from its superclass  override func visit(_ node: ObjectLiteralExprSyntax) -> SyntaxVisitorContinueKind {  ~~~~~~~~      ^/home/build-user/swift-format/Sources/SwiftFormatPrettyPrint/TokenStreamCreator.swift:1411:31: error: cannot find type 'ObjcSelectorExprSyntax' in scope  override func visit(_ node: ObjcSelectorExprSyntax) -> SyntaxVisitorContinueKind {                              ^~~~~~~~~~~~~~~~~~~~~~/home/build-user/swift-format/Sources/SwiftFormatPrettyPrint/TokenStreamCreator.swift:1411:17: error: method does not override any method from its superclass  override func visit(_ node: ObjcSelectorExprSyntax) -> SyntaxVisitorContinueKind {  ~~~~~~~~      ^/home/build-user/swift-format/Sources/SwiftFormatPrettyPrint/TokenStreamCreator.swift:2008:31: error: cannot find type 'ObjcNamePieceSyntax' in scope  override func visit(_ node: ObjcNamePieceSyntax) -> SyntaxVisitorContinueKind {                              ^~~~~~~~~~~~~~~~~~~/home/build-user/swift-format/Sources/SwiftFormatPrettyPrint/TokenStreamCreator.swift:2008:17: error: method does not override any method from its superclass  override func visit(_ node: ObjcNamePieceSyntax) -> SyntaxVisitorContinueKind {  ~~~~~~~~      ^/home/build-user/swift-format/Sources/SwiftFormatPrettyPrint/TokenStreamCreator.swift:2012:31: error: cannot find type 'PoundFileExprSyntax' in scope  override func visit(_ node: PoundFileExprSyntax) -> SyntaxVisitorContinueKind {                              ^~~~~~~~~~~~~~~~~~~/home/build-user/swift-format/Sources/SwiftFormatPrettyPrint/TokenStreamCreator.swift:2012:17: error: method does not override any method from its superclass  override func visit(_ node: PoundFileExprSyntax) -> SyntaxVisitorContinueKind {  ~~~~~~~~      ^/home/build-user/swift-format/Sources/SwiftFormatPrettyPrint/TokenStreamCreator.swift:2016:31: error: cannot find type 'PoundLineExprSyntax' in scope  override func visit(_ node: PoundLineExprSyntax) -> SyntaxVisitorContinueKind {                              ^~~~~~~~~~~~~~~~~~~/home/build-user/swift-format/Sources/SwiftFormatPrettyPrint/TokenStreamCreator.swift:2016:17: error: method does not override any method from its superclass  override func visit(_ node: PoundLineExprSyntax) -> SyntaxVisitorContinueKind {  ~~~~~~~~      ^/home/build-user/swift-format/Sources/SwiftFormatPrettyPrint/TokenStreamCreator.swift:2111:31: error: cannot find type 'PoundColumnExprSyntax' in scope  override func visit(_ node: PoundColumnExprSyntax) -> SyntaxVisitorContinueKind {                              ^~~~~~~~~~~~~~~~~~~~~/home/build-user/swift-format/Sources/SwiftFormatPrettyPrint/TokenStreamCreator.swift:2111:17: error: method does not override any method from its superclass  override func visit(_ node: PoundColumnExprSyntax) -> SyntaxVisitorContinueKind {  ~~~~~~~~      ^/home/build-user/swift-format/Sources/SwiftFormatPrettyPrint/TokenStreamCreator.swift:2176:31: error: cannot find type 'PoundFunctionExprSyntax' in scope  override func visit(_ node: PoundFunctionExprSyntax) -> SyntaxVisitorContinueKind {                              ^~~~~~~~~~~~~~~~~~~~~~~/home/build-user/swift-format/Sources/SwiftFormatPrettyPrint/TokenStreamCreator.swift:2176:17: error: method does not override any method from its superclass  override func visit(_ node: PoundFunctionExprSyntax) -> SyntaxVisitorContinueKind {  ~~~~~~~~      ^/home/build-user/swift-format/Sources/SwiftFormatPrettyPrint/TokenStreamCreator.swift:2245:31: error: cannot find type 'PoundDsohandleExprSyntax' in scope  override func visit(_ node: PoundDsohandleExprSyntax) -> SyntaxVisitorContinueKind {                              ^~~~~~~~~~~~~~~~~~~~~~~~/home/build-user/swift-format/Sources/SwiftFormatPrettyPrint/TokenStreamCreator.swift:2245:17: error: method does not override any method from its superclass  override func visit(_ node: PoundDsohandleExprSyntax) -> SyntaxVisitorContinueKind {  ~~~~~~~~      ^FAIL: Building swift-format failed

@DougGregor
Copy link
Member Author

Much of this is getting subsumed into #1132

@DougGregor DougGregor closed this Jan 27, 2023
@DougGregor DougGregor deleted the remove-pound-thingies branch January 27, 2023 05:27
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.

2 participants