Skip to content

Commit

Permalink
fixed issues in SE-0047 detail design sample code and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
erica committed Mar 16, 2016
1 parent e0e9eac commit ffcf835
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions proposals/0047-nonvoid-warn.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ While this workaround makes it clear that the consumption of the result is inten
The approach takes the following form:

```swift
@discardableResult func f() -> T {} // may be called as a procedure as g()
@discardableResult func f() -> T {} // may be called as a procedure as f()
// without emitting a compiler warning
func g() -> T {} // defaults to warn on unused result
func h() {} // Void return type, does not fall under the umbrella of this proposal
Expand All @@ -77,11 +77,11 @@ func h() {} // Void return type, does not fall under the umbrella of this propos
The following examples demonstrate the `@discardableResult` behavior:

```swift
let c1: () -> T = f // no compiler warning, OK
let c2: () -> Void = f // compiler error, not allowed
let c1: () -> T = f // no compiler warning
let c2: () -> Void = f // compiler error, invalid conversion
let c3 = f // assignment does not preserve @discardableResult attribute
c3() // warning unused result
_ = c3() // no compiler warning, OK
c3() // compiler warning, unused result
_ = c3() // no compiler warning
```

### Mutating Variants
Expand Down

0 comments on commit ffcf835

Please sign in to comment.