Skip to content

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