You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[region-isolation] Fix join to be a true union operation including the symmetric difference.
We were performing a union on the intersection of the lhs/rhs but were dropping
the parts of lhs/rhs that were in the symmetric difference of the two sets.
Without this, we would not diagnose cases like this where we had elements on the
lhs/rhs that were not in the intersection.
```
var closure: () -> () = {}
await transferToMain(closure)
if await booleanFlag {
closure = {
print(self.klass)
}
} else {
closure = {}
}
// At this point we would lose closure since they were different elements
await transferToMain(closure) // We wouldn't error on this!
```
rdar://117437059
Copy file name to clipboardExpand all lines: test/Concurrency/sendnonsendable_basic.swift
+2-4Lines changed: 2 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -263,8 +263,8 @@ extension Actor {
263
263
}
264
264
}
265
265
266
-
// We emit the first error that we see. So we do not emit the self error.
267
266
await transferToMain(closure) // expected-sns-note {{access here could race}}
267
+
// expected-sns-warning @-1 {{call site passes `self` or a non-sendable argument of this function to another thread, potentially yielding a race with the caller}}
268
268
// expected-complete-warning @-1 {{passing argument of non-sendable type '() -> ()' into main actor-isolated context may introduce data races}}
269
269
// expected-complete-note @-2 {{a function type must be marked '@Sendable' to conform to 'Sendable'}}
270
270
}
@@ -286,9 +286,7 @@ extension Actor {
286
286
closure ={}
287
287
}
288
288
289
-
// TODO: We do not error here yet since we are performing the control flow
290
-
// union incorrectly.
291
-
awaittransferToMain(closure)
289
+
awaittransferToMain(closure) // expected-sns-warning {{call site passes `self` or a non-sendable argument of this function to another thread, potentially yielding a race with the caller}}
292
290
// expected-complete-warning @-1 {{passing argument of non-sendable type '() -> ()' into main actor-isolated context may introduce data races}}
293
291
// expected-complete-note @-2 {{a function type must be marked '@Sendable' to conform to 'Sendable'}}
0 commit comments