-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Description
| Previous ID | SR-1052 |
| Radar | None |
| Original Reporter | @lattner |
| Type | Task |
| Status | Closed |
| Resolution | Done |
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Compiler, Standard Library |
| Labels | Task, StarterBug |
| Assignee | tanadeau (JIRA) |
| Priority | Medium |
md5: 77cf91f85074b4a3b8d2ded18cca58e5
relates to:
- SR-1681 spurious "unused result" warning in Swift 3
Issue Description:
SE-0047 has been accepted:
https://github.com/apple/swift-evolution/blob/master/proposals/0047-nonvoid-warn.md
I suggest implementing this as a series of independent patches:
1) Introduce the @discardableResult declaration attribute.
2) Change the standard library to use it on various mutating methods that return values.
3) Change the clang importer to auto-attach the attribute to imported declarations (ones that are not marked with the clang "attribute((warn_unused_result))").
4) Parse and recognize the new doc comments (mutableVariant, etc.). See comment from Chris Lattner below.
5) Change the compiler to start listening to the @discardableResult attribute.
6) Change the @warn_unused_result attribute to be recognized, and produce an error + fixit to remove it.