-
Notifications
You must be signed in to change notification settings - Fork 10.5k
/
Copy pathraw_identifiers.swift
51 lines (39 loc) · 1.34 KB
/
raw_identifiers.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// RUN: %empty-directory(%t)
// 1. functional test:
// RUN: %target-build-swift %s -emit-executable -o %t/a.out
// RUN: %target-codesign %t/a.out
// RUN: %target-run %t/a.out | %FileCheck %s
// 2. check if the generated IR looks like what we expect:
// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s -check-prefix=CHECK-IR
// REQUIRES: executable_test
protocol `Raw First` {
associatedtype `Raw Assoc 1`: `Raw First`
associatedtype `Raw Assoc 2`
init()
}
struct OuterFirst<A: `Raw First`> {
func method(_ x: A.`Raw Assoc 1`.`Raw Assoc 2`) {
let f: (A, A.`Raw Assoc 1`, A.`Raw Assoc 1`.`Raw Assoc 1`, A.`Raw Assoc 1`.`Raw Assoc 2`) -> () = { a, b, c, d in
print(type(of: a))
print(type(of: b))
print(type(of: c))
print(type(of: d))
}
f(A(), A.`Raw Assoc 1`(), A.`Raw Assoc 1`.`Raw Assoc 1`(), x)
}
}
struct `Raw.F1`: `Raw First` {
typealias `Raw Assoc 1` = `Raw.F2`
typealias `Raw Assoc 2` = Void
}
struct `Raw.F2`: `Raw First` {
typealias `Raw Assoc 1` = `Raw.F1`
typealias `Raw Assoc 2` = `Raw.F3`
}
struct `Raw.F3` {}
OuterFirst<`Raw.F1`>().method(`Raw.F3`())
// CHECK: `Raw.F1`
// CHECK: `Raw.F2`
// CHECK: `Raw.F1`
// CHECK: `Raw.F3`
// CHECK-IR: @".str.31.`Raw\C2\A0Assoc\C2\A01` `Raw\C2\A0Assoc\C2\A02`" = private constant [32 x i8] c"`Raw\C2\A0Assoc\C2\A01` `Raw\C2\A0Assoc\C2\A02`\00"