Skip to content

Commit 7ca1d9f

Browse files
committed
[Diagnostics] Update existential type error message for clarity
1 parent df2d938 commit 7ca1d9f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4758,7 +4758,7 @@ ERROR(unchecked_not_existential,none,
47584758
"'unchecked' attribute cannot apply to non-protocol type %0", (Type))
47594759

47604760
ERROR(redundant_any_in_existential,none,
4761-
"redundant 'any' has no effect on existential type %0",
4761+
"redundant 'any' in type 'any %0'",
47624762
(Type))
47634763
ERROR(any_not_existential,none,
47644764
"'any' has no effect on %select{concrete type|type parameter}0 %1",

test/type/explicit_existential.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,12 +334,12 @@ func testEnumAssociatedValue() {
334334

335335
// https://github.com/apple/swift/issues/58920
336336
typealias Iterator = any IteratorProtocol
337-
var example: any Iterator = 5 // expected-error{{redundant 'any' has no effect on existential type 'Iterator' (aka 'any IteratorProtocol')}} {{14-18=}}
337+
var example: any Iterator = 5 // expected-error{{redundant 'any' in type 'any 'Iterator' (aka 'any IteratorProtocol')'}} {{14-18=}}
338338
// expected-error@-1{{value of type 'Int' does not conform to specified type 'IteratorProtocol'}}
339-
var example1: any (any IteratorProtocol) = 5 // expected-error{{redundant 'any' has no effect on existential type 'any IteratorProtocol'}} {{15-19=}}
339+
var example1: any (any IteratorProtocol) = 5 // expected-error{{redundant 'any' in type 'any 'any IteratorProtocol''}} {{15-19=}}
340340
// expected-error@-1{{value of type 'Int' does not conform to specified type 'IteratorProtocol'}}
341341

342342
protocol PP {}
343343
struct A : PP {}
344344
let _: any PP = A() // Ok
345-
let _: any (any PP) = A() // expected-error{{redundant 'any' has no effect on existential type 'any PP'}} {{8-12=}}
345+
let _: any (any PP) = A() // expected-error{{redundant 'any' in type 'any 'any PP''}} {{8-12=}}

0 commit comments

Comments
 (0)