Strict concurrency warning for <<error type>>

Minor issue but when I moved some code to a different file:

let interface = UnsafeTGAPointer(UI_TGA).grid(itemWidth: 16, itemHeight: 16)
let cursor = interface[0, 0]
let cursorPressed = interface[1, 0]

And forgot to import Assets, I got errors like Let 'cursor' is not concurrency-safe because non-'Sendable' type '<<error type>>' may have shared mutable state; this is an error in the Swift 6 language mode

This warning is unnecessary for <<error type>>, there's already errors about missing identifiers, it only adds to the confusion by drowning out the actual error messages.


Even more annoying, I was only changing the arguments and everything had to light up:


In Swift 6 when this is an error too it will be even harder to tell which messages I'm supposed to pay attention to.

Can you file an issue with a test case? An ErrorType appears in the AST after something else was already diagnosed, so once we know where it's coming from it's easy to fix by adding an if (!fooTy->hasErrorType()) check before the diagnose() call.

EDIT: I think this diagnostic is coming from a code path @Douglas_Gregor was refactoring recently: Teach diagnostic about non-Sendable global `let`s to respect `@precon… · apple/swift@94a2529 · GitHub. It looks like the new diagnoseNonSendableTypes() helper needs to skip error types.

2 Likes