Hey Colin (I can’t @ you yet it seems). Just hit a time where it’s happened again. Example code below:
Task {
do {
let myThing = try await doMyOptionalAsyncThing()
DispatchQueue.main.async {
guard let myThing else { return }
myThing.doSomething()
}
} catch {
// handle error
}
}
On the 3rd line we get error swift:S1854 that myThing is not used, which to me is incorrect as we’re correctly using it in the guard on line 7 with the new Swift 5.7 syntax.
There’s a distinction to be drawn between “analysis doesn’t fail encountering new syntax” and “false-positives as a result of using new syntax”. It sounds like yours falls into the latter.
Thanks for bringing this to our attention. I created a ticket to fix this False-Positive. The rule considers incorrectly that myThing is not used because its reference is now implicit with the new shorthand syntax.