You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/Constraints/keypath.swift
+21Lines changed: 21 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -34,3 +34,24 @@ class Demo {
34
34
letsome=Some(keyPath: \Demo.here)
35
35
// expected-error@-1 {{cannot convert value of type 'ReferenceWritableKeyPath<Demo, (() -> Void)?>' to expected argument type 'KeyPath<_, ((_) -> Void)?>'}}
36
36
37
+
// rdar://problem/54322807
38
+
structX<T>{
39
+
init(foo:KeyPath<T,Bool>){}
40
+
init(foo:KeyPath<T,Bool?>){}
41
+
}
42
+
43
+
structWibble{
44
+
varboolProperty=false
45
+
}
46
+
47
+
structBar{
48
+
varoptWibble:Wibble?=nil
49
+
}
50
+
51
+
classFoo{
52
+
varoptBar:Bar?=nil
53
+
}
54
+
55
+
func testFoo<T:Foo>(_:T){
56
+
let _:X<T>=.init(foo: \.optBar!.optWibble?.boolProperty)
0 commit comments