Strict Concurrency: False Positives?

For reference, I blogged about why this works the way it does: How the Swift compiler knows that DispatchQueue.main implies @MainActor

tl;dr: it's a hardcoded syntax check in the compiler that looks for DispatchQueue.main.async (and some related APIs), in exactly that spelling.

This was also discussed in this earlier thread: How does swift annotate that DispatchQueue.main.async runs on @MainActor but DispatchQueue.background.async doesn't

1 Like