Skip to content

Initializers for joining a sequence of predicates#1878

Open
MatthewTurk247 wants to merge 6 commits intoswiftlang:mainfrom
MatthewTurk247:initializers-join-predicates
Open

Initializers for joining a sequence of predicates#1878
MatthewTurk247 wants to merge 6 commits intoswiftlang:mainfrom
MatthewTurk247:initializers-join-predicates

Conversation

@MatthewTurk247
Copy link
Copy Markdown
Contributor

This pull request implements the initializers proposed in #1860.

Testing:

See PredicateTests/all() and PredicateTests/any().

@MatthewTurk247 MatthewTurk247 requested a review from a team as a code owner April 4, 2026 02:53
Comment thread Tests/FoundationEssentialsTests/PredicateTests.swift
Comment thread Tests/FoundationEssentialsTests/PredicateTests.swift
@jmschonfeld
Copy link
Copy Markdown
Contributor

@swift-ci please test

@jmschonfeld
Copy link
Copy Markdown
Contributor

The build failures look to be caused by this change:

/__w/swift-foundation/swift-foundation/Sources/FoundationEssentials/Predicate/Predicate.swift:59:90: error: static method 'build_evaluate' requires the types 'PredicateExpressions.PredicateRegex' and 'Expression<repeat each Input, Bool>' be equivalent

@MatthewTurk247
Copy link
Copy Markdown
Contributor Author

Type inference is not working as I was expecting. I’ll add explicit annotations.

Comment thread Sources/FoundationEssentials/Predicate/Predicate.swift Outdated
@jmschonfeld
Copy link
Copy Markdown
Contributor

@swift-ci please test

@MatthewTurk247
Copy link
Copy Markdown
Contributor Author

Is there an issue with platform availability behind the failed method resolution? I’m starting to suspect that the build routine is not picking up symbols for PredicateExpressions.PredicateEvaluate.

@jmschonfeld
Copy link
Copy Markdown
Contributor

Is there an issue with platform availability behind the failed method resolution? I’m starting to suspect that the build routine is not picking up symbols for PredicateExpressions.PredicateEvaluate.

Ah I think this error message has the key detail:

/__w/swift-foundation/swift-foundation/Sources/FoundationEssentials/Predicate/Predicate.swift:60:90: error: referencing static method 'build_evaluate' on 'PredicateExpressions.Value' requires that 'Predicate<repeat each Input>' conform to 'Decodable'

I had forgotten that Predicate's conformance to Codable is gated behind FOUNDATION_FRAMEWORK because of dependencies not available in swift-foundation. Since StandardPredicateExpression requires a Codable conformance that means that the PredicateEvaluate operator also isn't available outside of FOUNDATION_FRAMEWORK. For now, I think we'll need to put this new API behind FOUNDATION_FRAMEWORK and separately we can investigate finding a way to lift that restriction

@jmschonfeld
Copy link
Copy Markdown
Contributor

@swift-ci please test

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