Skip to content

Commit ffcf835

Browse files
committed
fixed issues in SE-0047 detail design sample code and comments
1 parent e0e9eac commit ffcf835

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

proposals/0047-nonvoid-warn.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ While this workaround makes it clear that the consumption of the result is inten
6868
The approach takes the following form:
6969

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

7979
```swift
80-
let c1: () -> T = f // no compiler warning, OK
81-
let c2: () -> Void = f // compiler error, not allowed
80+
let c1: () -> T = f // no compiler warning
81+
let c2: () -> Void = f // compiler error, invalid conversion
8282
let c3 = f // assignment does not preserve @discardableResult attribute
83-
c3() // warning unused result
84-
_ = c3() // no compiler warning, OK
83+
c3() // compiler warning, unused result
84+
_ = c3() // no compiler warning
8585
```
8686

8787
### Mutating Variants

0 commit comments

Comments
 (0)