@@ -19,6 +19,7 @@ namespace {
1919
2020static const FeatureWrapper baselineF (Feature::AsyncAwait);
2121static const FeatureWrapper upcomingF (Feature::DynamicActorIsolation);
22+ static const FeatureWrapper adoptableUpcomingF (Feature::ExistentialAny);
2223static const FeatureWrapper experimentalF (Feature::NamedOpaqueTypes);
2324static const FeatureWrapper strictConcurrencyF (Feature::StrictConcurrency);
2425
@@ -47,6 +48,13 @@ TEST_F(IsFeatureEnabledTest, VerifyTestedFeatures) {
4748 ASSERT_LT (defaultLangMode, feature.langMode );
4849 }
4950
51+ feature = adoptableUpcomingF;
52+ {
53+ ASSERT_TRUE (getUpcomingFeature (feature.name ));
54+ ASSERT_TRUE (isFeatureAdoptable (feature));
55+ ASSERT_LT (defaultLangMode, feature.langMode );
56+ }
57+
5058 feature = strictConcurrencyF;
5159 {
5260 ASSERT_TRUE (getUpcomingFeature (feature.name ));
@@ -82,6 +90,7 @@ static const IsFeatureEnabledTestCase defaultStateTestCases[] = {
8290 {}, {
8391 {baselineF, FeatureState::Enabled},
8492 {upcomingF, FeatureState::Off},
93+ {adoptableUpcomingF, FeatureState::Off},
8594 {strictConcurrencyF, FeatureState::Off},
8695 {experimentalF, FeatureState::Off},
8796 }),
@@ -118,6 +127,7 @@ static const IsFeatureEnabledTestCase singleEnableTestCases[] = {
118127 IsFeatureEnabledTestCase (
119128 {" -enable-experimental-feature" , baselineF.name + " :adoption" },
120129 {{baselineF, FeatureState::Enabled}}),
130+
121131 IsFeatureEnabledTestCase (
122132 {" -enable-upcoming-feature" , upcomingF.name },
123133 {{upcomingF, FeatureState::Enabled}}),
@@ -136,6 +146,43 @@ static const IsFeatureEnabledTestCase singleEnableTestCases[] = {
136146 IsFeatureEnabledTestCase (
137147 {" -enable-experimental-feature" , upcomingF.name + " :adoption" },
138148 {{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
139186 IsFeatureEnabledTestCase (
140187 {" -enable-upcoming-feature" , strictConcurrencyF.name },
141188 {{strictConcurrencyF, FeatureState::Enabled}}),
@@ -154,6 +201,7 @@ static const IsFeatureEnabledTestCase singleEnableTestCases[] = {
154201 IsFeatureEnabledTestCase (
155202 {" -enable-experimental-feature" , strictConcurrencyF.name + " :adoption" },
156203 {{strictConcurrencyF, FeatureState::Off}}),
204+
157205 IsFeatureEnabledTestCase (
158206 {" -enable-upcoming-feature" , experimentalF.name },
159207 {{experimentalF, FeatureState::Off}}),
@@ -240,6 +288,9 @@ INSTANTIATE_TEST_SUITE_P(SingleDisable, IsFeatureEnabledTest,
240288
241289// clang-format off
242290static const IsFeatureEnabledTestCase doubleEnableTestCases[] = {
291+
292+ // MARK: Non-adoptable & upcoming
293+
243294 IsFeatureEnabledTestCase ({
244295 " -enable-upcoming-feature" , upcomingF.name + " :undef" ,
245296 " -enable-upcoming-feature" , upcomingF.name ,
@@ -320,6 +371,92 @@ static const IsFeatureEnabledTestCase doubleEnableTestCases[] = {
320371 " -enable-experimental-feature" , upcomingF.name + " :adoption" ,
321372 },
322373 {{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+
323460 IsFeatureEnabledTestCase ({
324461 " -enable-experimental-feature" , experimentalF.name + " :undef" ,
325462 " -enable-experimental-feature" , experimentalF.name ,
0 commit comments