Skip to content

Commit 5cf230c

Browse files
[tests] Adding regression tests to SR-11184
1 parent 37fa67a commit 5cf230c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/Constraints/keypath.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,18 @@ func test_mismatch_with_contextual_optional_result() {
137137
let _ = A(B(), keyPath: \.arr)
138138
// expected-error@-1 {{key path value type '[Int]' cannot be converted to contextual type '[Int]?'}}
139139
}
140+
141+
// SR-11184
142+
class SR11184 {}
143+
144+
func fSR11184(_ c: SR11184!, _ kp: ReferenceWritableKeyPath<SR11184, String?>, _ str: String) {
145+
c[keyPath: kp] = str // OK
146+
c![keyPath: kp] = str // OK
147+
c?[keyPath: kp] = str // OK
148+
}
149+
150+
func fSR11184_O(_ c: SR11184!, _ kp: ReferenceWritableKeyPath<SR11184, String?>, _ str: String?) {
151+
c[keyPath: kp] = str // OK
152+
c![keyPath: kp] = str // OK
153+
c?[keyPath: kp] = str // OK
154+
}

0 commit comments

Comments
 (0)