// RUN: %target-typecheck-verify-swift protocol AnyPropertyProtocol { associatedtype Root = Any associatedtype Value = Any associatedtype KP: AnyKeyPath var key: KP { get } var value: Value { get } } protocol PartialPropertyProtocol: AnyPropertyProtocol where KP: PartialKeyPath { } protocol PropertyProtocol: PartialPropertyProtocol where KP: WritableKeyPath { } extension Dictionary where Value: AnyPropertyProtocol { subscript(key: Key, path: WritableKeyPath) -> P? where P: PropertyProtocol, P.Root == R, P.Value == V { return self[key] as? P } }