@@ -530,10 +530,10 @@ class X {
530
530
}
531
531
532
532
func testStaticKeyPathComponent( ) {
533
- _ = \X . a // expected-error{{cannot refer to static member }}
534
- _ = \X . Type. a // expected-error{{cannot refer to static member}}
535
- _ = \X . b // expected-error{{cannot refer to static member }}
536
- _ = \X . Type. b // expected-error{{cannot refer to static member}}
533
+ _ = \X . a // expected-error{{static member 'a' cannot be used on instance of type 'X' }}
534
+ _ = \X . Type. a
535
+ _ = \X . b // expected-error{{static member 'b' cannot be used on instance of type 'X' }}
536
+ _ = \X . Type. b
537
537
}
538
538
539
539
class Bass : Hashable {
@@ -735,13 +735,13 @@ protocol P_With_Static_Members {
735
735
736
736
func test_keypath_with_static_members( _ p: P_With_Static_Members ) {
737
737
let _ = p [ keyPath: \. x]
738
- // expected-error@-1 {{key path cannot refer to static member 'x '}}
738
+ // expected-error@-1 {{static member 'x' cannot be used on instance of type 'any P_With_Static_Members '}}
739
739
let _: KeyPath < P_With_Static_Members , Int > = \. x
740
- // expected-error@-1 {{key path cannot refer to static member 'x '}}
740
+ // expected-error@-1 {{static member 'x' cannot be used on instance of type 'any P_With_Static_Members '}}
741
741
let _ = \P_With_Static_Members . arr. count
742
- // expected-error@-1 {{key path cannot refer to static member 'arr '}}
742
+ // expected-error@-1 {{static member 'arr' cannot be used on instance of type 'any P_With_Static_Members '}}
743
743
let _ = p [ keyPath: \. arr. count]
744
- // expected-error@-1 {{key path cannot refer to static member 'arr '}}
744
+ // expected-error@-1 {{static member 'arr' cannot be used on instance of type 'any P_With_Static_Members '}}
745
745
746
746
struct S {
747
747
static var foo : String = " Hello "
@@ -754,17 +754,16 @@ func test_keypath_with_static_members(_ p: P_With_Static_Members) {
754
754
755
755
func foo( _ s: S ) {
756
756
let _ = \S . Type. foo
757
- // expected-error@-1 {{key path cannot refer to static member 'foo'}}
758
757
let _ = s [ keyPath: \. foo]
759
- // expected-error@-1 {{key path cannot refer to static member 'foo '}}
758
+ // expected-error@-1 {{static member 'foo' cannot be used on instance of type 'S '}}
760
759
let _: KeyPath < S , String > = \. foo
761
- // expected-error@-1 {{key path cannot refer to static member 'foo '}}
760
+ // expected-error@-1 {{static member 'foo' cannot be used on instance of type 'S '}}
762
761
let _ = \S . foo
763
- // expected-error@-1 {{key path cannot refer to static member 'foo '}}
762
+ // expected-error@-1 {{static member 'foo' cannot be used on instance of type 'S '}}
764
763
let _ = \S . bar. baz
765
- // expected-error@-1 {{key path cannot refer to static member 'baz '}}
764
+ // expected-error@-1 {{static member 'baz' cannot be used on instance of type 'Bar '}}
766
765
let _ = s [ keyPath: \. bar. baz]
767
- // expected-error@-1 {{key path cannot refer to static member 'baz '}}
766
+ // expected-error@-1 {{static member 'baz' cannot be used on instance of type 'Bar '}}
768
767
}
769
768
}
770
769
0 commit comments