Skip to content

Commit d36aecc

Browse files
committed
Diag: Make 'could_not_use_member_on_existential' less assertive
1 parent e35261f commit d36aecc

File tree

5 files changed

+158
-158
lines changed

5 files changed

+158
-158
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ ERROR(could_not_use_instance_member_on_type,none,
140140
"%select{| instance of nested}3 type %0",
141141
(Type, DeclNameRef, Type, bool))
142142
ERROR(could_not_use_member_on_existential,none,
143-
"member %1 cannot be used on value of protocol type %0; use a generic"
144-
" constraint instead",
143+
"member %1 cannot be used on value of protocol type %0; consider using a"
144+
" generic constraint instead",
145145
(Type, DeclNameRef))
146146
FIXIT(replace_with_type,"%0",(Type))
147147
FIXIT(insert_type_qualification,"%0.",(Type))

test/Constraints/opened_existentials.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func testReturningOpaqueTypes(p: any P) {
164164
let q = p.getQ()
165165
let _: Int = q // expected-error{{cannot convert value of type 'Q' to specified type 'Int'}}
166166

167-
p.getCollectionOf() // expected-error{{member 'getCollectionOf' cannot be used on value of protocol type 'P'; use a generic constraint instead}}
167+
p.getCollectionOf() // expected-error{{member 'getCollectionOf' cannot be used on value of protocol type 'P'; consider using a generic constraint instead}}
168168

169169
let q2 = getPQ(p)
170170
let _: Int = q2 // expected-error{{cannot convert value of type 'Q' to specified type 'Int'}}

test/Constraints/protocols.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,8 @@ func testClonableExistential(_ v: Clonable, _ vv: Clonable.Type) {
370370
let _: (Bool) -> Clonable? = id(vv.returnSelfIUOStatic as (Bool) -> Clonable?)
371371
let _: Clonable! = id(vv.returnSelfIUOStatic(true))
372372

373-
let _ = v.badClonerFn() // expected-error {{member 'badClonerFn' cannot be used on value of protocol type 'Clonable'; use a generic constraint instead}}
374-
let _ = v.veryBadClonerFn() // expected-error {{member 'veryBadClonerFn' cannot be used on value of protocol type 'Clonable'; use a generic constraint instead}}
373+
let _ = v.badClonerFn() // expected-error {{member 'badClonerFn' cannot be used on value of protocol type 'Clonable'; consider using a generic constraint instead}}
374+
let _ = v.veryBadClonerFn() // expected-error {{member 'veryBadClonerFn' cannot be used on value of protocol type 'Clonable'; consider using a generic constraint instead}}
375375

376376
}
377377

test/Generics/function_defs.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func existential<T : EqualComparable, U : EqualComparable>(_ t1: T, t2: T, u: U)
3838
eqComp = u
3939
if t1.isEqual(eqComp) {} // expected-error{{cannot convert value of type 'EqualComparable' to expected argument type 'T'}}
4040
if eqComp.isEqual(t2) {}
41-
// expected-error@-1 {{member 'isEqual' cannot be used on value of protocol type 'EqualComparable'; use a generic constraint instead}}
41+
// expected-error@-1 {{member 'isEqual' cannot be used on value of protocol type 'EqualComparable'; consider using a generic constraint instead}}
4242
}
4343

4444
protocol OtherEqualComparable {

0 commit comments

Comments
 (0)