-
Notifications
You must be signed in to change notification settings - Fork 202
Description
KeyPaths with computed components can contain arguments if the component is a subscript component. PredicateExpressions.KeyPath
does not support subscript keypaths (the subscript operator is used instead) and so _validateForPredicateUsage
should validate that a computed component does not contain arguments. However, arguments are also used to pass generic constraints (in the case where a keypath is rooted on a generic type, for example). When validating arguments don't exist, we need to ensure that we do allow cases where all arguments are generic arguments rather than concrete values passed to a subscript.
This distinction should be able to be determined by examining the witness table pointer in the computed component. For KeyPaths with actual argument values for subscripts, the witness table pointer will point to a concrete witness table for the value(s). However, if only generic arguments are used, the witness table pointer will be the global swift_keyPathGenericWitnessTable
. We should allow arguments iff. the witness table pointer is NULL or is a pointer to swift_keyPathGenericWitnessTable
.