Skip to content

Commit

Permalink
Remove an obsolete workaround for Result.get() (#509)
Browse files Browse the repository at this point in the history
  • Loading branch information
stmontgomery authored Jun 28, 2024
1 parent aacacd7 commit 0e2d9cb
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions Sources/Testing/Support/Additions/ResultAdditions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,13 @@ extension Result {
///
/// - Warning: This function is used to implement the `#expect()` and
/// `#require()` macros. Do not call it directly.
public func __expected() {}
@inlinable public func __expected() {}

/// Handle this instance as if it were returned from a call to `#require()`.
///
/// - Warning: This function is used to implement the `#expect()` and
/// `#require()` macros. Do not call it directly.
public func __required() throws -> Success {
/// `get()` is current broken in the Swift standard library, so switch
/// manually to work around the problem. ([122797397](rdar://122797397))
switch self {
case let .success(result):
return result
case let .failure(error):
throw error
}
@inlinable public func __required() throws -> Success {
try get()
}
}

0 comments on commit 0e2d9cb

Please sign in to comment.