fix(Foundation): implement valueForKey: for CPSet KVC compliance

Resolves testKVCCountSetOperators failure in CPSetTest. The previous implementation lacked an override for valueForKey:, causing the runtime to fall back to the default CPObject behavior, which failed to recognize KVC collection operators (e.g., @count).

Delegating valueForKey: to valueForKeyPath: ensures that CPSet correctly routes KVC operations through the existing collection operator logic.
This commit is contained in:
David Richardson committed 2026-07-08 18:28:49 -06:00
1 parent a240d312d0
commit da3b0b5e21
1 file changed
+8
+8
View File
@@ -226,6 +226,14 @@
}
}
- (id)valueForKey:(CPString)aKey
{
// If the key starts with @, it is an operator path.
// If not, it is a property path that we want applied to all members.
// In either case, valueForKeyPath: handles both scenarios correctly.
return [self valueForKeyPath:aKey];
}
- (void)setValue:(id)aValue forKey:(CPString)aKey
{
var containedObject,