Skip to content

Commit faf9950

Browse files
authored
Merge pull request #506 from xedin/rdar-151028636
[Swift] Add `Approachable Concurrency` setting and `Concurrency` category
2 parents f0db110 + 41baf34 commit faf9950

File tree

2 files changed

+65
-19
lines changed

2 files changed

+65
-19
lines changed

Sources/SWBUniversalPlatform/Specs/Swift.xcspec

Lines changed: 57 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,44 @@
500500
DefaultValue = "_$(SWIFT_VERSION)";
501501
},
502502

503+
// Operator OR for a default value condition, simulates `$(X) || $(Y)` in `DefaultValue` field.
504+
{
505+
Name = "SETTING_DefaultValue_YES_YES";
506+
Type = Boolean;
507+
DefaultValue = YES;
508+
},
509+
510+
{
511+
Name = "SETTING_DefaultValue_YES_NO";
512+
Type = Boolean;
513+
DefaultValue = YES;
514+
},
515+
{
516+
Name = "SETTING_DefaultValue_NO_YES";
517+
Type = Boolean;
518+
DefaultValue = YES;
519+
},
520+
{
521+
Name = "SETTING_DefaultValue_NO_NO";
522+
Type = Boolean;
523+
DefaultValue = NO;
524+
},
525+
{
526+
Name = "SETTING_DefaultValue__";
527+
Type = Boolean;
528+
DefaultValue = NO;
529+
},
530+
531+
{
532+
Name = "SWIFT_APPROACHABLE_CONCURRENCY";
533+
Type = Boolean;
534+
DefaultValue = NO;
535+
Condition = "$(EFFECTIVE_SWIFT_VERSION) == '4' || $(EFFECTIVE_SWIFT_VERSION) == '4.2' || $(EFFECTIVE_SWIFT_VERSION) == '5'";
536+
DisplayName = "Approachable Concurrency";
537+
Category = "Concurrency";
538+
Description = "Enables upcoming features that aim to provide a more approachable path to Swift Concurrency: DisableOutwardActorInference, GlobalActorIsolatedTypesUsability, InferIsolatedConformances, InferSendableFromCaptures, and NonisolatedNonsendingByDefault.";
539+
},
540+
503541
// Upcoming Swift 6.0 features
504542
{
505543
Name = "ENABLE_SWIFT_6_UPCOMING_FEATURES_IN_SWIFT_VERSION_6_0";
@@ -566,7 +604,7 @@
566604
"<<otherwise>>" = ( "-enable-upcoming-feature", "StrictConcurrency" );
567605
};
568606
DisplayName = "Strict Concurrency Checking";
569-
Category = "Upcoming Features";
607+
Category = "Concurrency";
570608
Description = "Enables strict concurrency checking to produce warnings for possible data races. This is always 'complete' when in the Swift 6 language mode and produces errors instead of warnings.";
571609
},
572610
{
@@ -582,7 +620,7 @@
582620
MainActor = ( "-default-isolation=MainActor" );
583621
};
584622
DisplayName = "Default Actor Isolation";
585-
Category = "Language";
623+
Category = "Concurrency";
586624
Description = "Controls default actor isolation for unannotated code. When set to 'MainActor', `@MainActor` isolation will be inferred by default to mitigate false-positive data-race safety errors in sequential code.";
587625
},
588626
{
@@ -643,7 +681,7 @@
643681
{
644682
Name = "SWIFT_UPCOMING_FEATURE_DISABLE_OUTWARD_ACTOR_ISOLATION";
645683
Type = Boolean;
646-
DefaultValue = "$(SWIFT_UPCOMING_FEATURE_6_0)";
684+
DefaultValue = "$(SETTING_DefaultValue_$(SWIFT_UPCOMING_FEATURE_6_0)_$(SWIFT_APPROACHABLE_CONCURRENCY))";
647685
Condition = "$(EFFECTIVE_SWIFT_VERSION) == '4' || $(EFFECTIVE_SWIFT_VERSION) == '4.2' || $(EFFECTIVE_SWIFT_VERSION) == '5'";
648686
CommandLineArgs = {
649687
YES = ( "-enable-upcoming-feature", "DisableOutwardActorInference" );
@@ -685,7 +723,7 @@
685723
{
686724
Name = "SWIFT_UPCOMING_FEATURE_INFER_SENDABLE_FROM_CAPTURES";
687725
Type = Boolean;
688-
DefaultValue = "$(SWIFT_UPCOMING_FEATURE_6_0)";
726+
DefaultValue = "$(SETTING_DefaultValue_$(SWIFT_UPCOMING_FEATURE_6_0)_$(SWIFT_APPROACHABLE_CONCURRENCY))";
689727
Condition = "$(EFFECTIVE_SWIFT_VERSION) == '4' || $(EFFECTIVE_SWIFT_VERSION) == '4.2' || $(EFFECTIVE_SWIFT_VERSION) == '5'";
690728
CommandLineArgs = {
691729
YES = ( "-enable-upcoming-feature", "InferSendableFromCaptures" );
@@ -755,7 +793,7 @@
755793
{
756794
Name = "SWIFT_UPCOMING_FEATURE_GLOBAL_ACTOR_ISOLATED_TYPES_USABILITY";
757795
Type = Boolean;
758-
DefaultValue = "$(SWIFT_UPCOMING_FEATURE_6_0)";
796+
DefaultValue = "$(SETTING_DefaultValue_$(SWIFT_UPCOMING_FEATURE_6_0)_$(SWIFT_APPROACHABLE_CONCURRENCY))";
759797
Condition = "$(EFFECTIVE_SWIFT_VERSION) == '4' || $(EFFECTIVE_SWIFT_VERSION) == '4.2' || $(EFFECTIVE_SWIFT_VERSION) == '5'";
760798
CommandLineArgs = {
761799
YES = ( "-enable-upcoming-feature", "GlobalActorIsolatedTypesUsability" );
@@ -797,15 +835,15 @@
797835
Name = "SWIFT_UPCOMING_FEATURE_EXISTENTIAL_ANY";
798836
Type = Enumeration;
799837
Values = (
800-
Yes,
801-
Migrate,
802-
No,
838+
YES,
839+
MIGRATE,
840+
NO,
803841
);
804842
DefaultValue = No;
805843
CommandLineArgs = {
806-
Yes = ( "-enable-upcoming-feature", "ExistentialAny" );
807-
Migrate = ( "-enable-upcoming-feature", "ExistentialAny:migrate" );
808-
No = ();
844+
YES = ( "-enable-upcoming-feature", "ExistentialAny" );
845+
MIGRATE = ( "-enable-upcoming-feature", "ExistentialAny:migrate" );
846+
NO = ();
809847
};
810848
DisplayName = "Require Existential any";
811849
Category = "Upcoming Features";
@@ -815,7 +853,7 @@
815853
{
816854
Name = "SWIFT_UPCOMING_FEATURE_INFER_ISOLATED_CONFORMANCES";
817855
Type = Boolean;
818-
DefaultValue = NO;
856+
DefaultValue = "$(SWIFT_APPROACHABLE_CONCURRENCY)";
819857
CommandLineArgs = {
820858
YES = ( "-enable-upcoming-feature", "InferIsolatedConformances" );
821859
NO = ();
@@ -829,15 +867,15 @@
829867
Name = "SWIFT_UPCOMING_FEATURE_NONISOLATED_NONSENDING_BY_DEFAULT";
830868
Type = Enumeration;
831869
Values = (
832-
Yes,
833-
Migrate,
834-
No,
870+
YES,
871+
MIGRATE,
872+
NO,
835873
);
836-
DefaultValue = No;
874+
DefaultValue = "$(SWIFT_APPROACHABLE_CONCURRENCY)";
837875
CommandLineArgs = {
838-
Yes = ( "-enable-upcoming-feature", "NonisolatedNonsendingByDefault" );
839-
Migrate = ( "-enable-upcoming-feature", "NonisolatedNonsendingByDefault:migrate" );
840-
No = ();
876+
YES = ( "-enable-upcoming-feature", "NonisolatedNonsendingByDefault" );
877+
MIGRATE = ( "-enable-upcoming-feature", "NonisolatedNonsendingByDefault:migrate" );
878+
NO = ();
841879
};
842880
DisplayName = "nonisolated(nonsending) By Default";
843881
Category = "Upcoming Features";

Sources/SWBUniversalPlatform/Specs/en.lproj/Swift Compiler.strings

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,11 @@
5757

5858
"[SWIFT_ENABLE_EXPLICIT_MODULES]-value-[YES]" = "Yes";
5959
"[SWIFT_ENABLE_EXPLICIT_MODULES]-value-[NO]" = "No";
60+
61+
"[SWIFT_UPCOMING_FEATURE_NONISOLATED_NONSENDING_BY_DEFAULT]-value-[YES]" = "Yes";
62+
"[SWIFT_UPCOMING_FEATURE_NONISOLATED_NONSENDING_BY_DEFAULT]-value-[NO]" = "No";
63+
"[SWIFT_UPCOMING_FEATURE_NONISOLATED_NONSENDING_BY_DEFAULT]-value-[MIGRATE]" = "Migrate";
64+
65+
"[SWIFT_UPCOMING_FEATURE_EXISTENTIAL_ANY]-value-[YES]" = "Yes";
66+
"[SWIFT_UPCOMING_FEATURE_EXISTENTIAL_ANY]-value-[NO]" = "No";
67+
"[SWIFT_UPCOMING_FEATURE_EXISTENTIAL_ANY]-value-[MIGRATE]" = "Migrate";

0 commit comments

Comments
 (0)