Skip to content

Use a consistent definition for unreachable code in macro expansions. #1166

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

grynspan
Copy link
Contributor

@grynspan grynspan commented Jun 20, 2025

This PR defines a single ExprSyntax instance we can use for unreachable code paths in macro expansions (where the compiler/swift-syntax requires us to produce an expression but we know we're going to emit an error anyway.)

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

This PR defines a single `ExprSyntax` instance we can use for unreachable code
paths in macro expansions (where the compiler/swift-syntax requires us to
produce an expression but we know we're going to emit an error anyway.)
@grynspan grynspan added this to the Swift 6.x milestone Jun 20, 2025
@grynspan grynspan self-assigned this Jun 20, 2025
@grynspan grynspan requested a review from stmontgomery as a code owner June 20, 2025 21:22
@grynspan grynspan added the enhancement New feature or request label Jun 20, 2025
@grynspan grynspan added the macros 🔭 Related to Swift macros such as @Test or #expect label Jun 20, 2025
@grynspan
Copy link
Contributor Author

@swift-ci test

@@ -13,6 +13,8 @@ public import SwiftSyntax
import SwiftSyntaxBuilder
public import SwiftSyntaxMacros

private import MachO.dyld
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is from some unrelated experimenting. Will delete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request macros 🔭 Related to Swift macros such as @Test or #expect
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant