Skip to content

Commit

Permalink
Update README.md (airbnb#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
bachand authored Oct 21, 2022
1 parent 831d3c2 commit 105d7cc
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2269,16 +2269,24 @@ _You can enable the following settings in Xcode by running [this script](resourc
Fully-unconstrained generic parameters are somewhat uncommon, but are equivalent to `some Any`. For example:

```swift
func assertFailure<Value>(_ result: Result<Value, Error>) {
func assertFailure<Value>(
_ result: Result<Value, Error>,
file: StaticString = #filePath,
line: UInt = #line)
{
if case .failure(let error) = result {
XCTFail(error.localizedDescription)
XCTFail(error.localizedDescription, file: file, line: line)
}
}

// is equivalent to:
func assertFailure(_ result: Result<some Any, Error>) {
func assertFailure(
_ result: Result<some Any, Error>,
file: StaticString = #filePath,
line: UInt = #line)
{
if case .failure(let error) = result {
XCTFail(error.localizedDescription)
XCTFail(error.localizedDescription, file: file, line: line)
}
}
```
Expand Down

0 comments on commit 105d7cc

Please sign in to comment.