stdlib: adopt @warn_unused_result

rdar://20957486

Swift SVN r31048
This commit is contained in:
Dmitri Hrybenko
2015-08-06 14:53:18 +00:00
parent 10bdef0936
commit dd3194a18c
74 changed files with 789 additions and 82 deletions

View File

@@ -206,16 +206,26 @@ internal protocol _HashStorageType {
typealias SequenceElement
var startIndex: Index { get }
var endIndex: Index { get }
@warn_unused_result
func indexForKey(key: Key) -> Index?
@warn_unused_result
func assertingGet(i: Index) -> SequenceElement
@warn_unused_result
func assertingGet(key: Key) -> Value
@warn_unused_result
func maybeGet(key: Key) -> Value?
mutating func updateValue(value: Value, forKey: Key) -> Value?
mutating func removeAtIndex(index: Index) -> SequenceElement
mutating func removeValueForKey(key: Key) -> Value?
mutating func removeAll(keepCapacity keepCapacity: Bool)
var count: Int { get }
@warn_unused_result
static func fromArray(elements: [SequenceElement]) -> Self
}
@@ -363,12 +373,14 @@ public struct Set<Element : Hashable> :
}
/// Returns `true` if the set contains a member.
@warn_unused_result
public func contains(member: Element) -> Bool {
return _variantStorage.maybeGet(member) != nil
}
/// Returns the `Index` of a given member, or `nil` if the member is not
/// present in the set.
@warn_unused_result
public func indexOf(member: Element) -> Index? {
return _variantStorage.indexForKey(member)
}
@@ -472,6 +484,7 @@ public struct Set<Element : Hashable> :
}
/// Returns true if the set is a subset of a finite sequence as a `Set`.
@warn_unused_result
public func isSubsetOf<
S : SequenceType where S.Generator.Element == Element
>(sequence: S) -> Bool {
@@ -482,6 +495,7 @@ public struct Set<Element : Hashable> :
/// Returns true if the set is a subset of a finite sequence as a `Set`
/// but not equal.
@warn_unused_result
public func isStrictSubsetOf<
S : SequenceType where S.Generator.Element == Element
>(sequence: S) -> Bool {
@@ -491,6 +505,7 @@ public struct Set<Element : Hashable> :
}
/// Returns true if the set is a superset of a finite sequence as a `Set`.
@warn_unused_result
public func isSupersetOf<
S : SequenceType where S.Generator.Element == Element
>(sequence: S) -> Bool {
@@ -500,6 +515,7 @@ public struct Set<Element : Hashable> :
/// Returns true if the set is a superset of a finite sequence as a `Set`
/// but not equal.
@warn_unused_result
public func isStrictSupersetOf<
S : SequenceType where S.Generator.Element == Element
>(sequence: S) -> Bool {
@@ -508,6 +524,7 @@ public struct Set<Element : Hashable> :
}
/// Returns true if no members in the set are in a finite sequence as a `Set`.
@warn_unused_result
public func isDisjointWith<
S : SequenceType where S.Generator.Element == Element
>(sequence: S) -> Bool {
@@ -521,6 +538,7 @@ public struct Set<Element : Hashable> :
}
/// Return a new `Set` with items in both this set and a finite sequence.
@warn_unused_result
public func union<
S : SequenceType where S.Generator.Element == Element
>(sequence: S) -> Set<Element> {
@@ -540,6 +558,7 @@ public struct Set<Element : Hashable> :
/// Return a new set with elements in this set that do not occur
/// in a finite sequence.
@warn_unused_result
public func subtract<
S : SequenceType where S.Generator.Element == Element
>(sequence: S) -> Set<Element> {
@@ -558,6 +577,7 @@ public struct Set<Element : Hashable> :
}
/// Return a new set with elements common to this set and a finite sequence.
@warn_unused_result
public func intersect<
S : SequenceType where S.Generator.Element == Element
>(sequence: S) -> Set<Element> {
@@ -593,6 +613,7 @@ public struct Set<Element : Hashable> :
/// Return a new set with elements that are either in the set or a finite
/// sequence but do not occur in both.
@warn_unused_result
public func exclusiveOr<
S : SequenceType where S.Generator.Element == Element
>(sequence: S) -> Set<Element> {
@@ -630,10 +651,12 @@ public struct Set<Element : Hashable> :
// `SequenceType` conformance
//
@warn_unused_result
public func _customContainsEquatableElement(member: Element) -> Bool? {
return contains(member)
}
@warn_unused_result
public func _customIndexOfEquatableElement(member: Element) -> Index?? {
return Optional(indexOf(member))
}
@@ -658,6 +681,7 @@ public struct Set<Element : Hashable> :
/// a set and some sequence (which may itself be a `Set`).
///
/// (isSubset: lhs ⊂ rhs, isEqual: lhs ⊂ rhs and |lhs| = |rhs|)
@warn_unused_result
internal func _compareSets<Element>(lhs: Set<Element>, _ rhs: Set<Element>)
-> (isSubset: Bool, isEqual: Bool) {
for member in lhs {
@@ -668,6 +692,7 @@ internal func _compareSets<Element>(lhs: Set<Element>, _ rhs: Set<Element>)
return (true, lhs.count == rhs.count)
}
@warn_unused_result
public func == <Element : Hashable>(lhs: Set<Element>, rhs: Set<Element>) -> Bool {
switch (lhs._variantStorage, rhs._variantStorage) {
case (.Native(let lhsNativeOwner), .Native(let rhsNativeOwner)):
@@ -734,7 +759,8 @@ public func == <Element : Hashable>(lhs: Set<Element>, rhs: Set<Element>) -> Boo
}
}
extension Set: CustomStringConvertible, CustomDebugStringConvertible {
extension Set : CustomStringConvertible, CustomDebugStringConvertible {
@warn_unused_result
private func makeDescription(isDebug isDebug: Bool) -> String {
var result = isDebug ? "Set([" : "["
var first = true
@@ -784,6 +810,7 @@ internal func _stdlib_NSSet_allObjects(nss: _NSSetType) ->
///
/// - Requires: `BaseValue` is a base class or base `@objc`
/// protocol (such as `AnyObject`) of `DerivedValue`.
@warn_unused_result
public func _setUpCast<DerivedValue, BaseValue>(source: Set<DerivedValue>)
-> Set<BaseValue> {
_sanityCheck(_isClassOrObjCExistential(BaseValue.self))
@@ -802,6 +829,7 @@ public func _setUpCast<DerivedValue, BaseValue>(source: Set<DerivedValue>)
///
/// - Precondition: `SwiftValue` is bridged to Objective-C
/// and requires non-trivial bridging.
@warn_unused_result
public func _setBridgeToObjectiveC<SwiftValue, ObjCValue>(
source: Set<SwiftValue>
) -> Set<ObjCValue> {
@@ -834,6 +862,7 @@ public func _setBridgeToObjectiveC<SwiftValue, ObjCValue>(
///
/// - Precondition: `DerivedValue` is a subtype of `BaseValue` and both
/// are reference types.
@warn_unused_result
public func _setDownCast<BaseValue, DerivedValue>(source: Set<BaseValue>)
-> Set<DerivedValue> {
@@ -860,6 +889,7 @@ public func _setDownCast<BaseValue, DerivedValue>(source: Set<BaseValue>)
///
/// - Precondition: `DerivedValue` is a subtype of `BaseValue` and both
/// are reference types.
@warn_unused_result
public func _setDownCastConditional<BaseValue, DerivedValue>(
source: Set<BaseValue>
) -> Set<DerivedValue>? {
@@ -881,6 +911,7 @@ public func _setDownCastConditional<BaseValue, DerivedValue>(
///
/// - Precondition: At least one of `SwiftValue` is a bridged value
/// type, and the corresponding `ObjCValue` is a reference type.
@warn_unused_result
public func _setBridgeFromObjectiveC<ObjCValue, SwiftValue>(
source: Set<ObjCValue>
) -> Set<SwiftValue> {
@@ -896,6 +927,7 @@ public func _setBridgeFromObjectiveC<ObjCValue, SwiftValue>(
///
/// - Precondition: At least one of `SwiftValue` is a bridged value
/// type, and the corresponding `ObjCValue` is a reference type.
@warn_unused_result
public func _setBridgeFromObjectiveCConditional<
ObjCValue, SwiftValue
>(
@@ -1038,6 +1070,7 @@ public struct Dictionary<Key : Hashable, Value> :
/// Returns the `Index` for the given key, or `nil` if the key is not
/// present in the dictionary.
@warn_unused_result
public func indexForKey(key: Key) -> Index? {
// Complexity: amortized O(1) for native storage, O(N) when wrapping an
// NSDictionary.
@@ -1184,6 +1217,7 @@ public struct Dictionary<Key : Hashable, Value> :
}
@warn_unused_result
public func == <Key : Equatable, Value : Equatable>(
lhs: [Key : Value],
rhs: [Key : Value]
@@ -1259,6 +1293,7 @@ public func == <Key : Equatable, Value : Equatable>(
}
}
@warn_unused_result
public func != <Key : Equatable, Value : Equatable>(
lhs: [Key : Value],
rhs: [Key : Value]
@@ -1267,6 +1302,7 @@ public func != <Key : Equatable, Value : Equatable>(
}
extension Dictionary : CustomStringConvertible, CustomDebugStringConvertible {
@warn_unused_result
internal func _makeDescription(isDebug isDebug: Bool) -> String {
if count == 0 {
return "[:]"
@@ -1310,6 +1346,7 @@ extension Dictionary : CustomStringConvertible, CustomDebugStringConvertible {
#if _runtime(_ObjC)
/// Equivalent to `NSDictionary.allKeys`, but does not leave objects on the
/// autorelease pool.
@warn_unused_result
internal func _stdlib_NSDictionary_allKeys(nsd: _NSDictionaryType)
-> _HeapBuffer<Int, AnyObject> {
let count = nsd.count
@@ -1329,6 +1366,7 @@ internal func _stdlib_NSDictionary_allKeys(nsd: _NSDictionaryType)
/// - Requires: `BaseKey` and `BaseValue` are base classes or base `@objc`
/// protocols (such as `AnyObject`) of `DerivedKey` and `DerivedValue`,
/// respectively.
@warn_unused_result
public func _dictionaryUpCast<DerivedKey, DerivedValue, BaseKey, BaseValue>(
source: Dictionary<DerivedKey, DerivedValue>
) -> Dictionary<BaseKey, BaseValue> {
@@ -1353,6 +1391,7 @@ public func _dictionaryUpCast<DerivedKey, DerivedValue, BaseKey, BaseValue>(
///
/// - Precondition: `SwiftKey` and `SwiftValue` are bridged to Objective-C,
/// and at least one of them requires non-trivial bridging.
@warn_unused_result
public func _dictionaryBridgeToObjectiveC<
SwiftKey, SwiftValue, ObjCKey, ObjCValue
>(
@@ -1407,6 +1446,7 @@ public func _dictionaryBridgeToObjectiveC<
///
/// - Precondition: `DerivedKey` is a subtype of `BaseKey`, `DerivedValue` is
/// a subtype of `BaseValue`, and all of these types are reference types.
@warn_unused_result
public func _dictionaryDownCast<BaseKey, BaseValue, DerivedKey, DerivedValue>(
source: Dictionary<BaseKey, BaseValue>
) -> Dictionary<DerivedKey, DerivedValue> {
@@ -1446,6 +1486,7 @@ public func _dictionaryDownCast<BaseKey, BaseValue, DerivedKey, DerivedValue>(
///
/// - Precondition: `DerivedKey` is a subtype of `BaseKey`, `DerivedValue` is
/// a subtype of `BaseValue`, and all of these types are reference types.
@warn_unused_result
public func _dictionaryDownCastConditional<
BaseKey, BaseValue, DerivedKey, DerivedValue
>(
@@ -1476,6 +1517,7 @@ public func _dictionaryDownCastConditional<
///
/// - Precondition: At least one of `SwiftKey` or `SwiftValue` is a bridged value
/// type, and the corresponding `ObjCKey` or `ObjCValue` is a reference type.
@warn_unused_result
public func _dictionaryBridgeFromObjectiveC<
ObjCKey, ObjCValue, SwiftKey, SwiftValue
>(
@@ -1494,6 +1536,7 @@ public func _dictionaryBridgeFromObjectiveC<
///
/// - Precondition: At least one of `SwiftKey` or `SwiftValue` is a bridged value
/// type, and the corresponding `ObjCKey` or `ObjCValue` is a reference type.
@warn_unused_result
public func _dictionaryBridgeFromObjectiveCConditional<
ObjCKey, ObjCValue, SwiftKey, SwiftValue
>(
@@ -1613,6 +1656,7 @@ final internal class _Native${Self}StorageImpl<${TypeParameters}> {
buffer.baseAddress.destroy(body.capacity)
}
@warn_unused_result
final func __getInstanceSizeAndAlignMask() -> (Int, Int) {
let buffer = ${Self}HeapBuffer(
unsafeBitCast(self, HeapBufferStorage.self))
@@ -1737,15 +1781,18 @@ struct _Native${Self}Storage<${TypeParametersDecl}> :
return capacity &- 1
}
@warn_unused_result
internal func _bucket(k: Key) -> Int {
return _squeezeHashValue(k.hashValue, 0..<capacity)
}
@warn_unused_result
internal func _next(bucket: Int) -> Int {
// Bucket is within 0 and capacity. Therefore adding 1 does not overflow.
return (bucket &+ 1) & _bucketMask
}
@warn_unused_result
internal func _prev(bucket: Int) -> Int {
// Bucket is not negative. Therefore subtracting 1 does not overflow.
return (bucket &- 1) & _bucketMask
@@ -1755,6 +1802,7 @@ struct _Native${Self}Storage<${TypeParametersDecl}> :
///
/// If the key is not present, returns the position where it could be
/// inserted.
@warn_unused_result
internal func _find(k: Key, _ startBucket: Int) -> (pos: Index, found: Bool) {
var bucket = startBucket
@@ -1770,6 +1818,7 @@ struct _Native${Self}Storage<${TypeParametersDecl}> :
}
@transparent
@warn_unused_result
internal static func getMinCapacity(
requestedCount: Int, _ maxLoadFactorInverse: Double) -> Int {
// `requestedCount + 1` below ensures that we don't fill in the last hole
@@ -1831,6 +1880,7 @@ struct _Native${Self}Storage<${TypeParametersDecl}> :
return Index(nativeStorage: self, offset: capacity)
}
@warn_unused_result
internal func indexForKey(key: Key) -> Index? {
if count == 0 {
// Fast path that avoids computing the hash of the key.
@@ -1840,6 +1890,7 @@ struct _Native${Self}Storage<${TypeParametersDecl}> :
return found ? i : .None
}
@warn_unused_result
internal func assertingGet(i: Index) -> SequenceElement {
let e = self[i.offset]
_precondition(
@@ -1857,12 +1908,14 @@ struct _Native${Self}Storage<${TypeParametersDecl}> :
}
@warn_unused_result
internal func assertingGet(key: Key) -> Value {
let e = self[_find(key, _bucket(key)).pos.offset]
_precondition(e != nil, "key not found")
return e!.value
}
@warn_unused_result
internal func maybeGet(key: Key) -> Value? {
if count == 0 {
// Fast path that avoids computing the hash of the key.
@@ -1896,6 +1949,7 @@ struct _Native${Self}Storage<${TypeParametersDecl}> :
"don't call mutating methods on _Native${Self}Storage")
}
@warn_unused_result
internal static func fromArray(elements: [SequenceElement])
-> _Native${Self}Storage<${TypeParameters}> {
@@ -1987,6 +2041,7 @@ internal struct _BridgedNative${Self}Storage {
}
}
@warn_unused_result
internal func assertingGet(i: Int) -> SequenceElement {
let e = self[i]
_precondition(
@@ -2029,6 +2084,7 @@ final internal class _Native${Self}StorageKeyNSEnumerator<
//
@objc
@warn_unused_result
internal func nextObject() -> AnyObject? {
if nextIndex == endIndex {
return nil
@@ -2129,16 +2185,19 @@ final internal class _Native${Self}StorageOwner<${TypeParametersDecl}>
}
@objc
@warn_unused_result
internal func member(object: AnyObject) -> AnyObject? {
return bridgingObjectForKey(object)
}
@objc
@warn_unused_result
internal func objectEnumerator() -> _NSEnumeratorType {
return bridgingKeyEnumerator(())
}
@objc
@warn_unused_result
internal func copyWithZone(zone: _SwiftNSZone) -> AnyObject {
// Instances of this class should be visible outside of standard library as
// having `NSSet` type, which is immutable.
@@ -2226,6 +2285,7 @@ final internal class _Native${Self}StorageOwner<${TypeParametersDecl}>
return BridgedNativeStorage(buffer: _HeapBuffer(_heapBufferBridged!))
}
@warn_unused_result
internal func _createBridgedNativeStorage(capacity: Int) ->
BridgedNativeStorage {
let body = _${Self}Body(capacity: capacity)
@@ -2269,6 +2329,7 @@ final internal class _Native${Self}StorageOwner<${TypeParametersDecl}>
// Foundation subclasses (NS${Self}, NSEnumerator), don't access any
// storage directly, use these functions.
//
@warn_unused_result
internal func _getBridgedKey(i: _Native${Self}Index<${TypeParameters}>) ->
AnyObject {
if _fastPath(_isClassOrObjCExistential(Key.self)) {
@@ -2288,6 +2349,7 @@ final internal class _Native${Self}StorageOwner<${TypeParametersDecl}>
%if Self == 'Set':
@warn_unused_result
internal func _getBridgedValue(i: _Native${Self}Index<${TypeParameters}>) ->
AnyObject {
if _fastPath(_isClassOrObjCExistential(Value.self)) {
@@ -2299,6 +2361,7 @@ final internal class _Native${Self}StorageOwner<${TypeParametersDecl}>
%elif Self == 'Dictionary':
@warn_unused_result
internal func _getBridgedValue(i: _Native${Self}Index<${TypeParameters}>)
-> AnyObject {
if _fastPath(_isClassOrObjCExistential(Value.self)) {
@@ -2368,6 +2431,7 @@ final internal class _Native${Self}StorageOwner<${TypeParametersDecl}>
return nativeStorage.count
}
@warn_unused_result
internal func bridgingObjectForKey(aKey: AnyObject)
-> AnyObject? {
let nativeKey = _forceBridgeFromObjectiveC(aKey, Key.self)
@@ -2379,6 +2443,7 @@ final internal class _Native${Self}StorageOwner<${TypeParametersDecl}>
return nil
}
@warn_unused_result
internal func bridgingKeyEnumerator() -> _NSEnumeratorType {
return _Native${Self}StorageKeyNSEnumerator<${TypeParameters}>(self)
}
@@ -2436,6 +2501,7 @@ internal struct _Cocoa${Self}Storage : _HashStorageType {
return Index(cocoa${Self}, endIndex: ())
}
@warn_unused_result
internal func indexForKey(key: Key) -> Index? {
// Fast path that does not involve creating an array of all keys. In case
// the key is present, this lookup is a penalty for the slow path, but the
@@ -2462,6 +2528,7 @@ internal struct _Cocoa${Self}Storage : _HashStorageType {
return Index(cocoa${Self}, allKeys, keyIndex)
}
@warn_unused_result
internal func assertingGet(i: Index) -> SequenceElement {
%if Self == 'Set':
@@ -2476,6 +2543,7 @@ internal struct _Cocoa${Self}Storage : _HashStorageType {
}
@warn_unused_result
internal func assertingGet(key: Key) -> Value {
%if Self == 'Set':
@@ -2489,6 +2557,7 @@ internal struct _Cocoa${Self}Storage : _HashStorageType {
%end
}
@warn_unused_result
internal func maybeGet(key: Key) -> Value? {
%if Self == 'Set':
@@ -2519,6 +2588,7 @@ internal struct _Cocoa${Self}Storage : _HashStorageType {
return cocoa${Self}.count
}
@warn_unused_result
internal static func fromArray(elements: [SequenceElement])
-> _Cocoa${Self}Storage {
@@ -2552,6 +2622,7 @@ internal enum _Variant${Self}Storage<${TypeParametersDecl}> : _HashStorageType {
return _canBeClass(Key.self) == 0 && _canBeClass(Value.self) == 0
}
@warn_unused_result
internal mutating func isUniquelyReferenced() -> Bool {
if _fastPath(guaranteedNative) {
return _isUnique_native(&self)
@@ -2710,6 +2781,7 @@ internal enum _Variant${Self}Storage<${TypeParametersDecl}> : _HashStorageType {
}
}
@warn_unused_result
internal func indexForKey(key: Key) -> Index? {
switch self {
case .Native:
@@ -2730,6 +2802,7 @@ internal enum _Variant${Self}Storage<${TypeParametersDecl}> : _HashStorageType {
}
}
@warn_unused_result
internal func assertingGet(i: Index) -> SequenceElement {
switch self {
case .Native:
@@ -2753,6 +2826,7 @@ internal enum _Variant${Self}Storage<${TypeParametersDecl}> : _HashStorageType {
}
}
@warn_unused_result
internal func assertingGet(key: Key) -> Value {
switch self {
case .Native:
@@ -2769,6 +2843,7 @@ internal enum _Variant${Self}Storage<${TypeParametersDecl}> : _HashStorageType {
}
}
@warn_unused_result
internal func maybeGet(key: Key) -> Value? {
switch self {
case .Native:
@@ -3072,6 +3147,7 @@ internal enum _Variant${Self}Storage<${TypeParametersDecl}> : _HashStorageType {
}
}
@warn_unused_result
internal static func fromArray(elements: [SequenceElement])
-> _Variant${Self}Storage<${TypeParameters}> {
@@ -3096,6 +3172,7 @@ internal struct _Native${Self}Index<${TypeParametersDecl}> :
/// Returns the next consecutive value after `self`.
///
/// - Requires: The next value is representable.
@warn_unused_result
internal func successor() -> NativeIndex {
var i = offset + 1
// FIXME: Can't write the simple code pending
@@ -3177,6 +3254,7 @@ internal struct _Cocoa${Self}Index : ForwardIndexType, Comparable {
/// Returns the next consecutive value after `self`.
///
/// - Requires: The next value is representable.
@warn_unused_result
internal func successor() -> _Cocoa${Self}Index {
_precondition(
currentKeyIndex < allKeys.value, "can not increment endIndex")
@@ -3184,6 +3262,7 @@ internal struct _Cocoa${Self}Index : ForwardIndexType, Comparable {
}
}
@warn_unused_result
internal func ==(lhs: _Cocoa${Self}Index, rhs: _Cocoa${Self}Index) -> Bool {
_precondition(lhs.cocoa${Self} === rhs.cocoa${Self},
"can not compare indexes pointing to different ${Self}s")
@@ -3193,6 +3272,7 @@ internal func ==(lhs: _Cocoa${Self}Index, rhs: _Cocoa${Self}Index) -> Bool {
return lhs.currentKeyIndex == rhs.currentKeyIndex
}
@warn_unused_result
internal func <(lhs: _Cocoa${Self}Index, rhs: _Cocoa${Self}Index) -> Bool {
_precondition(lhs.cocoa${Self} === rhs.cocoa${Self},
"can not compare indexes pointing to different ${Self}s")
@@ -3314,6 +3394,7 @@ public struct ${Self}Index<${TypeParametersDecl}> :
}
}
@warn_unused_result
public func == <${TypeParametersDecl}> (
lhs: ${Self}Index<${TypeParameters}>,
rhs: ${Self}Index<${TypeParameters}>
@@ -3336,6 +3417,7 @@ public func == <${TypeParametersDecl}> (
}
}
@warn_unused_result
public func < <${TypeParametersDecl}> (
lhs: ${Self}Index<${TypeParameters}>,
rhs: ${Self}Index<${TypeParameters}>
@@ -3566,18 +3648,21 @@ internal struct ${Self}MirrorPosition<${TypeParametersDecl}> {
}
@warn_unused_result
internal func == <${TypeParametersDecl}> (
lhs: ${Self}MirrorPosition<${TypeParameters}>, rhs : Int
) -> Bool {
return lhs._intPos == rhs
}
@warn_unused_result
internal func > <${TypeParametersDecl}> (
lhs: ${Self}MirrorPosition<${TypeParameters}>, rhs : Int
) -> Bool {
return lhs._intPos > rhs
}
@warn_unused_result
internal func < <${TypeParametersDecl}> (
lhs: ${Self}MirrorPosition<${TypeParameters}>, rhs : Int
) -> Bool {
@@ -3644,6 +3729,7 @@ internal class ${Self}Mirror<${TypeParametersDecl}> : _MirrorType {
extension ${Self} : _Reflectable {
/// Returns a mirror that reflects `self`.
@warn_unused_result
public func _getMirror() -> _MirrorType {
return ${Self}Mirror(self)
}
@@ -3684,6 +3770,7 @@ public struct _${Self}Builder<${TypeParametersDecl}> {
_actualCount++
}
@warn_unused_result
public mutating func take() -> ${Self}<${TypeParameters}> {
_precondition(_actualCount >= 0,
"can not take the result twice")
@@ -3714,6 +3801,7 @@ extension ${Self} {
#if _runtime(_ObjC)
extension ${Self} {
@warn_unused_result
public func _bridgeToObjectiveCImpl() -> _NS${Self}CoreType {
switch _variantStorage {
case _Variant${Self}Storage.Native(let nativeOwner):
@@ -3731,8 +3819,9 @@ extension ${Self} {
}
}
@warn_unused_result
public static func _bridgeFromObjectiveCAdoptingNativeStorage(
s: AnyObject
s: AnyObject
) -> ${Self}<${TypeParameters}>? {
if let nativeOwner =
s as AnyObject as? _Native${Self}StorageOwner<${TypeParameters}> {