You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: test/type/explicit_existential.swift
+9-7
Original file line number
Diff line number
Diff line change
@@ -173,13 +173,13 @@ protocol Collection<T> {
173
173
structTestParameterizedProtocol<T>:Collection{
174
174
typealiasT=T
175
175
176
-
letx:Collection<T> // expected-warning {{use of protocol 'Collection<T>' as a type must be written 'any Collection<T>'}}
176
+
letx:Collection<T> // expected-warning {{use of protocol 'Collection' as a type must be written 'any Collection'}}
177
177
}
178
178
179
179
func acceptAny(_:Collection<Int>){}
180
-
// expected-warning@-1 {{use of protocol 'Collection<Int>' as a type must be written 'any Collection<Int>'}}
180
+
// expected-warning@-1 {{use of protocol 'Collection' as a type must be written 'any Collection'}}
181
181
func returnsAny()->Collection<Int>{}
182
-
// expected-warning@-1 {{use of protocol 'Collection<Int>' as a type must be written 'any Collection<Int>'}}
182
+
// expected-warning@-1 {{use of protocol 'Collection' as a type must be written 'any Collection'}}
183
183
184
184
func testInvalidAny(){
185
185
structS:HasAssoc{
@@ -374,8 +374,8 @@ func testAnyFixIt() {
374
374
let _:Optional<HasAssoc>
375
375
// expected-warning@+1 {{constraint that suppresses conformance requires 'any'}}{{19-28=any ~Copyable}}
376
376
let _: Optional<~Copyable>
377
-
// FIXME: No fix-it + generic argument not diagnosed.
378
-
// expected-warning@+1 {{use of protocol 'HasAssocGeneric<any HasAssoc>' as a type must be written 'any HasAssocGeneric<any HasAssoc>'}}{{none}}
377
+
// expected-warning@+2:10 {{use of protocol 'HasAssocGeneric' as a type must be written 'any HasAssocGeneric'}}{{10-35=any HasAssocGeneric<HasAssoc>}}
378
+
// expected-warning@+1:26 {{use of protocol 'HasAssoc' as a type must be written 'any HasAssoc'}}{{26-34=any HasAssoc}}
379
379
let _: HasAssocGeneric<HasAssoc>
380
380
// expected-warning@+1 {{use of protocol 'HasAssoc' as a type must be written 'any HasAssoc'}}{{14-22=any HasAssoc}}
381
381
let _: S.G<HasAssoc>
@@ -407,8 +407,8 @@ func testAnyFixIt() {
407
407
// expected-warning@+2 {{use of protocol 'HasAssoc' as a type must be written 'any HasAssoc'}}{{13-21=any HasAssoc}}
408
408
// expected-warning@+1 {{constraint that suppresses conformance requires 'any'}}{{10-37=any ~G<HasAssoc>.Copyable_Alias}}
409
409
let _:~G<HasAssoc>.Copyable_Alias
410
-
// FIXME: No fix-it + generic argument not diagnosed.
411
-
// expected-warning@+1 {{use of 'HasAssocGeneric<any HasAssoc>' as a type must be written 'any HasAssocGeneric<any HasAssoc>}}{{none}}
410
+
// expected-warning@+2:12 {{use of 'S.HasAssocGeneric_Alias' (aka 'HasAssocGeneric') as a type must be written 'any S.HasAssocGeneric_Alias' (aka 'any HasAssocGeneric')}} {{10-43=any S.HasAssocGeneric_Alias<HasAssoc>}}
411
+
// expected-warning@+1:34 {{use of protocol 'HasAssoc' as a type must be written 'any HasAssoc'}}{{34-42=any HasAssoc}}
412
412
let _:S.HasAssocGeneric_Alias<HasAssoc>
413
413
// FIXME: No diagnostic.
414
414
let _:HasAssoc.Int_Alias
@@ -543,6 +543,8 @@ func testAnyFixIt() {
543
543
544
544
// expected-error@+1 {{optional 'any' type must be written '(any HasAssoc)?'}}{{10-23=(any HasAssoc)?}}
545
545
let _:anyHasAssoc?
546
+
// expected-error@+1:10 {{optional 'any' type must be written '(any HasAssocGeneric<Int>)?'}}{{10-35=(any HasAssocGeneric<Int>)?}}
547
+
let _:anyHasAssocGeneric<Int>?
546
548
// FIXME: Better recovery
547
549
// expected-error@+1 {{type '(any Copyable)?' cannot be suppressed}}
0 commit comments