Skip to content

Commit 945d36e

Browse files
committed
[concurrency] Allow for nonisolated and execution(concurrent) to be used together.
After some discussions, we decided to allow for this since it doesnt harm anything. execution(caller) just takes primacy over it.
1 parent 121ed29 commit 945d36e

File tree

2 files changed

+0
-11
lines changed

2 files changed

+0
-11
lines changed

lib/Sema/TypeCheckAttr.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -265,16 +265,6 @@ class AttributeChecker : public AttributeVisitor<AttributeChecker> {
265265

266266
switch (attr->getBehavior()) {
267267
case ExecutionKind::Concurrent: {
268-
// 'concurrent' doesn't work with explicit `nonisolated`
269-
if (F->hasExplicitIsolationAttribute()) {
270-
if (F->getAttrs().hasAttribute<NonisolatedAttr>()) {
271-
diagnoseAndRemoveAttr(
272-
attr,
273-
diag::attr_execution_concurrent_incompatible_with_nonisolated, F);
274-
return;
275-
}
276-
}
277-
278268
auto parameters = F->getParameters();
279269
if (!parameters)
280270
return;

test/attr/attr_execution.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ do {
4242

4343
struct TestAttributeCollisions {
4444
@execution(concurrent) nonisolated func testNonIsolated() async {}
45-
// expected-error@-1 {{cannot use '@execution(concurrent)' and 'nonisolated' on the same 'testNonIsolated()' because they serve the same purpose}}
4645

4746
@execution(concurrent) func test(arg: isolated MainActor) async {}
4847
// expected-error@-1 {{cannot use '@execution(concurrent)' on instance method 'test(arg:)' because it has an isolated parameter: 'arg'}}

0 commit comments

Comments
 (0)