Skip to content

Removed last uses of @warn_unused_result #2923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/Sema/TypeChecker.h
Original file line number Diff line number Diff line change
Expand Up @@ -1831,8 +1831,7 @@ class TypeChecker final : public LazyResolver {
/// Checks an "ignored" expression to see if it's okay for it to be ignored.
///
/// An ignored expression is one that is not nested within a larger
/// expression or statement. The warning from the \@warn_unused_result
/// attribute is produced here.
/// expression or statement.
void checkIgnoredExpr(Expr *E);

// Emits a diagnostic, if necessary, for a reference to a declaration
Expand Down
4 changes: 2 additions & 2 deletions stdlib/public/core/CollectionAlgorithms.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ extension ${Self} where Self.Iterator.Element : Comparable {
/// - Returns: A sorted array of the ${sequenceKind}'s elements.
///
/// - SeeAlso: `sorted(isOrderedBefore:)`
@warn_unused_result(${'mutable_variant: "sort"' if Self == 'MutableCollection' else ''})
/// ${'- MutatingVariant: sort' if Self == 'MutableCollection' else ''}
public func sorted() -> [Iterator.Element] {
var result = ContiguousArray(self)
result.sort()
Expand Down Expand Up @@ -396,7 +396,7 @@ ${orderingExplanation}
/// - Returns: A sorted array of the ${sequenceKind}'s elements.
///
/// - SeeAlso: `sorted()`
@warn_unused_result(${'mutable_variant: "sort"' if Self == 'MutableCollection' else ''})
/// ${'- MutatingVariant: sort' if Self == 'MutableCollection' else ''}
public func sorted(
isOrderedBefore:
@noescape (${IElement}, ${IElement}) -> Bool
Expand Down
2 changes: 0 additions & 2 deletions test/1_stdlib/Runtime.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import StdlibUnittest
import SwiftShims


@warn_unused_result
@_silgen_name("swift_demangle")
public
func _stdlib_demangleImpl(
Expand All @@ -20,7 +19,6 @@ func _stdlib_demangleImpl(
flags: UInt32
) -> UnsafeMutablePointer<CChar>?

@warn_unused_result
func _stdlib_demangleName(_ mangledName: String) -> String {
return mangledName.nulTerminatedUTF8.withUnsafeBufferPointer {
(mangledNameUTF8) in
Expand Down
27 changes: 0 additions & 27 deletions test/IDE/print_ast_tc_decls.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1284,33 +1284,6 @@ struct d2900_TypeSugar1 {
// PASS_COMMON-NEXT: {{^}} init(){{$}}
// PASS_COMMON-NEXT: {{^}}}{{$}}

// @warn_unused_result attribute
public struct ArrayThingy {
// PASS_PRINT_AST: @warn_unused_result(mutable_variant: "sort")
// PASS_PRINT_AST-NEXT: public func sort() -> ArrayThingy
@warn_unused_result(mutable_variant: "sort")
public func sort() -> ArrayThingy { return self }

public mutating func sort() { }

// PASS_PRINT_AST: @warn_unused_result(message: "dummy", mutable_variant: "reverseInPlace")
// PASS_PRINT_AST-NEXT: public func reverse() -> ArrayThingy
@warn_unused_result(message: "dummy", mutable_variant: "reverseInPlace")
public func reverse() -> ArrayThingy { return self }

public mutating func reverseInPlace() { }

// PASS_PRINT_AST: @warn_unused_result
// PASS_PRINT_AST-NEXT: public func mineGold() -> Int
@warn_unused_result
public func mineGold() -> Int { return 0 }

// PASS_PRINT_AST: @warn_unused_result(message: "oops")
// PASS_PRINT_AST-NEXT: public func mineCopper() -> Int
@warn_unused_result(message: "oops")
public func mineCopper() -> Int { return 0 }
}

// @discardableResult attribute
public struct DiscardableThingy {
// PASS_PRINT_AST: @discardableResult
Expand Down
1 change: 0 additions & 1 deletion test/IDE/print_stdlib.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,4 @@ func foo(x: _Pointer) {} // Checks that this protocol actually exists.

// CHECK-FREQUENT-WORD: ///
// CHECK-FREQUENT-WORD-NOT: where Slice<Dictionary<Key, Value>> == Slice<Self>
// CHECK-FREQUENT-WORD-NOT: @warn_unused_result
// CHECK-COLLECTION-GROUP: extension MutableCollection
Loading