mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[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:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user