Skip to content

Add predicate keypath assertion exit tests #1476

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

Conversation

jmschonfeld
Copy link
Contributor

As a followup to #1475, this adds exit tests to validate situations when we should be preventing usage of a particular keypath (specifically, when a keypath is multiple components or when it represents optional chaining or subscripts).

Adding these tests uncovered that the default value of restrictArguments in _validatedForPredicateUsage was incorrect and that we weren't actually validating that subscripts with arguments can't be used. In addition to adding these tests, this fixes the default value of this argument so that in cases where we don't expect arguments we enforce that they cannot be used.

@jmschonfeld
Copy link
Contributor Author

@swift-ci please test

@jmschonfeld jmschonfeld merged commit 4cdbaf6 into swiftlang:main Aug 21, 2025
19 checks passed
@jmschonfeld jmschonfeld deleted the predicate-keypath-assertion-validation branch August 21, 2025 20:24
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