Skip to content

Commit 3b9d452

Browse files
committed
[transferring] Make sure to enable strict-concurrency on the tests as well as our experimental features.
Just noticed this while trying to write some tests that validated that we were properly ignoring strict-concurrency features. I put in asserts to validate that when either of these are enabled, we have strict-concurrency set as well.
1 parent 1306f2b commit 3b9d452

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

lib/SILOptimizer/Analysis/RegionAnalysis.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2965,6 +2965,11 @@ static bool canComputeRegionsForFunction(SILFunction *fn) {
29652965
if (!fn->getASTContext().LangOpts.hasFeature(Feature::RegionBasedIsolation))
29662966
return false;
29672967

2968+
assert(fn->getASTContext().LangOpts.StrictConcurrencyLevel ==
2969+
StrictConcurrency::Complete &&
2970+
"Need strict concurrency to be enabled for RegionBasedIsolation to be "
2971+
"enabled as well");
2972+
29682973
// If this function does not correspond to a syntactic declContext and it
29692974
// doesn't have a parent module, don't check it since we cannot check if a
29702975
// type is sendable.

test/Concurrency/transfernonsendable_strong_transferring_params.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -emit-sil -disable-availability-checking -enable-experimental-feature TransferringArgsAndResults -verify -enable-experimental-feature RegionBasedIsolation %s -o /dev/null
1+
// RUN: %target-swift-frontend -emit-sil -parse-as-library -disable-availability-checking -strict-concurrency=complete -enable-experimental-feature TransferringArgsAndResults -verify -enable-experimental-feature RegionBasedIsolation %s -o /dev/null
22

33
// REQUIRES: asserts
44

@@ -174,8 +174,7 @@ actor MyActor {
174174
}
175175

176176
@MainActor func canAssignTransferringIntoGlobalActor3(_ x: transferring Klass) async {
177-
await transferToCustom(globalKlass) // expected-warning {{transferring 'globalKlass' may cause a race}}
178-
// expected-note @-1 {{transferring main actor-isolated 'globalKlass' to global actor 'CustomActor'-isolated callee could cause races between global actor 'CustomActor'-isolated and main actor-isolated uses}}
177+
await transferToCustom(globalKlass) // expected-warning {{task isolated value of type 'Klass' transferred to global actor 'CustomActor'-isolated context}}
179178
}
180179

181180
func canTransferAssigningIntoLocal(_ x: transferring Klass) async {

test/Concurrency/transfernonsendable_strong_transferring_results.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -emit-sil -disable-experimental-parser-round-trip -disable-availability-checking -enable-experimental-feature TransferringArgsAndResults -verify -enable-experimental-feature RegionBasedIsolation %s -o /dev/null
1+
// RUN: %target-swift-frontend -emit-sil -parse-as-library -strict-concurrency=complete -disable-experimental-parser-round-trip -disable-availability-checking -enable-experimental-feature TransferringArgsAndResults -verify -enable-experimental-feature RegionBasedIsolation %s -o /dev/null
22

33
// REQUIRES: concurrency
44
// REQUIRES: asserts

0 commit comments

Comments
 (0)