[SE-0112] Rename ErrorProtocol to Error.

This is bullet (5) of the proposed solution in SE-0112, and the last
major piece to be implemented.
This commit is contained in:
Doug Gregor
2016-07-08 13:53:49 -07:00
parent fcd5d07c20
commit 823c24b355
257 changed files with 1416 additions and 1412 deletions

View File

@@ -363,14 +363,14 @@ public func reflect<T>(any: T) {
anyPointer.deallocateCapacity(sizeof(Any.self))
}
// Reflect an `ErrorProtocol`, a.k.a. an "error existential".
// Reflect an `Error`, a.k.a. an "error existential".
//
// These are always boxed on the heap, with the following layout:
//
// - Word 0: Metadata Pointer
// - Word 1: 2x 32-bit reference counts
//
// If Objective-C interop is available, an ErrorProtocol is also an
// If Objective-C interop is available, an Error is also an
// `NSError`, and so has:
//
// - Word 2: code (NSInteger)
@@ -381,12 +381,12 @@ public func reflect<T>(any: T) {
//
// - Word 2 or 5: Instance type metadata pointer
// - Word 3 or 6: Instance witness table for conforming
// to `Swift.ErrorProtocol`.
// to `Swift.Error`.
//
// Following that is the instance that conforms to `ErrorProtocol`,
// Following that is the instance that conforms to `Error`,
// rounding up to its alignment.
public func reflect<T: ErrorProtocol>(error: T) {
let error: ErrorProtocol = error
public func reflect<T: Error>(error: T) {
let error: Error = error
let errorPointerValue = unsafeBitCast(error, to: UInt.self)
reflect(instanceAddress: errorPointerValue, kind: .ErrorExistential)
}