Skip to content

Update remaining Predicate tests to use the #Predicate macro #299

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 1 commit into from
Oct 26, 2023

Conversation

jmschonfeld
Copy link
Contributor

This updates the last of the predicate tests to use #Predicate instead of manual construction and removes the windows restrictions for usage of the macro

@jmschonfeld
Copy link
Contributor Author

@swift-ci please test

Comment on lines +17 to +23
#if !FOUNDATION_FRAMEWORK
// Resolve ambiguity between Foundation.#Predicate and FoundationEssentials.#Predicate
@freestanding(expression)
@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
macro Predicate<each Input>(_ body: (repeat each Input) -> Bool) -> Predicate<repeat each Input> = #externalMacro(module: "FoundationMacros", type: "PredicateMacro")
#endif

Copy link
Contributor

Choose a reason for hiding this comment

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

Sigh... we can't switch to swift-testing fast enough.. do we have to do this for every test file?

Copy link
Contributor Author

@jmschonfeld jmschonfeld Oct 25, 2023

Choose a reason for hiding this comment

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

Luckily this is the only file that uses this macro (in non-FOUNDATION_FRAMEWORK code) so at least for now it's a non-issue, and I think it still might work in other files too (since the macro's visibility is internal) but I'm not certain

@jmschonfeld
Copy link
Contributor Author

Looks like the usage of the macro triggered a compiler crash. That crash should be resolved by swiftlang/swift-syntax#2312 (since similar crashes were successfully resolved by a similar change for SwiftPM plugins) so I'll hang onto this until a snapshot with the swift-syntax fix lands

@jmschonfeld
Copy link
Contributor Author

We've determined that the Linux CI failure is indeed due to this swift-syntax issue, and is affecting the main branch already (i.e. it is not directly caused by this PR). Seeing that macOS passed, I'm merging this to update our tests with the known linux failure already happening on main.

@jmschonfeld jmschonfeld merged commit 95a115f into swiftlang:main Oct 26, 2023
@jmschonfeld jmschonfeld deleted the predicate-test-with-macro branch October 26, 2023 16:51
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