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
case First ="abc" // expected-error {{cannot convert value of type 'String' to raw type 'Character'}}
208
200
}
209
201
210
-
enumRawTypeWithFloatValues:Float{ // expected-error {{'RawTypeWithFloatValues' declares raw type 'Float', but does not conform to RawRepresentable and conformance could not be synthesized}}
211
-
case Northrup =1.5
212
-
case Overton // expected-error {{enum case must declare a raw value when the preceding raw value is not an integer}}
213
-
case Pettygrove =2.25
214
-
}
215
-
216
202
enumRawTypeWithStringValues:String{
217
203
case Primrose // okay
218
204
case Quimby ="Lucky Lab"
@@ -229,86 +215,22 @@ enum RawTypeWithRepeatValues : Int {
229
215
case Wilson =22 // expected-error {{raw value for enum case is not unique}}
230
216
}
231
217
232
-
enumRawTypeWithRepeatValues2:Double{
233
-
case Vaughn =22 // expected-note {{raw value previously used here}}
234
-
case Wilson =22.0 // expected-error {{raw value for enum case is not unique}}
235
-
}
236
-
237
-
enumRawTypeWithRepeatValues3:Double{
238
-
// 2^63-1
239
-
case Vaughn =9223372036854775807 // expected-note {{raw value previously used here}}
240
-
case Wilson =9223372036854775807.0 // expected-error {{raw value for enum case is not unique}}
241
-
}
242
-
243
-
enumRawTypeWithRepeatValues4:Double{
244
-
// 2^64-1
245
-
case Vaughn =18446744073709551615 // expected-note {{raw value previously used here}}
246
-
case Wilson =18446744073709551615.0 // expected-error {{raw value for enum case is not unique}}
247
-
}
248
-
249
-
enumRawTypeWithRepeatValues5:Double{
250
-
// FIXME: should reject.
251
-
// 2^65-1
252
-
case Vaughn =36893488147419103231
253
-
case Wilson =36893488147419103231.0
254
-
}
255
-
256
-
enumRawTypeWithRepeatValues6:Double{
257
-
// FIXME: should reject.
258
-
// 2^127-1
259
-
case Vaughn =170141183460469231731687303715884105727
260
-
case Wilson =170141183460469231731687303715884105727.0
261
-
}
262
-
263
-
enumRawTypeWithRepeatValues7:Double{
264
-
// FIXME: should reject.
265
-
// 2^128-1
266
-
case Vaughn =340282366920938463463374607431768211455
267
-
case Wilson =340282366920938463463374607431768211455.0
268
-
}
269
-
270
-
enumRawTypeWithRepeatValues8:String{
218
+
enumRawTypeWithRepeatValuesString:String{
271
219
case Vaughn ="XYZ" // expected-note {{raw value previously used here}}
272
220
case Wilson ="XYZ" // expected-error {{raw value for enum case is not unique}}
273
221
}
274
222
275
-
enumRawTypeWithNonRepeatValues:Double{
276
-
case SantaClara =3.7
277
-
case SanFernando =7.4
278
-
case SanAntonio =-3.7
279
-
case SanCarlos =-7.4
280
-
}
281
-
282
-
283
-
enumRawTypeWithRepeatValuesAutoInc:Double{
284
-
case Vaughn =22 // expected-note {{raw value auto-incremented from here}}
285
-
case Wilson // expected-note {{raw value previously used here}}
286
-
case Yeon =23 // expected-error {{raw value for enum case is not unique}}
287
-
}
288
-
289
-
enumRawTypeWithRepeatValuesAutoInc2:Double{
290
-
case Vaughn =23 // expected-note {{raw value previously used here}}
291
-
case Wilson =22 // expected-note {{raw value auto-incremented from here}}
292
-
case Yeon // expected-error {{raw value for enum case is not unique}}
293
-
}
294
-
295
-
enumRawTypeWithRepeatValuesAutoInc3:Double{
296
-
case Vaughn // expected-note {{raw value implicitly auto-incremented from zero}}
297
-
case Wilson // expected-note {{raw value previously used here}}
298
-
case Yeon =1 // expected-error {{raw value for enum case is not unique}}
299
-
}
300
-
301
-
enumRawTypeWithRepeatValuesAutoInc4:String{
223
+
enumRawTypeWithRepeatValuesAutoInc1:String{
302
224
case A ="B" // expected-note {{raw value previously used here}}
303
225
case B // expected-error {{raw value for enum case is not unique}}
304
226
}
305
227
306
-
enumRawTypeWithRepeatValuesAutoInc5:String{
228
+
enumRawTypeWithRepeatValuesAutoInc2:String{
307
229
case A // expected-note {{raw value previously used here}}
308
230
case B ="A" // expected-error {{raw value for enum case is not unique}}
309
231
}
310
232
311
-
enumRawTypeWithRepeatValuesAutoInc6:String{
233
+
enumRawTypeWithRepeatValuesAutoInc3:String{
312
234
case A
313
235
case B // expected-note {{raw value previously used here}}
314
236
case C ="B" // expected-error {{raw value for enum case is not unique}}
enumfoo:String{ // expected-error {{'foo' declares raw type 'String', but does not conform to RawRepresentable and conformance could not be synthesized}}
463
366
case bar =nil // expected-error {{cannot convert 'nil' to raw type 'String'}}
// FIXME: this test only passes on platforms which have Float80.
4
+
// <rdar://problem/19508460> Floating point enum raw values are not portable
5
+
6
+
// REQUIRES: CPU=i386 || CPU=x86_64
7
+
8
+
// Windows does not support FP80
9
+
// XFAIL: OS=windows-msvc
10
+
11
+
enumRawTypeWithFloatValues:Float{ // expected-error {{'RawTypeWithFloatValues' declares raw type 'Float', but does not conform to RawRepresentable and conformance could not be synthesized}}
12
+
case Northrup =1.5
13
+
case Overton // expected-error {{enum case must declare a raw value when the preceding raw value is not an integer}}
14
+
case Pettygrove =2.25
15
+
}
16
+
17
+
enumRawTypeWithRepeatValues2:Double{
18
+
case Vaughn =22 // expected-note {{raw value previously used here}}
19
+
case Wilson =22.0 // expected-error {{raw value for enum case is not unique}}
20
+
}
21
+
22
+
enumRawTypeWithRepeatValues3:Double{
23
+
// 2^63-1
24
+
case Vaughn =9223372036854775807 // expected-note {{raw value previously used here}}
25
+
case Wilson =9223372036854775807.0 // expected-error {{raw value for enum case is not unique}}
26
+
}
27
+
28
+
enumRawTypeWithRepeatValues4:Double{
29
+
// 2^64-1
30
+
case Vaughn =18446744073709551615 // expected-note {{raw value previously used here}}
31
+
case Wilson =18446744073709551615.0 // expected-error {{raw value for enum case is not unique}}
32
+
}
33
+
34
+
enumRawTypeWithRepeatValues5:Double{
35
+
// FIXME: should reject.
36
+
// 2^65-1
37
+
case Vaughn =36893488147419103231
38
+
case Wilson =36893488147419103231.0
39
+
}
40
+
41
+
enumRawTypeWithRepeatValues6:Double{
42
+
// FIXME: should reject.
43
+
// 2^127-1
44
+
case Vaughn =170141183460469231731687303715884105727
45
+
case Wilson =170141183460469231731687303715884105727.0
46
+
}
47
+
48
+
enumRawTypeWithRepeatValues7:Double{
49
+
// FIXME: should reject.
50
+
// 2^128-1
51
+
case Vaughn =340282366920938463463374607431768211455
52
+
case Wilson =340282366920938463463374607431768211455.0
53
+
}
54
+
55
+
enumRawTypeWithNonRepeatValues:Double{
56
+
case SantaClara =3.7
57
+
case SanFernando =7.4
58
+
case SanAntonio =-3.7
59
+
case SanCarlos =-7.4
60
+
}
61
+
62
+
enumRawTypeWithRepeatValuesAutoInc:Double{
63
+
case Vaughn =22 // expected-note {{raw value auto-incremented from here}}
64
+
case Wilson // expected-note {{raw value previously used here}}
65
+
case Yeon =23 // expected-error {{raw value for enum case is not unique}}
66
+
}
67
+
68
+
enumRawTypeWithRepeatValuesAutoInc2:Double{
69
+
case Vaughn =23 // expected-note {{raw value previously used here}}
70
+
case Wilson =22 // expected-note {{raw value auto-incremented from here}}
71
+
case Yeon // expected-error {{raw value for enum case is not unique}}
72
+
}
73
+
74
+
enumRawTypeWithRepeatValuesAutoInc3:Double{
75
+
case Vaughn // expected-note {{raw value implicitly auto-incremented from zero}}
76
+
case Wilson // expected-note {{raw value previously used here}}
77
+
case Yeon =1 // expected-error {{raw value for enum case is not unique}}
0 commit comments