Skip to content

Commit 9f5c113

Browse files
[tests] Adjusting diagnostic wording
1 parent 7c19460 commit 9f5c113

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ ERROR(could_not_find_value_dynamic_member,none,
7272
"value of type %0 has no dynamic member %2 using key path from root type %1",
7373
(Type, Type, DeclNameRef))
7474
ERROR(cannot_infer_contextual_keypath_type_specify_root,none,
75-
"cannot infer key path type from context; consider explicitly adding a root type", ())
75+
"cannot infer key path type from context; consider explicitly specifying a root type", ())
7676
ERROR(cannot_infer_keypath_root_anykeypath_context,none,
7777
"'AnyKeyPath' does not provide enough context for root type to be inferred; "
78-
"consider explicitly adding a root type", ())
78+
"consider explicitly specifying a root type", ())
7979

8080
ERROR(could_not_find_type_member,none,
8181
"type %0 has no member %1", (Type, DeclNameRef))

lib/Sema/CSFix.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1809,7 +1809,7 @@ class AllowCoercionToForceCast final : public ContextualMismatch {
18091809
/// bar[keyPath: keyPath]
18101810
/// }
18111811
/// \endcode
1812-
class AllowKeyPathRootTypeMismatch : public ContextualMismatch {
1812+
class AllowKeyPathRootTypeMismatch final : public ContextualMismatch {
18131813
protected:
18141814
AllowKeyPathRootTypeMismatch(ConstraintSystem &cs, Type lhs, Type rhs,
18151815
ConstraintLocator *locator)
@@ -1827,7 +1827,7 @@ class AllowKeyPathRootTypeMismatch : public ContextualMismatch {
18271827
create(ConstraintSystem &cs, Type lhs, Type rhs, ConstraintLocator *locator);
18281828
};
18291829

1830-
class SpecifyKeyPathRootType : public ConstraintFix {
1830+
class SpecifyKeyPathRootType final : public ConstraintFix {
18311831
SpecifyKeyPathRootType(ConstraintSystem &cs, ConstraintLocator *locator)
18321832
: ConstraintFix(cs, FixKind::SpecifyKeyPathRootType, locator) {}
18331833

test/expr/unary/keypath/keypath.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,9 @@ func testKeyPath(sub: Sub, optSub: OptSub,
195195

196196
let _: AnyKeyPath = \A.property
197197
let _: AnyKeyPath = \C<A>.value
198-
let _: AnyKeyPath = \.property // expected-error {{'AnyKeyPath' does not provide enough context for root type to be inferred; consider explicitly adding a root type}} {{24-24=<#Root#>}}
198+
let _: AnyKeyPath = \.property // expected-error {{'AnyKeyPath' does not provide enough context for root type to be inferred; consider explicitly specifying a root type}} {{24-24=<#Root#>}}
199199
let _: AnyKeyPath = \C.value // expected-error{{generic parameter 'T' could not be inferred}}
200-
let _: AnyKeyPath = \.value // expected-error {{'AnyKeyPath' does not provide enough context for root type to be inferred; consider explicitly adding a root type}} {{24-24=<#Root#>}}
200+
let _: AnyKeyPath = \.value // expected-error {{'AnyKeyPath' does not provide enough context for root type to be inferred; consider explicitly specifying a root type}} {{24-24=<#Root#>}}
201201

202202
let _ = \Prop.[nonHashableSub] // expected-error{{subscript index of type 'NonHashableSub' in a key path must be Hashable}}
203203
let _ = \Prop.[sub, sub]
@@ -894,12 +894,12 @@ struct SR_12290 {
894894
}
895895

896896
func testKeyPathHole() {
897-
_ = \.x // expected-error {{cannot infer key path type from context; consider explicitly adding a root type}} {{8-8=<#Root#>}}
897+
_ = \.x // expected-error {{cannot infer key path type from context; consider explicitly specifying a root type}} {{8-8=<#Root#>}}
898898
let _ : AnyKeyPath = \.x
899-
// expected-error@-1 {{'AnyKeyPath' does not provide enough context for root type to be inferred; consider explicitly adding a root type}} {{25-25=<#Root#>}}
899+
// expected-error@-1 {{'AnyKeyPath' does not provide enough context for root type to be inferred; consider explicitly specifying a root type}} {{25-25=<#Root#>}}
900900

901901
func f(_ i: Int) {}
902-
f(\.x) // expected-error {{cannot infer key path type from context; consider explicitly adding a root type}} {{6-6=<#Root#>}}
902+
f(\.x) // expected-error {{cannot infer key path type from context; consider explicitly specifying a root type}} {{6-6=<#Root#>}}
903903
}
904904

905905
func testSyntaxErrors() { // expected-note{{}}

0 commit comments

Comments
 (0)