Created
December 29, 2022 17:58
-
-
Save tgrapperon/c22463b389a371d40295163f636995ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import XCTestDynamicOverlay | |
func f(_ f: @autoclosure () -> String) {} | |
func fa(_ f: @autoclosure () async -> String) async {} | |
func ft(_ f: @autoclosure () throws -> String) {} | |
func fat(_ f: @autoclosure () async throws -> String) async {} | |
func check() async throws { | |
f(unimplementedAutoclosure(placeholder: "")()) | |
await fa(unimplementedAutoclosure(placeholder: "")()) | |
ft(unimplementedAutoclosure(placeholder: "")()) | |
await fat(unimplementedAutoclosure(placeholder: "")()) | |
f(unimplementedAutoclosure()()) | |
await fa(unimplementedAutoclosure()()) | |
ft(unimplementedAutoclosure()()) | |
await fat(unimplementedAutoclosure()()) | |
} | |
public func unimplementedAutoclosure<Result>( | |
_ description: @autoclosure @escaping @Sendable () -> String = "", | |
placeholder: @autoclosure @escaping @Sendable () -> Result, | |
fileID: StaticString = #fileID, | |
line: UInt = #line | |
) -> @Sendable () -> Result { | |
unimplemented(description(), placeholder: placeholder(), fileID: fileID, line: line) | |
} | |
@_disfavoredOverload | |
public func unimplementedAutoclosure<Result>( | |
_ description: @autoclosure @escaping @Sendable () -> String = "", | |
placeholder: @autoclosure @escaping @Sendable () -> Result, | |
fileID: StaticString = #fileID, | |
line: UInt = #line | |
) -> @Sendable () async -> Result { | |
unimplemented(description(), placeholder: placeholder(), fileID: fileID, line: line) | |
} | |
@_disfavoredOverload | |
public func unimplementedAutoclosure<Result>( | |
_ description: @autoclosure @escaping @Sendable () -> String = "", | |
placeholder: @autoclosure @escaping @Sendable () -> Result, | |
fileID: StaticString = #fileID, | |
line: UInt = #line | |
) -> @Sendable () throws -> Result { | |
unimplemented(description(), placeholder: placeholder(), fileID: fileID, line: line) | |
} | |
@_disfavoredOverload | |
public func unimplementedAutoclosure<Result>( | |
_ description: @autoclosure @escaping @Sendable () -> String = "", | |
placeholder: @autoclosure @escaping @Sendable () -> Result, | |
fileID: StaticString = #fileID, | |
line: UInt = #line | |
) -> @Sendable () async throws -> Result { | |
unimplemented(description(), placeholder: placeholder(), fileID: fileID, line: line) | |
} | |
public func unimplementedAutoclosure<Result>( | |
_ description: @autoclosure @escaping @Sendable () -> String = "", | |
fileID: StaticString = #fileID, | |
line: UInt = #line | |
) -> @Sendable () -> Result { | |
unimplemented(description(), fileID: fileID, line: line) | |
} | |
@_disfavoredOverload | |
public func unimplementedAutoclosure<Result>( | |
_ description: @autoclosure @escaping @Sendable () -> String = "", | |
fileID: StaticString = #fileID, | |
line: UInt = #line | |
) -> @Sendable () async -> Result { | |
unimplemented(description(), fileID: fileID, line: line) | |
} | |
@_disfavoredOverload | |
public func unimplementedAutoclosure<Result>( | |
_ description: @autoclosure @escaping @Sendable () -> String = "", | |
fileID: StaticString = #fileID, | |
line: UInt = #line | |
) -> @Sendable () throws -> Result { | |
unimplemented(description(), fileID: fileID, line: line) | |
} | |
@_disfavoredOverload | |
public func unimplementedAutoclosure<Result>( | |
_ description: @autoclosure @escaping @Sendable () -> String = "", | |
fileID: StaticString = #fileID, | |
line: UInt = #line | |
) -> @Sendable () async throws -> Result { | |
unimplemented(description(), fileID: fileID, line: line) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment