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/Generics/associated_types.swift
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -173,7 +173,7 @@ struct C<a : B> : B { // expected-error {{type 'C<a>' does not conform to protoc
173
173
174
174
// SR-511
175
175
protocolsr511{
176
-
typealias Foo // expected-error {{typealias is missing an assigned type; use 'associatedtype' to define an associated type requirement}}
176
+
typealias Foo // expected-warning {{use of 'typealias' to declare associated types is deprecated; use 'associatedtype' instead}}
177
177
}
178
178
179
179
associatedtypeFoo=Int // expected-error {{associated types can only be defined in a protocol; define a type or introduce a 'typealias' to satisfy an associated type requirement}}
Copy file name to clipboardExpand all lines: test/decl/typealias/typealias.swift
+10-8Lines changed: 10 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -29,8 +29,8 @@ struct MyType<TyA, TyB> {
29
29
30
30
protocol P {
31
31
associatedtypeX<T> // expected-error {{associated types may not have a generic parameter list}}
32
-
33
-
typealias Y<T> // expected-error {{expected '=' in typealias declaration}}
32
+
// FIXME Disabled until typealiases in protocols are entirely fixed
33
+
// typealias Y<T> // fixme-error {{expected '=' in typealias declaration}}
34
34
}
35
35
36
36
typealiasbasicTypealias=Int
@@ -148,6 +148,8 @@ extension C<Int> {} // expected-error {{constrained extension must be declared
148
148
149
149
150
150
// Allow typealias inside protocol, but don't allow it in where clauses (at least not yet)
151
+
// FIXME Disabled until typealiases in protocols are entirely fixed
152
+
/*
151
153
protocol Col {
152
154
associatedtype Elem
153
155
var elem: Elem { get }
@@ -227,23 +229,23 @@ protocol P2 {
227
229
associatedtype B
228
230
}
229
231
230
-
func go3<T :P1, U :P2where T.F ==U.B>(_ x:T)->U{ // expected-error {{typealias 'F' is too complex to be used as a generic constraint; use an associatedtype instead}} expected-error {{'F' is not a member type of 'T'}}
232
+
func go3<T : P1, U : P2 where T.F == U.B>(_ x: T) -> U { // fixme-error {{typealias 'F' is too complex to be used as a generic constraint; use an associatedtype instead}} fixme-error {{'F' is not a member type of 'T'}}
231
233
}
232
234
233
235
// Specific diagnosis for things that look like Swift 2.x typealiases
234
236
protocol P3 {
235
-
typealias T // expected-error {{typealias is missing an assigned type; use 'associatedtype' to define an associated type requirement}}
236
-
typealias U : P2 // expected-error {{typealias is missing an assigned type; use 'associatedtype' to define an associated type requirement}}
237
+
typealias T // fixme-error {{typealias is missing an assigned type; use 'associatedtype' to define an associated type requirement}}
238
+
typealias U : P2 // fixme-error {{typealias is missing an assigned type; use 'associatedtype' to define an associated type requirement}}
237
239
238
-
associatedtypeV:P2= // expected-error {{expected type in associatedtype declaration}}
240
+
associatedtype V : P2 = // fixme-error {{expected type in associatedtype declaration}}
239
241
}
240
242
241
243
// Test for not crashing on self and recursive aliases
242
244
protocol P4 {
243
245
typealias X = Self
244
-
typealiasY=Self.Y // expected-error {{type alias 'Y' circularly references itself}}
246
+
typealias Y = Self.Y // fixme-error {{type alias 'Y' circularly references itself}}
0 commit comments