File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -807,6 +807,25 @@ func test_keypath_in_any_context() {
807
807
_ = foo ( \String . count) // Ok
808
808
}
809
809
810
+ protocol PWithTypeAlias {
811
+ typealias Key = WritableKeyPath < Self , Int ? >
812
+ static var fooKey : Key ? { get }
813
+ static var barKey : Key ! { get }
814
+ static var fazKey : Key ? ? { get }
815
+ static var bazKey : Key ? ! { get }
816
+ }
817
+
818
+ func test_keypath_inference_with_optionals( ) {
819
+ final class S : PWithTypeAlias {
820
+ static var fooKey : Key ? { return \. foo }
821
+ static var barKey : Key ! { return \. foo }
822
+ static var fazKey : Key ? ? { return \. foo }
823
+ static var bazKey : Key ? ! { return \. foo }
824
+
825
+ var foo : Int ? = nil
826
+ }
827
+ }
828
+
810
829
func testSyntaxErrors( ) { // expected-note{{}}
811
830
_ = \. ; // expected-error{{expected member name following '.'}}
812
831
_ = \. a ;
You can’t perform that action at this time.
0 commit comments