File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -206,3 +206,19 @@ func rdar85458997() {
206
206
_ = S ( \. name)
207
207
// expected-error@-1 {{cannot infer key path type from context; consider explicitly specifying a root type}} {{10-10=<#Root#>}}
208
208
}
209
+
210
+ // https://github.com/apple/swift/issues/65965 - failed to produce correct types for key path capability mismatch
211
+ func issue_65965( ) {
212
+ struct S {
213
+ var s : String
214
+ let v : String
215
+ }
216
+
217
+ let refKP : ReferenceWritableKeyPath < S , String >
218
+ refKP = \. s
219
+ // expected-error@-1 {{key path value type 'WritableKeyPath<S, String>' cannot be converted to contextual type 'ReferenceWritableKeyPath<S, String>'}}
220
+
221
+ let writeKP : WritableKeyPath < S , String >
222
+ writeKP = \. v
223
+ // expected-error@-1 {{key path value type 'KeyPath<S, String>' cannot be converted to contextual type 'WritableKeyPath<S, String>'}}
224
+ }
You can’t perform that action at this time.
0 commit comments