Skip to content

Commit 8f0d997

Browse files
committed
Test: Moved tests for typealias access through metatypes into protocols tests
1 parent 3a089cc commit 8f0d997

File tree

2 files changed

+10
-20
lines changed

2 files changed

+10
-20
lines changed

test/Constraints/protocols.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ protocol P : Initable {
107107
func bar(_ x: Int)
108108
mutating func mut(_ x: Int)
109109
static func tum()
110+
111+
typealias E = Int
112+
typealias F = Self.E
110113
}
111114

112115
protocol ClassP : class {
@@ -216,6 +219,13 @@ func staticExistential(_ p: P.Type, pp: P.Protocol) {
216219
// Static member of metatype -- not allowed
217220
_ = pp.tum // expected-error{{static member 'tum' cannot be used on protocol metatype 'P.Protocol'}}
218221
_ = P.tum // expected-error{{static member 'tum' cannot be used on protocol metatype 'P.Protocol'}}
222+
223+
// Access typealias through protocol and existential metatypes
224+
_ = pp.E.self
225+
_ = p.E.self
226+
227+
_ = pp.F.self
228+
_ = p.F.self
219229
}
220230

221231
protocol StaticP {

test/type/metatype/metatypes.swift

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,3 @@ var test1 = Test1a.self
1818
test1 = Test1b.self
1919
var x = Test1b()
2020
test1 = type(of: x)
21-
22-
// test associated type access through metatypes
23-
protocol P {
24-
typealias E = Int
25-
}
26-
27-
func foo(meta1: P.Protocol, meta2: P.Type) {
28-
print(meta1.E.self)
29-
print(meta2.E.self)
30-
}
31-
32-
protocol P2 {
33-
typealias E = Self
34-
typealias F = Int
35-
}
36-
37-
func foo(meta1: P.Protocol, meta2: P.Type) {
38-
print(meta1.E.F.self)
39-
print(meta2.E.F.self)
40-
}

0 commit comments

Comments
 (0)