Files
swift-mirror/test/SILGen/objc_error.swift
Joe Groff 751724c3fa SILGen: Special-case NSError to ErrorType erasure.
We want this to be a "toll-free" adoption of the class reference without requiring a second box allocation.

Swift SVN r26711
2015-03-30 04:52:41 +00:00

13 lines
468 B
Swift

// RUN: %target-swift-frontend -emit-silgen -sdk %S/Inputs -I %S/Inputs -enable-source-import %s | FileCheck %s
// REQUIRES: objc_interop
import Foundation
// CHECK-LABEL: sil hidden @_TF10objc_error25NSError_ErrorType_erasureFCSo7NSErrorPSs10_ErrorType_
// CHECK: [[ERROR_TYPE:%.*]] = init_existential_ref %0 : $NSError : $NSError, $_ErrorType
// CHECK: return [[ERROR_TYPE]]
func NSError_ErrorType_erasure(x: NSError) -> _ErrorType {
return x
}