mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[DiagnosticsQoI] SR-3359: Add a fix-it to remove @discardableResult on functions that return Void or Never (#6681)
This commit adds a fix-it to remove @discardableResult on functions that return Void or Never. The fix-it is at the warning level. A test was added to verify that the fix-it removes the @discardableResult. This issue was reported in SR-3359: https://bugs.swift.org/browse/SR-3359 Changes: TypeCheckAttr.cpp: implemented AttributeChecker::visitDiscardableResultAttr to add a fix-it to remove @discardableResult on functions returning Void or Never. DiagnosticsSema.def: Added a warning with a diagnostic message. LoggingWrappers.swift.gyb, HashedCollections.swift.gyb: Removed @discardableResult on functions returning Void. fixits-apply-all.swift, fixits-apply-all.swift.result: Added tests to verify that @discardableResult is removed from functions returning Void or Never.
This commit is contained in:
committed by
Jordan Rose
parent
f462ce7852
commit
0e09bbbb83
@@ -243,7 +243,6 @@ internal protocol _HashBuffer {
|
||||
@discardableResult
|
||||
mutating func removeValue(forKey key: Key) -> Value?
|
||||
|
||||
@discardableResult
|
||||
mutating func removeAll(keepingCapacity keepCapacity: Bool)
|
||||
|
||||
var count: Int { get }
|
||||
|
||||
Reference in New Issue
Block a user