Skip to content

Commit 78216b2

Browse files
committed
Change all remaining tests that use typealias in a protocol to use associatedtype.
1 parent 6ed4eba commit 78216b2

File tree

94 files changed

+170
-166
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+170
-166
lines changed

test/1_stdlib/BridgeStorage.swift.gyb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ import Swift
2828
import SwiftShims
2929

3030
protocol BridgeStorage {
31-
typealias Native : AnyObject
32-
typealias ObjC : AnyObject
31+
associatedtype Native : AnyObject
32+
associatedtype ObjC : AnyObject
3333

3434
init(native: Native, bits: Int)
3535
init(native: Native)

test/1_stdlib/TypeName.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ enum E {}
88
protocol P {}
99
protocol P2 {}
1010
protocol AssociatedTypes {
11-
typealias A
12-
typealias B
13-
typealias C
11+
associatedtype A
12+
associatedtype B
13+
associatedtype C
1414
}
1515

1616
class Model : AssociatedTypes {

test/DebugInfo/archetype.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ protocol IntegerArithmetic {
55
}
66

77
protocol RandomAccessIndex : IntegerArithmetic {
8-
typealias Distance : IntegerArithmetic
8+
associatedtype Distance : IntegerArithmetic
99
static func uncheckedSubtract(lhs: Self, rhs: Self) -> (Distance, Bool)
1010
}
1111

test/IDE/annotation.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ func foo(n : Float) -> Int {
5656
}
5757

5858
// CHECK-LABEL: protocol <Protocol>Prot</Protocol> {
59-
// CHECK-NEXT: typealias <AssociatedType>Blarg</AssociatedType>
59+
// CHECK-NEXT: associatedtype <AssociatedType>Blarg</AssociatedType>
6060
// CHECK-NEXT: func <Func>protMeth</Func>(<Param>x</Param>: <iStruct@>Int</iStruct>)
6161
// CHECK-NEXT: var <Var>protocolProperty1</Var>: <iStruct@>Int</iStruct> { get }
6262
// CHECK-NEXT: var <Var>protocolProperty2</Var>: <iStruct@>Int</iStruct> { get set }
6363
// CHECK-NEXT: }
6464
protocol Prot {
65-
typealias Blarg
65+
associatedtype Blarg
6666
func protMeth(x: Int)
6767
var protocolProperty1: Int { get }
6868
var protocolProperty2: Int { get set }
@@ -81,7 +81,7 @@ class SubCls : MyCls, Prot {
8181
var protocolProperty2 = 0
8282
}
8383

84-
// CHECK: func <Func>genFn</Func><<GenericTypeParam>T</GenericTypeParam> : <Protocol@64:10>Prot</Protocol> where <GenericTypeParam@85:12>T</GenericTypeParam>.<AssociatedType@65:13>Blarg</AssociatedType> : <Protocol@71:10>Prot2</Protocol>>(<Param>p</Param> : <GenericTypeParam@85:12>T</GenericTypeParam>) -> <iStruct@>Int</iStruct> {}{{$}}
84+
// CHECK: func <Func>genFn</Func><<GenericTypeParam>T</GenericTypeParam> : <Protocol@64:10>Prot</Protocol> where <GenericTypeParam@85:12>T</GenericTypeParam>.<AssociatedType@65:18>Blarg</AssociatedType> : <Protocol@71:10>Prot2</Protocol>>(<Param>p</Param> : <GenericTypeParam@85:12>T</GenericTypeParam>) -> <iStruct@>Int</iStruct> {}{{$}}
8585
func genFn<T : Prot where T.Blarg : Prot2>(p : T) -> Int {}
8686

8787
func test(x: Int) {

test/IDE/comment_attach.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ class decl_class_1 {
184184
/// decl_protocol_1 Aaa.
185185
protocol decl_protocol_1 {
186186
/// NestedTypealias Aaa.
187-
typealias NestedTypealias
187+
associatedtype NestedTypealias
188188

189189
/// instanceFunc1 Aaa.
190190
func instanceFunc1()
@@ -293,7 +293,7 @@ func unterminatedBlockDocComment() {}
293293
// CHECK-NEXT: comment_attach.swift:177:15: EnumElement/decl_enum_1.Case5 RawComment=[/// Case4 Case5 Aaa.\n]
294294
// CHECK-NEXT: comment_attach.swift:181:7: Class/decl_class_1 RawComment=[/// decl_class_1 Aaa.\n]
295295
// CHECK-NEXT: comment_attach.swift:185:10: Protocol/decl_protocol_1 RawComment=[/// decl_protocol_1 Aaa.\n]
296-
// CHECK-NEXT: comment_attach.swift:187:13: AssociatedType/decl_protocol_1.NestedTypealias RawComment=[/// NestedTypealias Aaa.\n]
296+
// CHECK-NEXT: comment_attach.swift:187:18: AssociatedType/decl_protocol_1.NestedTypealias RawComment=[/// NestedTypealias Aaa.\n]
297297
// CHECK-NEXT: comment_attach.swift:190:8: Func/decl_protocol_1.instanceFunc1 RawComment=[/// instanceFunc1 Aaa.\n]
298298
// CHECK-NEXT: comment_attach.swift:193:7: Var/decl_protocol_1.propertyWithGet RawComment=[/// propertyWithGet Aaa.\n]
299299
// CHECK-NEXT: comment_attach.swift:193:30: Func/decl_protocol_1.<getter for decl_protocol_1.propertyWithGet> RawComment=none

test/IDE/complete_from_stdlib.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ func testArchetypeReplacement3 (a : [Int]) {
167167

168168

169169
protocol P2 {
170-
typealias MyElement
170+
associatedtype MyElement
171171
}
172172

173173
extension P2 {

test/IDE/complete_operators.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func testPostfix8(x: S) {
100100
// POSTFIX_8-NOT: ***
101101

102102
protocol P {
103-
typealias T
103+
associatedtype T
104104
func foo() -> T
105105
}
106106

test/IDE/complete_value_expr.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1583,7 +1583,7 @@ func testGenericConforming3<T: P3>(x: T) {
15831583
15841584
struct OnlyMe {}
15851585
protocol P4 {
1586-
typealias T
1586+
associatedtype T
15871587
}
15881588
extension P4 where Self.T : P1 {
15891589
final func extP4WhenP1() {}
@@ -1724,7 +1724,7 @@ extension P4 where Self.T == WillConformP1 {
17241724
// PROTOCOL_EXT_P4_T_DOT_1: End completions
17251725
17261726
protocol PWithT {
1727-
typealias T
1727+
associatedtype T
17281728
func foo(x: T) -> T
17291729
}
17301730
@@ -1745,7 +1745,7 @@ func testUnusableProtExt(x: PWithT) {
17451745
// PROTOCOL_EXT_UNUSABLE_EXISTENTIAL: End completions
17461746
17471747
protocol dedupP {
1748-
typealias T
1748+
associatedtype T
17491749
func foo() -> T
17501750
var bar: T {get}
17511751
subscript(x: T) -> T {get}

test/IRGen/associated_type_witness.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ protocol P {}
77
protocol Q {}
88

99
protocol Assocked {
10-
typealias Assoc : P, Q
10+
associatedtype Assoc : P, Q
1111
}
1212

1313
struct Universal : P, Q {}
@@ -124,7 +124,7 @@ struct Computed<T, U> : Assocked {
124124

125125
struct PBox<T: P> {}
126126
protocol HasSimpleAssoc {
127-
typealias Assoc
127+
associatedtype Assoc
128128
}
129129
protocol DerivedFromSimpleAssoc : HasSimpleAssoc {}
130130

@@ -163,7 +163,7 @@ struct GenericComputed<T: P> : DerivedFromSimpleAssoc {
163163

164164

165165
protocol HasAssocked {
166-
typealias Contents : Assocked
166+
associatedtype Contents : Assocked
167167
}
168168
struct FulfilledFromAssociatedType<T : HasAssocked> : HasSimpleAssoc {
169169
typealias Assoc = PBox<T.Contents.Assoc>

test/IRGen/dependent_reabstraction.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
func markUsed<T>(t: T) {}
44

55
protocol A {
6-
typealias B
6+
associatedtype B
77
func b(_: B)
88
}
99

0 commit comments

Comments
 (0)