@@ -37,6 +37,10 @@ reflect(enum: Outer1.C<Void>.Inner.S<(Int,Int)>?.none)
37
37
38
38
//CHECK: Type info:
39
39
40
+ // This is the layout for 64-bit targets (Note, this example
41
+ // has no pointer-based elements, so we don't need to distinguish
42
+ // extra inhabitants for platforms with varying pointer layouts.)
43
+
40
44
//X64-NEXT: (single_payload_enum size=19 alignment=8 stride=24 num_extra_inhabitants=0 bitwise_takable=1
41
45
//X64-NEXT: (case name=some index=0 offset=0
42
46
//X64-NEXT: (struct size=18 alignment=8 stride=24 num_extra_inhabitants=0 bitwise_takable=1
@@ -60,7 +64,7 @@ reflect(enum: Outer1.C<Void>.Inner.S<(Int,Int)>?.none)
60
64
//X64-NEXT: (case name=none index=1)))))
61
65
//X64-NEXT: (case name=none index=1))
62
66
63
- //TODO: X32
67
+ //TODO: Work out the layout for 32-bit targets
64
68
65
69
//CHECK: Mangled name: $s22reflect_nested_generic6Outer1O1CC1SVy_yt_Si_SitGSg
66
70
//CHECK-NEXT: Demangled name: Swift.Optional<reflect_nested_generic.Outer1.C<()>.S<(Swift.Int, Swift.Int)>>
@@ -78,6 +82,9 @@ struct Outer2 {
78
82
enum E < T: P > {
79
83
struct Inner {
80
84
enum F < U: P > {
85
+ struct Innerer {
86
+ var u : U ? = nil
87
+ }
81
88
case u( U )
82
89
case a
83
90
case b
@@ -96,7 +103,7 @@ reflect(enum: Outer2.E<S1>.Inner.F<S2>.b)
96
103
//CHECK-NEXT: (bound_generic_enum reflect_nested_generic.Outer2.E
97
104
//CHECK-NEXT: (struct reflect_nested_generic.S1)))
98
105
99
- // Note: layout here is correct for both 32- and 64-bit platforms
106
+ // Note: layout here is same for both 32- and 64-bit platforms
100
107
101
108
//CHECK: Type info:
102
109
//CHECK-NEXT: (single_payload_enum size=1 alignment=1 stride=1 num_extra_inhabitants=0 bitwise_takable=1
@@ -111,6 +118,37 @@ reflect(enum: Outer2.E<S1>.Inner.F<S2>.b)
111
118
//CHECK: Enum value:
112
119
//CHECK-NEXT: (enum_value name=b index=2)
113
120
121
+ reflect ( enum: Outer2 . E < S1 > . Inner . F < S2 > . Innerer? . none)
122
+
123
+ //CHECK: Reflecting an enum.
124
+ //CHECK-NEXT: Instance pointer in child address space: 0x{{[0-9a-fA-F]+}}
125
+ //CHECK-NEXT: Type reference:
126
+ //CHECK-NEXT: (bound_generic_enum Swift.Optional
127
+ //CHECK-NEXT: (bound_generic_struct reflect_nested_generic.Outer2.E.Inner.F.Innerer
128
+ //CHECK-NEXT: (bound_generic_enum reflect_nested_generic.Outer2.E.Inner.F
129
+ //CHECK-NEXT: (struct reflect_nested_generic.S2)
130
+ //CHECK-NEXT: (bound_generic_enum reflect_nested_generic.Outer2.E
131
+ //CHECK-NEXT: (struct reflect_nested_generic.S1)))))
132
+
133
+ // This layout is the same for 32-bit or 64-bit platforms
134
+
135
+ //CHECK: Type info:
136
+ //CHECK-NEXT: (single_payload_enum size=2 alignment=1 stride=2 num_extra_inhabitants=0 bitwise_takable=1
137
+ //CHECK-NEXT: (case name=some index=0 offset=0
138
+ //CHECK-NEXT: (struct size=1 alignment=1 stride=1 num_extra_inhabitants=0 bitwise_takable=1
139
+ //CHECK-NEXT: (field name=u offset=0
140
+ //CHECK-NEXT: (single_payload_enum size=1 alignment=1 stride=1 num_extra_inhabitants=0 bitwise_takable=1
141
+ //CHECK-NEXT: (case name=some index=0 offset=0
142
+ //CHECK-NEXT: (struct size=0 alignment=1 stride=1 num_extra_inhabitants=0 bitwise_takable=1))
143
+ //CHECK-NEXT: (case name=none index=1)))))
144
+ //CHECK-NEXT: (case name=none index=1))
145
+
146
+ //CHECK-NEXT: Mangled name: $s22reflect_nested_generic6Outer2V1EO1FO7InnererVy_AA2S1V_AA2S2V_GSg
147
+ //CHECK-NEXT: Demangled name: Swift.Optional<reflect_nested_generic.Outer2.E<reflect_nested_generic.S1>.F<reflect_nested_generic.S2>.Innerer<>>
148
+
149
+ //CHECK: Enum value:
150
+ //CHECK-NEXT: (enum_value name=none index=1)
151
+
114
152
doneReflecting ( )
115
153
116
154
// CHECK: Done.
0 commit comments