Skip to content

Commit a32d21c

Browse files
authored
Merge pull request #42475 from DougGregor/strict-swift-6-only
2 parents 23e1773 + dd6a061 commit a32d21c

File tree

6 files changed

+12
-8
lines changed

6 files changed

+12
-8
lines changed

include/swift/Option/Options.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -695,12 +695,12 @@ def warn_swift3_objc_inference : Flag<["-"], "warn-swift3-objc-inference">,
695695
Flags<[FrontendOption, DoesNotAffectIncrementalBuild, HelpHidden]>;
696696

697697
def warn_concurrency : Flag<["-"], "warn-concurrency">,
698-
Flags<[FrontendOption, DoesNotAffectIncrementalBuild, ModuleInterfaceOptionIgnorable]>,
698+
Flags<[FrontendOption, DoesNotAffectIncrementalBuild]>,
699699
HelpText<"Warn about code that is unsafe according to the Swift Concurrency "
700700
"model and will become ill-formed in a future language version">;
701701

702702
def strict_concurrency : Joined<["-"], "strict-concurrency=">,
703-
Flags<[FrontendOption, ModuleInterfaceOptionIgnorable]>,
703+
Flags<[FrontendOption, DoesNotAffectIncrementalBuild]>,
704704
HelpText<"Specify the how strict concurrency checking will be. The value may "
705705
"be 'off' (most 'Sendable' checking is disabled), "
706706
"'limited' ('Sendable' checking is enabled in code that uses the "

lib/Frontend/Frontend.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,8 +1018,7 @@ ModuleDecl *CompilerInstance::getMainModule() const {
10181018
}
10191019
if (Invocation.getFrontendOptions().EnableLibraryEvolution)
10201020
MainModule->setResilienceStrategy(ResilienceStrategy::Resilient);
1021-
if (Invocation.getLangOptions().StrictConcurrencyLevel
1022-
>= StrictConcurrency::On)
1021+
if (Invocation.getLangOptions().isSwiftVersionAtLeast(6))
10231022
MainModule->setIsConcurrencyChecked(true);
10241023

10251024
// Register the main module with the AST context.

test/Concurrency/predates_concurrency_import.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/StrictModule.swiftmodule -module-name StrictModule -warn-concurrency %S/Inputs/StrictModule.swift
2+
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/StrictModule.swiftmodule -module-name StrictModule -swift-version 6 %S/Inputs/StrictModule.swift
33
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/NonStrictModule.swiftmodule -module-name NonStrictModule %S/Inputs/NonStrictModule.swift
44
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/OtherActors.swiftmodule -module-name OtherActors %S/Inputs/OtherActors.swift -disable-availability-checking
55

66
// RUN: %target-typecheck-verify-swift -typecheck -I %t
7+
// REQUIRES: concurrency
8+
// REQUIRES: asserts
79

810
@preconcurrency import NonStrictModule
911
@_predatesConcurrency import StrictModule // expected-warning{{'@_predatesConcurrency' has been renamed to '@preconcurrency'}}

test/Concurrency/sendable_preconcurrency.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/StrictModule.swiftmodule -module-name StrictModule -warn-concurrency %S/Inputs/StrictModule.swift
2+
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/StrictModule.swiftmodule -module-name StrictModule -swift-version 6 %S/Inputs/StrictModule.swift
33
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/NonStrictModule.swiftmodule -module-name NonStrictModule %S/Inputs/NonStrictModule.swift
44
// RUN: %target-typecheck-verify-swift -disable-availability-checking -I %t
55

66
// REQUIRES: concurrency
7+
// REQUIRES: asserts
78

89
import StrictModule // no remark: we never recommend @preconcurrency due to an explicitly non-Sendable (via -warn-concurrency) type
910
@preconcurrency import NonStrictModule

test/Concurrency/sendable_without_preconcurrency.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/StrictModule.swiftmodule -module-name StrictModule -warn-concurrency %S/Inputs/StrictModule.swift
2+
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/StrictModule.swiftmodule -module-name StrictModule -swift-version 6 %S/Inputs/StrictModule.swift
33
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/NonStrictModule.swiftmodule -module-name NonStrictModule %S/Inputs/NonStrictModule.swift
44
// RUN: %target-typecheck-verify-swift -disable-availability-checking -I %t
55

66
// REQUIRES: concurrency
7+
// REQUIRES: asserts
78

89
import StrictModule // no remark: we never recommend @preconcurrency due to an explicitly non-Sendable (via -warn-concurrency) type
910
import NonStrictModule

test/Concurrency/sendable_without_preconcurrency_2.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/StrictModule.swiftmodule -module-name StrictModule -warn-concurrency %S/Inputs/StrictModule.swift
2+
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/StrictModule.swiftmodule -module-name StrictModule -swift-version 6 %S/Inputs/StrictModule.swift
33
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/NonStrictModule.swiftmodule -module-name NonStrictModule %S/Inputs/NonStrictModule.swift
44
// RUN: %target-typecheck-verify-swift -disable-availability-checking -I %t
55

66
// REQUIRES: concurrency
7+
// REQUIRES: asserts
78

89
import StrictModule // no remark: we never recommend @preconcurrency due to an explicitly non-Sendable (via -warn-concurrency) type
910
import NonStrictModule // expected-remark{{add '@preconcurrency' to suppress 'Sendable'-related warnings from module 'NonStrictModule'}}

0 commit comments

Comments
 (0)