diff --git a/stdlib/public/core/ContiguousArrayBuffer.swift b/stdlib/public/core/ContiguousArrayBuffer.swift index 99a7efb8a6dd3..5cca42b3a3dd3 100644 --- a/stdlib/public/core/ContiguousArrayBuffer.swift +++ b/stdlib/public/core/ContiguousArrayBuffer.swift @@ -66,39 +66,8 @@ internal var _emptyArrayStorage : _EmptyArrayStorage { Builtin.addressof(&_swiftEmptyArrayStorage)) } -// FIXME: This whole class is a workaround for -// Can't override generic method in generic -// subclass. If it weren't for that bug, we'd override -// _withVerbatimBridgedUnsafeBuffer directly in -// _ContiguousArrayStorage. -class _ContiguousArrayStorage1 : _ContiguousArrayStorageBase { -#if _runtime(_ObjC) - /// If the `Element` is bridged verbatim, invoke `body` on an - /// `UnsafeBufferPointer` to the elements and return the result. - /// Otherwise, return `nil`. - final override func _withVerbatimBridgedUnsafeBuffer( - @noescape body: (UnsafeBufferPointer) throws -> R - ) rethrows -> R? { - var result: R? = nil - try self._withVerbatimBridgedUnsafeBufferImpl { - result = try body($0) - } - return result - } - - /// If `Element` is bridged verbatim, invoke `body` on an - /// `UnsafeBufferPointer` to the elements. - internal func _withVerbatimBridgedUnsafeBufferImpl( - @noescape body: (UnsafeBufferPointer) throws -> Void - ) rethrows { - _sanityCheckFailure( - "Must override _withVerbatimBridgedUnsafeBufferImpl in derived classes") - } -#endif -} - // The class that implements the storage for a ContiguousArray -final class _ContiguousArrayStorage : _ContiguousArrayStorage1 { +final class _ContiguousArrayStorage : _ContiguousArrayStorageBase { deinit { __manager._elementPointer.destroy(__manager._valuePointer.memory.count) @@ -107,9 +76,22 @@ final class _ContiguousArrayStorage : _ContiguousArrayStorage1 { } #if _runtime(_ObjC) + /// If the `Element` is bridged verbatim, invoke `body` on an + /// `UnsafeBufferPointer` to the elements and return the result. + /// Otherwise, return `nil`. + internal final override func _withVerbatimBridgedUnsafeBuffer( + @noescape body: (UnsafeBufferPointer) throws -> Element + ) rethrows -> Element? { + var result: Element? = nil + try self._withVerbatimBridgedUnsafeBufferImpl { + result = try body($0) + } + return result + } + /// If `Element` is bridged verbatim, invoke `body` on an /// `UnsafeBufferPointer` to the elements. - internal final override func _withVerbatimBridgedUnsafeBufferImpl( + internal final func _withVerbatimBridgedUnsafeBufferImpl( @noescape body: (UnsafeBufferPointer) throws -> Void ) rethrows { if _isBridgedVerbatimToObjectiveC(Element.self) {