@@ -19,6 +19,7 @@ namespace {
19
19
20
20
static const FeatureWrapper baselineF (Feature::AsyncAwait);
21
21
static const FeatureWrapper upcomingF (Feature::DynamicActorIsolation);
22
+ static const FeatureWrapper adoptableUpcomingF (Feature::ExistentialAny);
22
23
static const FeatureWrapper experimentalF (Feature::NamedOpaqueTypes);
23
24
static const FeatureWrapper strictConcurrencyF (Feature::StrictConcurrency);
24
25
@@ -47,6 +48,13 @@ TEST_F(IsFeatureEnabledTest, VerifyTestedFeatures) {
47
48
ASSERT_LT (defaultLangMode, feature.langMode );
48
49
}
49
50
51
+ feature = adoptableUpcomingF;
52
+ {
53
+ ASSERT_TRUE (getUpcomingFeature (feature.name ));
54
+ ASSERT_TRUE (isFeatureAdoptable (feature));
55
+ ASSERT_LT (defaultLangMode, feature.langMode );
56
+ }
57
+
50
58
feature = strictConcurrencyF;
51
59
{
52
60
ASSERT_TRUE (getUpcomingFeature (feature.name ));
@@ -82,6 +90,7 @@ static const IsFeatureEnabledTestCase defaultStateTestCases[] = {
82
90
{}, {
83
91
{baselineF, FeatureState::Enabled},
84
92
{upcomingF, FeatureState::Off},
93
+ {adoptableUpcomingF, FeatureState::Off},
85
94
{strictConcurrencyF, FeatureState::Off},
86
95
{experimentalF, FeatureState::Off},
87
96
}),
@@ -118,6 +127,7 @@ static const IsFeatureEnabledTestCase singleEnableTestCases[] = {
118
127
IsFeatureEnabledTestCase (
119
128
{" -enable-experimental-feature" , baselineF.name + " :adoption" },
120
129
{{baselineF, FeatureState::Enabled}}),
130
+
121
131
IsFeatureEnabledTestCase (
122
132
{" -enable-upcoming-feature" , upcomingF.name },
123
133
{{upcomingF, FeatureState::Enabled}}),
@@ -136,6 +146,43 @@ static const IsFeatureEnabledTestCase singleEnableTestCases[] = {
136
146
IsFeatureEnabledTestCase (
137
147
{" -enable-experimental-feature" , upcomingF.name + " :adoption" },
138
148
{{upcomingF, FeatureState::Off}}),
149
+
150
+ IsFeatureEnabledTestCase (
151
+ {" -enable-upcoming-feature" , adoptableUpcomingF.name },
152
+ {{adoptableUpcomingF, FeatureState::Enabled}}),
153
+ IsFeatureEnabledTestCase (
154
+ {" -enable-upcoming-feature" , adoptableUpcomingF.name + " :undef" },
155
+ {{adoptableUpcomingF, FeatureState::Off}}),
156
+ IsFeatureEnabledTestCase (
157
+ {" -enable-upcoming-feature" , adoptableUpcomingF.name + " :adoption" },
158
+ {{adoptableUpcomingF, FeatureState::EnabledForAdoption}}),
159
+ // Swift 7 is asserts-only.
160
+ #ifndef NDEBUG
161
+ // Requesting adoption mode in target language mode has no effect.
162
+ IsFeatureEnabledTestCase ({
163
+ " -swift-version" , adoptableUpcomingF.langMode ,
164
+ " -enable-upcoming-feature" , adoptableUpcomingF.name + " :adoption" ,
165
+ },
166
+ {{adoptableUpcomingF, FeatureState::Enabled}}),
167
+ #endif
168
+ IsFeatureEnabledTestCase (
169
+ {" -enable-experimental-feature" , adoptableUpcomingF.name },
170
+ {{adoptableUpcomingF, FeatureState::Enabled}}),
171
+ IsFeatureEnabledTestCase (
172
+ {" -enable-experimental-feature" , adoptableUpcomingF.name + " :undef" },
173
+ {{adoptableUpcomingF, FeatureState::Off}}),
174
+ IsFeatureEnabledTestCase (
175
+ {" -enable-experimental-feature" , adoptableUpcomingF.name + " :adoption" },
176
+ {{adoptableUpcomingF, FeatureState::EnabledForAdoption}}),
177
+ // Swift 7 is asserts-only.
178
+ #ifndef NDEBUG
179
+ // Requesting adoption mode in target language mode has no effect.
180
+ IsFeatureEnabledTestCase ({
181
+ " -swift-version" , adoptableUpcomingF.langMode ,
182
+ " -enable-experimental-feature" , adoptableUpcomingF.name + " :adoption" ,
183
+ },
184
+ {{adoptableUpcomingF, FeatureState::Enabled}}),
185
+ #endif
139
186
IsFeatureEnabledTestCase (
140
187
{" -enable-upcoming-feature" , strictConcurrencyF.name },
141
188
{{strictConcurrencyF, FeatureState::Enabled}}),
@@ -154,6 +201,7 @@ static const IsFeatureEnabledTestCase singleEnableTestCases[] = {
154
201
IsFeatureEnabledTestCase (
155
202
{" -enable-experimental-feature" , strictConcurrencyF.name + " :adoption" },
156
203
{{strictConcurrencyF, FeatureState::Off}}),
204
+
157
205
IsFeatureEnabledTestCase (
158
206
{" -enable-upcoming-feature" , experimentalF.name },
159
207
{{experimentalF, FeatureState::Off}}),
@@ -240,6 +288,9 @@ INSTANTIATE_TEST_SUITE_P(SingleDisable, IsFeatureEnabledTest,
240
288
241
289
// clang-format off
242
290
static const IsFeatureEnabledTestCase doubleEnableTestCases[] = {
291
+
292
+ // MARK: Non-adoptable & upcoming
293
+
243
294
IsFeatureEnabledTestCase ({
244
295
" -enable-upcoming-feature" , upcomingF.name + " :undef" ,
245
296
" -enable-upcoming-feature" , upcomingF.name ,
@@ -320,6 +371,92 @@ static const IsFeatureEnabledTestCase doubleEnableTestCases[] = {
320
371
" -enable-experimental-feature" , upcomingF.name + " :adoption" ,
321
372
},
322
373
{{upcomingF, FeatureState::Enabled}}),
374
+
375
+ // MARK: Adoptable & upcoming
376
+
377
+ IsFeatureEnabledTestCase ({
378
+ " -enable-upcoming-feature" , adoptableUpcomingF.name + " :undef" ,
379
+ " -enable-upcoming-feature" , adoptableUpcomingF.name ,
380
+ },
381
+ {{adoptableUpcomingF, FeatureState::Enabled}}),
382
+ IsFeatureEnabledTestCase ({
383
+ " -enable-upcoming-feature" , adoptableUpcomingF.name + " :adoption" ,
384
+ " -enable-upcoming-feature" , adoptableUpcomingF.name ,
385
+ },
386
+ {{adoptableUpcomingF, FeatureState::Enabled}}),
387
+ IsFeatureEnabledTestCase ({
388
+ " -enable-upcoming-feature" , adoptableUpcomingF.name ,
389
+ " -enable-upcoming-feature" , adoptableUpcomingF.name + " :undef" ,
390
+ },
391
+ {{adoptableUpcomingF, FeatureState::Enabled}}),
392
+ IsFeatureEnabledTestCase ({
393
+ " -enable-upcoming-feature" , adoptableUpcomingF.name ,
394
+ " -enable-upcoming-feature" , adoptableUpcomingF.name + " :adoption" ,
395
+ },
396
+ {{adoptableUpcomingF, FeatureState::EnabledForAdoption}}),
397
+ IsFeatureEnabledTestCase ({
398
+ " -enable-upcoming-feature" , adoptableUpcomingF.name + " :undef" ,
399
+ " -enable-experimental-feature" , adoptableUpcomingF.name ,
400
+ },
401
+ {{adoptableUpcomingF, FeatureState::Enabled}}),
402
+ IsFeatureEnabledTestCase ({
403
+ " -enable-upcoming-feature" , adoptableUpcomingF.name + " :adoption" ,
404
+ " -enable-experimental-feature" , adoptableUpcomingF.name ,
405
+ },
406
+ {{adoptableUpcomingF, FeatureState::Enabled}}),
407
+ IsFeatureEnabledTestCase ({
408
+ " -enable-upcoming-feature" , adoptableUpcomingF.name ,
409
+ " -enable-experimental-feature" , adoptableUpcomingF.name + " :undef" ,
410
+ },
411
+ {{adoptableUpcomingF, FeatureState::Enabled}}),
412
+ IsFeatureEnabledTestCase ({
413
+ " -enable-upcoming-feature" , adoptableUpcomingF.name ,
414
+ " -enable-experimental-feature" , adoptableUpcomingF.name + " :adoption" ,
415
+ },
416
+ {{adoptableUpcomingF, FeatureState::EnabledForAdoption}}),
417
+ IsFeatureEnabledTestCase ({
418
+ " -enable-experimental-feature" , adoptableUpcomingF.name + " :undef" ,
419
+ " -enable-upcoming-feature" , adoptableUpcomingF.name ,
420
+ },
421
+ {{adoptableUpcomingF, FeatureState::Enabled}}),
422
+ IsFeatureEnabledTestCase ({
423
+ " -enable-experimental-feature" , adoptableUpcomingF.name + " :adoption" ,
424
+ " -enable-upcoming-feature" , adoptableUpcomingF.name ,
425
+ },
426
+ {{adoptableUpcomingF, FeatureState::Enabled}}),
427
+ IsFeatureEnabledTestCase ({
428
+ " -enable-experimental-feature" , adoptableUpcomingF.name ,
429
+ " -enable-upcoming-feature" , adoptableUpcomingF.name + " :undef" ,
430
+ },
431
+ {{adoptableUpcomingF, FeatureState::Enabled}}),
432
+ IsFeatureEnabledTestCase ({
433
+ " -enable-experimental-feature" , adoptableUpcomingF.name ,
434
+ " -enable-upcoming-feature" , adoptableUpcomingF.name + " :adoption" ,
435
+ },
436
+ {{adoptableUpcomingF, FeatureState::EnabledForAdoption}}),
437
+ IsFeatureEnabledTestCase ({
438
+ " -enable-experimental-feature" , adoptableUpcomingF.name + " :undef" ,
439
+ " -enable-experimental-feature" , adoptableUpcomingF.name ,
440
+ },
441
+ {{adoptableUpcomingF, FeatureState::Enabled}}),
442
+ IsFeatureEnabledTestCase ({
443
+ " -enable-experimental-feature" , adoptableUpcomingF.name + " :adoption" ,
444
+ " -enable-experimental-feature" , adoptableUpcomingF.name ,
445
+ },
446
+ {{adoptableUpcomingF, FeatureState::Enabled}}),
447
+ IsFeatureEnabledTestCase ({
448
+ " -enable-experimental-feature" , adoptableUpcomingF.name ,
449
+ " -enable-experimental-feature" , adoptableUpcomingF.name + " :undef" ,
450
+ },
451
+ {{adoptableUpcomingF, FeatureState::Enabled}}),
452
+ IsFeatureEnabledTestCase ({
453
+ " -enable-experimental-feature" , adoptableUpcomingF.name ,
454
+ " -enable-experimental-feature" , adoptableUpcomingF.name + " :adoption" ,
455
+ },
456
+ {{adoptableUpcomingF, FeatureState::EnabledForAdoption}}),
457
+
458
+ // MARK: Experimental
459
+
323
460
IsFeatureEnabledTestCase ({
324
461
" -enable-experimental-feature" , experimentalF.name + " :undef" ,
325
462
" -enable-experimental-feature" , experimentalF.name ,
0 commit comments