Files
swift-mirror/test/Concurrency/Runtime/Inputs/reasync.swift
Slava Pestov 7ccc41a7b7 SIL: Preliminary support for 'apply [noasync]' calls
Refactor SILGen's ApplyOptions into an OptionSet, add a
DoesNotAwait flag to go with DoesNotThrow, and sink it
all down into SILInstruction.h.

Then, replace the isNonThrowing() flag in ApplyInst and
BeginApplyInst with getApplyOptions(), and plumb it
through to TryApplyInst as well.

Set the flag when SILGen emits a sync call to a reasync
function.

When set, this disables the SIL verifier check against
calling async functions from sync functions.

Finally, this allows us to add end-to-end tests for
rdar://problem/71098795.
2021-03-04 22:41:46 -05:00

12 lines
339 B
Swift

@_transparent
public func and(_ lhs: Bool, _ rhs: @autoclosure () async -> Bool) reasync -> Bool {
guard lhs else { return false }
return await rhs()
}
@_transparent
public func andThrows(_ lhs: Bool, _ rhs: @autoclosure () async throws -> Bool) reasync rethrows -> Bool {
guard lhs else { return false }
return try await rhs()
}