Description
Given the following test function:
@available(*, noasync)
func f() {}
@Test func g() {
#expect(throws: (any Error).self) {
f()
}
}
In Swift 6.2 the compiler emits a warning due to improved typechecking during macro expansion:
⚠️ function 'f' is unavailable from asynchronous contexts; this will be an error in a future Swift language mode
Because the compiler is now inferring the type of the closure passed to #expect(throws:)
as async
before macro expansion rather than inferring its type (as non-async
) after.