Skip to content

Don't use #_sourceLocation in the fallback event handler.#1609

Merged
grynspan merged 5 commits intomainfrom
jgrynspan/169296255-sourceLocation-in-fallback-handler
Mar 5, 2026
Merged

Don't use #_sourceLocation in the fallback event handler.#1609
grynspan merged 5 commits intomainfrom
jgrynspan/169296255-sourceLocation-in-fallback-handler

Conversation

@grynspan
Copy link
Contributor

@grynspan grynspan commented Mar 5, 2026

We can't use our own macros in the Testing target because they aren't available when we build the toolchain.

Update the expansion of #_sourceLocation to detect it's being used in one of our own library targets and emit an error.

Resolves rdar://171774246.

Checklist:

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

We can't use our own macros in the Testing target because they aren't available
when we build the toolchain.

Update the expansion of `#_sourceLocation` to detect it's being used in one of
our own library targets and emit an error.

Resolves rdar://169296255.
@grynspan grynspan added this to the Swift 6.4.0 (main) milestone Mar 5, 2026
@grynspan grynspan self-assigned this Mar 5, 2026
@grynspan grynspan added bug 🪲 Something isn't working build 🧱 Affects the project's build configuration or process macros 🔭 Related to Swift macros such as @Test or #expect interoperability ↔️ Work related to Swift Testing and XCTest interoperability labels Mar 5, 2026
Copy link
Contributor

@harlanhaskins harlanhaskins left a comment

Choose a reason for hiding this comment

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

Clever use of compiler conditions to prevent this bug in the future, nice

@grynspan grynspan requested a review from stmontgomery March 5, 2026 16:34
@stmontgomery
Copy link
Contributor

(For tracking purposes) Fallout from #1523

@finagolfin
Copy link
Member

I just ran into this build error when trying to build latest trunk locally on macOS, thought maybe I did something wrong. 😄 May help to set up some kind of nightly snapshot CI using build-script to build this repo, as that would likely have turned up this bug during PR testing.

@grynspan
Copy link
Contributor Author

grynspan commented Mar 5, 2026

I just ran into this build error when trying to build latest trunk locally on macOS, thought maybe I did something wrong. 😄 May help to set up some kind of nightly snapshot CI using build-script to build this repo, as that would likely have turned up this bug during PR testing.

I'd have to defer to our CI wranglers on that topic.

@grynspan grynspan merged commit 70db9ce into main Mar 5, 2026
27 checks passed
@github-project-automation github-project-automation bot moved this from In progress to Done in [Swift Testing] Interoperability Mar 5, 2026
@grynspan grynspan deleted the jgrynspan/169296255-sourceLocation-in-fallback-handler branch March 5, 2026 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🪲 Something isn't working build 🧱 Affects the project's build configuration or process interoperability ↔️ Work related to Swift Testing and XCTest interoperability macros 🔭 Related to Swift macros such as @Test or #expect

Projects

Development

Successfully merging this pull request may close these issues.

5 participants