Avatar
Avatar
Iceman
@swift-5.6.3 class EventLoopFuture<T> { func get() async throws -> T { fatalError() } } struct Database { func transaction<T>(_ closure: @escaping (Database) -> EventLoopFuture<T>) -> EventLoopFuture<T> { closure(self) } } extension Database { func transaction<T>(_ closure: @Sendable @escaping (Database) async throws -> T) async throws -> T { try await self.transaction { db -> EventLoopFuture<T> in fatalError() }.get() } } (edited)
exit status: 1 with stderr:<stdin>:12:19: error: ambiguous use of 'transaction' try await self.transaction { db -> EventLoopFuture<T> in ^ <stdin>:5:10: note: found this candidate func transaction<T>(_ closure: @escaping (Database) -> EventLoopFuture<T>) -> EventLoopFuture<T> { ^ <stdin>:11:10: note: found this candidate func transaction<T>(_ closure: @Sendable @escaping (Database) async throws -> T) async throws -> T { ^ (edited)