Skip to content

Commit 64cc317

Browse files
committed
1 parent 826ba58 commit 64cc317

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/Generics/sr12531.swift

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// RUN: %target-typecheck-verify-swift
2+
3+
protocol AnyPropertyProtocol {
4+
associatedtype Root = Any
5+
associatedtype Value = Any
6+
associatedtype KP: AnyKeyPath
7+
var key: KP { get }
8+
var value: Value { get }
9+
}
10+
11+
protocol PartialPropertyProtocol: AnyPropertyProtocol
12+
where KP: PartialKeyPath<Root> {
13+
}
14+
15+
protocol PropertyProtocol: PartialPropertyProtocol
16+
where KP: WritableKeyPath<Root, Value> {
17+
}
18+
19+
extension Dictionary where Value: AnyPropertyProtocol {
20+
subscript<R, V, P>(key: Key, path: WritableKeyPath<R, V>) -> P? where P: PropertyProtocol, P.Root == R, P.Value == V {
21+
return self[key] as? P
22+
}
23+
}

0 commit comments

Comments
 (0)