Skip to content

Commit efbd7cd

Browse files
authored
Merge pull request #42523 from DougGregor/strict-concurrency-minimal-5.7
2 parents 7aa36e5 + 3b21a71 commit efbd7cd

24 files changed

+207
-64
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,20 @@ namespace swift {
5858
Complete,
5959
};
6060

61+
/// Describes how strict concurrency checking should be.
62+
enum class StrictConcurrency {
63+
/// Enforce Sendable constraints where it has been explicitly adopted and
64+
/// perform actor-isolation checking wherever code has adopted concurrency.
65+
Minimal,
66+
/// Enforce Sendable constraints and perform actor-isolation checking
67+
/// wherever code has adopted concurrency, including code that has
68+
/// explicitly adopted Sendable.
69+
Targeted,
70+
/// Enforce Sendable constraints and actor-isolation checking throughout
71+
/// the entire module.
72+
Complete,
73+
};
74+
6175
/// Access or distribution level of a library.
6276
enum class LibraryLevel : uint8_t {
6377
/// Application Programming Interface that is publicly distributed so
@@ -310,11 +324,8 @@ namespace swift {
310324
/// optimized custom allocator, so that memory debugging tools can be used.
311325
bool UseMalloc = false;
312326

313-
/// Provide additional warnings about code that is unsafe in the
314-
/// eventual Swift concurrency model, and will eventually become errors
315-
/// in a future Swift language version, but are too noisy for existing
316-
/// language modes.
317-
bool WarnConcurrency = false;
327+
/// Specifies how strict concurrency checking will be.
328+
StrictConcurrency StrictConcurrencyLevel = StrictConcurrency::Minimal;
318329

319330
/// Enable experimental #assert feature.
320331
bool EnableExperimentalStaticAssert = false;

include/swift/Option/Options.td

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,10 +699,18 @@ def warn_swift3_objc_inference : Flag<["-"], "warn-swift3-objc-inference">,
699699
Flags<[FrontendOption, DoesNotAffectIncrementalBuild, HelpHidden]>;
700700

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

706+
def strict_concurrency : Joined<["-"], "strict-concurrency=">,
707+
Flags<[FrontendOption, DoesNotAffectIncrementalBuild]>,
708+
HelpText<"Specify the how strict concurrency checking will be. The value may "
709+
"be 'explicit' (most 'Sendable' checking is disabled), "
710+
"'targeted' ('Sendable' checking is enabled in code that uses the "
711+
"concurrency model, or 'complete' ('Sendable' and other checking is "
712+
"enabled for all code in the module)">;
713+
706714
def Rpass_EQ : Joined<["-"], "Rpass=">,
707715
Flags<[FrontendOption]>,
708716
HelpText<"Report performed transformations by optimization passes whose "

lib/AST/Decl.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9162,7 +9162,9 @@ ActorIsolation swift::getActorIsolationOfContext(DeclContext *dc) {
91629162
}
91639163

91649164
if (auto *tld = dyn_cast<TopLevelCodeDecl>(dc)) {
9165-
if (dc->isAsyncContext() || dc->getASTContext().LangOpts.WarnConcurrency) {
9165+
if (dc->isAsyncContext() ||
9166+
dc->getASTContext().LangOpts.StrictConcurrencyLevel
9167+
>= StrictConcurrency::Complete) {
91669168
if (Type mainActor = dc->getASTContext().getMainActorType())
91679169
return ActorIsolation::forGlobalActor(
91689170
mainActor,

lib/Driver/ToolChains.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ void ToolChain::addCommonFrontendArgs(const OutputInfo &OI,
235235
options::OPT_enable_actor_data_race_checks,
236236
options::OPT_disable_actor_data_race_checks);
237237
inputArgs.AddLastArg(arguments, options::OPT_warn_concurrency);
238+
inputArgs.AddLastArg(arguments, options::OPT_strict_concurrency);
238239
inputArgs.AddLastArg(arguments, options::OPT_warn_implicit_overrides);
239240
inputArgs.AddLastArg(arguments, options::OPT_typo_correction_limit);
240241
inputArgs.AddLastArg(arguments, options::OPT_enable_app_extension);

lib/Frontend/CompilerInvocation.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,28 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
684684
}
685685
}
686686

687-
Opts.WarnConcurrency |= Args.hasArg(OPT_warn_concurrency);
687+
// Swift 6+ uses the strictest concurrency level.
688+
if (Opts.isSwiftVersionAtLeast(6)) {
689+
Opts.StrictConcurrencyLevel = StrictConcurrency::Complete;
690+
} else if (const Arg *A = Args.getLastArg(OPT_strict_concurrency)) {
691+
auto value = llvm::StringSwitch<Optional<StrictConcurrency>>(A->getValue())
692+
.Case("minimal", StrictConcurrency::Minimal)
693+
.Case("targeted", StrictConcurrency::Targeted)
694+
.Case("complete", StrictConcurrency::Complete)
695+
.Default(None);
696+
697+
if (value)
698+
Opts.StrictConcurrencyLevel = *value;
699+
else
700+
Diags.diagnose(SourceLoc(), diag::error_invalid_arg_value,
701+
A->getAsString(Args), A->getValue());
702+
703+
} else if (Args.hasArg(OPT_warn_concurrency)) {
704+
Opts.StrictConcurrencyLevel = StrictConcurrency::Complete;
705+
} else {
706+
// Default to minimal checking in Swift 5.x.
707+
Opts.StrictConcurrencyLevel = StrictConcurrency::Minimal;
708+
}
688709

689710
Opts.WarnImplicitOverrides =
690711
Args.hasArg(OPT_warn_implicit_overrides);

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().WarnConcurrency ||
1022-
Invocation.getLangOptions().isSwiftVersionAtLeast(6))
1021+
if (Invocation.getLangOptions().isSwiftVersionAtLeast(6))
10231022
MainModule->setIsConcurrencyChecked(true);
10241023

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

lib/IDE/CompletionLookup.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -750,8 +750,7 @@ void CompletionLookup::analyzeActorIsolation(
750750
// For "unsafe" global actor isolation, automatic 'async' only happens
751751
// if the context has adopted concurrency.
752752
if (!CanCurrDeclContextHandleAsync &&
753-
!completionContextUsesConcurrencyFeatures(CurrDeclContext) &&
754-
!CurrDeclContext->getParentModule()->isConcurrencyChecked()) {
753+
!completionContextUsesConcurrencyFeatures(CurrDeclContext)) {
755754
return;
756755
}
757756
LLVM_FALLTHROUGH;
@@ -769,7 +768,7 @@ void CompletionLookup::analyzeActorIsolation(
769768
}
770769

771770
// If the reference is 'async', all types must be 'Sendable'.
772-
if (CurrDeclContext->getParentModule()->isConcurrencyChecked() &&
771+
if (Ctx.LangOpts.StrictConcurrencyLevel >= StrictConcurrency::Complete &&
773772
implicitlyAsync && T) {
774773
auto *M = CurrDeclContext->getParentModule();
775774
if (isa<VarDecl>(VD)) {

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,8 @@ GlobalActorAttributeRequest::evaluate(
346346
// ... but not if it's an async-context top-level global
347347
if (var->isTopLevelGlobal() &&
348348
(var->getDeclContext()->isAsyncContext() ||
349-
var->getASTContext().LangOpts.WarnConcurrency)) {
349+
var->getASTContext().LangOpts.StrictConcurrencyLevel >=
350+
StrictConcurrency::Complete)) {
350351
var->diagnose(diag::global_actor_top_level_var)
351352
.highlight(globalActorAttr->getRangeWithAt());
352353
return None;
@@ -727,9 +728,6 @@ static bool hasUnavailableConformance(ProtocolConformanceRef conformance) {
727728
}
728729

729730
static bool shouldDiagnoseExistingDataRaces(const DeclContext *dc) {
730-
if (dc->getParentModule()->isConcurrencyChecked())
731-
return true;
732-
733731
return contextRequiresStrictConcurrencyChecking(dc, [](const AbstractClosureExpr *) {
734732
return Type();
735733
});
@@ -738,7 +736,7 @@ static bool shouldDiagnoseExistingDataRaces(const DeclContext *dc) {
738736
/// Determine the default diagnostic behavior for this language mode.
739737
static DiagnosticBehavior defaultSendableDiagnosticBehavior(
740738
const LangOptions &langOpts) {
741-
// Prior to Swift 6, all Sendable-related diagnostics are warnings.
739+
// Prior to Swift 6, all Sendable-related diagnostics are warnings at most.
742740
if (!langOpts.isSwiftVersionAtLeast(6))
743741
return DiagnosticBehavior::Warning;
744742

@@ -770,6 +768,30 @@ DiagnosticBehavior SendableCheckContext::defaultDiagnosticBehavior() const {
770768
return defaultSendableDiagnosticBehavior(fromDC->getASTContext().LangOpts);
771769
}
772770

771+
DiagnosticBehavior
772+
SendableCheckContext::implicitSendableDiagnosticBehavior() const {
773+
switch (fromDC->getASTContext().LangOpts.StrictConcurrencyLevel) {
774+
case StrictConcurrency::Targeted:
775+
// Limited checking only diagnoses implicit Sendable within contexts that
776+
// have adopted concurrency.
777+
if (shouldDiagnoseExistingDataRaces(fromDC))
778+
return DiagnosticBehavior::Warning;
779+
780+
LLVM_FALLTHROUGH;
781+
782+
case StrictConcurrency::Minimal:
783+
// Explicit Sendable conformances always diagnose, even when strict
784+
// strict checking is disabled.
785+
if (isExplicitSendableConformance())
786+
return DiagnosticBehavior::Warning;
787+
788+
return DiagnosticBehavior::Ignore;
789+
790+
case StrictConcurrency::Complete:
791+
return defaultDiagnosticBehavior();
792+
}
793+
}
794+
773795
/// Determine whether the given nominal type has an explicit Sendable
774796
/// conformance (regardless of its availability).
775797
static bool hasExplicitSendableConformance(NominalTypeDecl *nominal,
@@ -864,10 +886,10 @@ DiagnosticBehavior SendableCheckContext::diagnosticBehavior(
864886
: DiagnosticBehavior::Ignore;
865887
}
866888

867-
auto defaultBehavior = defaultDiagnosticBehavior();
889+
DiagnosticBehavior defaultBehavior = implicitSendableDiagnosticBehavior();
868890

869891
// If we are checking an implicit Sendable conformance, don't suppress
870-
// diagnostics for declarations in the same module. We want them so make
892+
// diagnostics for declarations in the same module. We want them to make
871893
// enclosing inferred types non-Sendable.
872894
if (defaultBehavior == DiagnosticBehavior::Ignore &&
873895
nominal->getParentSourceFile() &&
@@ -885,7 +907,7 @@ bool swift::diagnoseSendabilityErrorBasedOn(
885907
if (nominal) {
886908
behavior = fromContext.diagnosticBehavior(nominal);
887909
} else {
888-
behavior = fromContext.defaultDiagnosticBehavior();
910+
behavior = fromContext.implicitSendableDiagnosticBehavior();
889911
}
890912

891913
bool wasSuppressed = diagnose(behavior);
@@ -2048,9 +2070,16 @@ namespace {
20482070
///
20492071
/// \returns true if we diagnosed the entity, \c false otherwise.
20502072
bool diagnoseReferenceToUnsafeGlobal(ValueDecl *value, SourceLoc loc) {
2051-
if (!getDeclContext()->getParentModule()->isConcurrencyChecked())
2073+
switch (value->getASTContext().LangOpts.StrictConcurrencyLevel) {
2074+
case StrictConcurrency::Minimal:
2075+
case StrictConcurrency::Targeted:
2076+
// Never diagnose.
20522077
return false;
20532078

2079+
case StrictConcurrency::Complete:
2080+
break;
2081+
}
2082+
20542083
// Only diagnose direct references to mutable global state.
20552084
auto var = dyn_cast<VarDecl>(value);
20562085
if (!var || var->isLet())
@@ -3954,7 +3983,8 @@ ActorIsolation ActorIsolationRequest::evaluate(
39543983

39553984
if (auto var = dyn_cast<VarDecl>(value)) {
39563985
if (var->isTopLevelGlobal() &&
3957-
(var->getASTContext().LangOpts.WarnConcurrency ||
3986+
(var->getASTContext().LangOpts.StrictConcurrencyLevel >=
3987+
StrictConcurrency::Complete ||
39583988
var->getDeclContext()->isAsyncContext())) {
39593989
if (Type mainActor = var->getASTContext().getMainActorType())
39603990
return inferredIsolation(
@@ -4155,10 +4185,16 @@ void swift::checkOverrideActorIsolation(ValueDecl *value) {
41554185
bool swift::contextRequiresStrictConcurrencyChecking(
41564186
const DeclContext *dc,
41574187
llvm::function_ref<Type(const AbstractClosureExpr *)> getType) {
4158-
// If Swift >= 6, everything uses strict concurrency checking.
4159-
if (dc->getASTContext().LangOpts.isSwiftVersionAtLeast(6))
4188+
switch (dc->getASTContext().LangOpts.StrictConcurrencyLevel) {
4189+
case StrictConcurrency::Complete:
41604190
return true;
41614191

4192+
case StrictConcurrency::Targeted:
4193+
case StrictConcurrency::Minimal:
4194+
// Check below to see if the context has adopted concurrency features.
4195+
break;
4196+
}
4197+
41624198
while (!dc->isModuleScopeContext()) {
41634199
if (auto closure = dyn_cast<AbstractClosureExpr>(dc)) {
41644200
// A closure with an explicit global actor or nonindependent

lib/Sema/TypeCheckConcurrency.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,9 @@ struct SendableCheckContext {
300300
/// Sendable conformance in this context.
301301
DiagnosticBehavior defaultDiagnosticBehavior() const;
302302

303+
/// Determine the diagnostic behavior for an implicitly non-Sendable type.
304+
DiagnosticBehavior implicitSendableDiagnosticBehavior() const;
305+
303306
/// Determine the diagnostic behavior when referencing the given nominal
304307
/// type in this context.
305308
DiagnosticBehavior diagnosticBehavior(NominalTypeDecl *nominal) const;

test/ClangImporter/objc_async.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -I %S/Inputs/custom-modules %s -verify -verify-additional-file %swift_src_root/test/Inputs/clang-importer-sdk/usr/include/ObjCConcurrency.h -warn-concurrency -parse-as-library
1+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -I %S/Inputs/custom-modules %s -verify -verify-additional-file %swift_src_root/test/Inputs/clang-importer-sdk/usr/include/ObjCConcurrency.h -strict-concurrency=targeted -parse-as-library
22

33
// REQUIRES: objc_interop
44
// REQUIRES: concurrency
55
import Foundation
66
import ObjCConcurrency
7-
// expected-remark@-1{{add '@preconcurrency' to suppress 'Sendable'-related warnings from module 'ObjCConcurrency'}}
87

98
@available(SwiftStdlib 5.5, *)
109
@MainActor func onlyOnMainActor() { }
@@ -358,8 +357,6 @@ func testSender(
358357
// expected-warning@-1 {{conformance of 'NonSendableClass' to 'Sendable' is unavailable}}
359358

360359
sender.sendGeneric(sendableGeneric)
361-
// expected-warning@-1 {{type 'GenericObject<SendableClass>' does not conform to the 'Sendable' protocol}}
362-
// FIXME(rdar://89992569): Should allow for the possibility that GenericObject will have a Sendable subclass
363360
sender.sendGeneric(nonSendableGeneric)
364361
// expected-error@-1 {{argument type 'GenericObject<SendableClass>' does not conform to expected type 'Sendable'}}
365362
// FIXME(rdar://89992095): Should be a warning because we're in -warn-concurrency

test/Concurrency/actor_isolation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ func testGlobalActorClosures() {
463463
return 17
464464
}
465465

466-
acceptConcurrentClosure { @SomeGlobalActor in 5 } // expected-warning{{converting function value of type '@SomeGlobalActor @Sendable () -> Int' to '@Sendable () -> Int' loses global actor 'SomeGlobalActor'}}
466+
acceptConcurrentClosure { @SomeGlobalActor in 5 } // expected-error{{converting function value of type '@SomeGlobalActor @Sendable () -> Int' to '@Sendable () -> Int' loses global actor 'SomeGlobalActor'}}
467467
}
468468

469469
@available(SwiftStdlib 5.1, *)

test/Concurrency/async_tasks.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-typecheck-verify-swift -disable-availability-checking
1+
// RUN: %target-typecheck-verify-swift -strict-concurrency=targeted -disable-availability-checking
22
// REQUIRES: concurrency
33

44
@available(SwiftStdlib 5.1, *)

test/Concurrency/concurrent_value_checking.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ func testConcurrency() {
174174
func testUnsafeSendableNothing() {
175175
var x = 5
176176
acceptUnsafeSendable {
177-
x = 17
177+
x = 17 // expected-error{{mutation of captured var 'x' in concurrently-executing code}}
178178
}
179179
print(x)
180180
}

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_checking.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-typecheck-verify-swift
1+
// RUN: %target-typecheck-verify-swift -strict-concurrency=targeted
22
// REQUIRES: concurrency
33
// REQUIRES: OS=macosx
44

test/Concurrency/sendable_module_checking.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/StrictModule.swiftmodule -module-name StrictModule -warn-concurrency %S/Inputs/StrictModule.swift
33
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/NonStrictModule.swiftmodule -module-name NonStrictModule %S/Inputs/NonStrictModule.swift
4-
// RUN: %target-swift-frontend -typecheck -disable-availability-checking -I %t 2>&1 %s | %FileCheck %s
4+
// RUN: %target-swift-frontend -typecheck -strict-concurrency=targeted -disable-availability-checking -I %t 2>&1 %s | %FileCheck %s
55

66
// REQUIRES: concurrency
77

test/Concurrency/sendable_preconcurrency.swift

Lines changed: 3 additions & 2 deletions
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
4-
// RUN: %target-typecheck-verify-swift -disable-availability-checking -I %t
4+
// RUN: %target-typecheck-verify-swift -strict-concurrency=targeted -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: 3 additions & 2 deletions
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
4-
// RUN: %target-typecheck-verify-swift -disable-availability-checking -I %t
4+
// RUN: %target-typecheck-verify-swift -strict-concurrency=targeted -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: 3 additions & 2 deletions
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
4-
// RUN: %target-typecheck-verify-swift -disable-availability-checking -I %t
4+
// RUN: %target-typecheck-verify-swift -strict-concurrency=targeted -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)