Skip to content

Commit 83520b1

Browse files
committed
[Tests] Update Sema tests.
1 parent 1a95ab7 commit 83520b1

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

test/SILOptimizer/access_wmo_diagnose.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ public class C {
1010
}
1111

1212
public func testGlobalProp() {
13-
let a: AnyKeyPath = \C.globalProp // expected-error{{key path cannot refer to static member 'globalProp'}}
13+
let a: AnyKeyPath = \C.globalProp // expected-error{{static member 'globalProp' cannot be used on instance of type 'C'}}
1414
}

test/attr/attr_dynamic_member_lookup.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ func invalid_refs_through_dynamic_lookup() {
682682
}
683683

684684
func test(_ lens: A<S>) {
685-
_ = lens.foo // expected-error {{dynamic key path member lookup cannot refer to static member 'foo'}}
685+
_ = lens.foo // expected-error {{static member 'foo' cannot be used on instance of type 'S'}}
686686
_ = lens.bar() // expected-error {{dynamic key path member lookup cannot refer to instance method 'bar()'}}
687687
_ = lens.bar().faz + 1 // expected-error {{dynamic key path member lookup cannot refer to instance method 'bar()'}}
688688
_ = lens.baz("hello") // expected-error {{dynamic key path member lookup cannot refer to static method 'baz'}}

test/expr/unary/keypath/keypath.swift

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -530,10 +530,10 @@ class X {
530530
}
531531

532532
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
537537
}
538538

539539
class Bass: Hashable {
@@ -735,13 +735,13 @@ protocol P_With_Static_Members {
735735

736736
func test_keypath_with_static_members(_ p: P_With_Static_Members) {
737737
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'}}
739739
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'}}
741741
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'}}
743743
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'}}
745745

746746
struct S {
747747
static var foo: String = "Hello"
@@ -754,17 +754,16 @@ func test_keypath_with_static_members(_ p: P_With_Static_Members) {
754754

755755
func foo(_ s: S) {
756756
let _ = \S.Type.foo
757-
// expected-error@-1 {{key path cannot refer to static member 'foo'}}
758757
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'}}
760759
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'}}
762761
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'}}
764763
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'}}
766765
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'}}
768767
}
769768
}
770769

0 commit comments

Comments
 (0)