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-7Lines changed: 9 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -159,13 +159,13 @@ protocol Collection<T> {
159
159
structTestParameterizedProtocol<T>:Collection{
160
160
typealiasT=T
161
161
162
-
letx:Collection<T> // expected-warning {{use of protocol 'Collection<T>' as a type must be written 'any Collection<T>'}}
162
+
letx:Collection<T> // expected-warning {{use of protocol 'Collection' as a type must be written 'any Collection'}}
163
163
}
164
164
165
165
func acceptAny(_:Collection<Int>){}
166
-
// expected-warning@-1 {{use of protocol 'Collection<Int>' as a type must be written 'any Collection<Int>'}}
166
+
// expected-warning@-1 {{use of protocol 'Collection' as a type must be written 'any Collection'}}
167
167
func returnsAny()->Collection<Int>{}
168
-
// expected-warning@-1 {{use of protocol 'Collection<Int>' as a type must be written 'any Collection<Int>'}}
168
+
// expected-warning@-1 {{use of protocol 'Collection' as a type must be written 'any Collection'}}
169
169
170
170
func testInvalidAny(){
171
171
structS:HasAssoc{
@@ -357,8 +357,8 @@ func testAnyFixIt() {
357
357
let _:Optional<HasAssoc>
358
358
// expected-warning@+1 {{constraint that suppresses conformance requires 'any'}}{{19-28=any ~Copyable}}
359
359
let _: Optional<~Copyable>
360
-
// FIXME: No fix-it + generic argument not diagnosed.
361
-
// expected-warning@+1 {{use of protocol 'HasAssocGeneric<any HasAssoc>' as a type must be written 'any HasAssocGeneric<any HasAssoc>'}}{{none}}
360
+
// expected-warning@+2:10 {{use of protocol 'HasAssocGeneric' as a type must be written 'any HasAssocGeneric'}}{{10-35=any HasAssocGeneric<HasAssoc>}}
361
+
// expected-warning@+1:26 {{use of protocol 'HasAssoc' as a type must be written 'any HasAssoc'}}{{26-34=any HasAssoc}}
362
362
let _: HasAssocGeneric<HasAssoc>
363
363
// expected-warning@+1 {{use of protocol 'HasAssoc' as a type must be written 'any HasAssoc'}}{{14-22=any HasAssoc}}
364
364
let _: S.G<HasAssoc>
@@ -390,8 +390,8 @@ func testAnyFixIt() {
390
390
// expected-warning@+2 {{use of protocol 'HasAssoc' as a type must be written 'any HasAssoc'}}{{13-21=any HasAssoc}}
391
391
// expected-warning@+1 {{constraint that suppresses conformance requires 'any'}}{{10-37=any ~G<HasAssoc>.Copyable_Alias}}
392
392
let _:~G<HasAssoc>.Copyable_Alias
393
-
// FIXME: No fix-it + generic argument not diagnosed.
394
-
// expected-warning@+1 {{use of 'HasAssocGeneric<any HasAssoc>' as a type must be written 'any HasAssocGeneric<any HasAssoc>}}{{none}}
393
+
// 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>}}
394
+
// expected-warning@+1:34 {{use of protocol 'HasAssoc' as a type must be written 'any HasAssoc'}}{{34-42=any HasAssoc}}
395
395
let _:S.HasAssocGeneric_Alias<HasAssoc>
396
396
// FIXME: No diagnostic.
397
397
let _:HasAssoc.Int_Alias
@@ -525,6 +525,8 @@ func testAnyFixIt() {
525
525
526
526
// expected-error@+1 {{optional 'any' type must be written '(any HasAssoc)?'}}{{10-23=(any HasAssoc)?}}
527
527
let _:anyHasAssoc?
528
+
// expected-error@+1:10 {{optional 'any' type must be written '(any HasAssocGeneric<Int>)?'}}{{10-35=(any HasAssocGeneric<Int>)?}}
529
+
let _:anyHasAssocGeneric<Int>?
528
530
// FIXME: Better recovery
529
531
// expected-error@+1 {{type '(any Copyable)?' cannot be suppressed}}
// expected-warning@+1 {{use of protocol 'Collection' as a type must be written 'any Collection'; this will be an error in a future Swift language mode}}
0 commit comments