Introduce bridging of NSError to ErrorProtocol, so an Objective-C API
expressed via an "NSError *" will be imported using ErrorProtocol in
the Swift. For example, the Objective-C method:
- (void)handleError:(NSError *)error userInteractionPermitted:(BOOL)userInteractionPermitted;
will now be imported as:
func handleError(_ error: ErrorProtocol, userInteractionPermitted: Bool)
This is bullet (3) under the proposed solution of SE-0112. Note that
we made one semantic change here: instead of removing the conformance
of NSError to ErrorProtocol, which caused numerous problems both
theoretical and actual because the model expects that an NSError
conforms to ErrorProtocol without requiring wrapping, we instead limit
the ErrorProtocol -> NSError conversion that would be implied by
bridging. This is defensible in the short term because it also
eliminates the implicit conversion, and aligns with SE-0072, which
eliminates implicit bridging conversions altogether.
- Extract the cache entry type to a top-level type that can be used in the
signature of the function.
- Rewrite the implementation of the type in terms of standard LLVM ADTs
instead of manual bit manipulation.
- Add support for trivial-with-optional types (none of which exist yet).
- Drop the use of SIL/BridgedTypes.def; the only non-trivial non-object
bridged type today is 'Bool' (for ObjCBool and DarwinBoolean) and that's
already trivially bridged to CBool too.
- Save an Identifier lookup when possible.
- Finally, rename the function to getForeignRepresentationInfo.
No intended functionality change.