[SR-3833] Properties typed NSSet <NSError *> * cannot be bridged to Set[Error] #46418
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
regression
swift 3.0
Attachment: Download
Environment
Swift 3.0.2 (Apple Swift version 3.0.2 (swiftlang-800.0.63 clang-800.0.42.1) Target: x86_64-apple-macosx10.9)
Xcode 8.2.1 (8C1002)
Additional Detail from JIRA
md5: b6414ac169273e1fc32c595653db156e
Issue Description:
Our Objective-C codebase contains a class which has a property of type NSSet <NSSError *> *:
This class is being used both in Objective-C and Swift.
In Swift 2.x, this property's type was bridged to the following:
In Swift 3.x, this property's type is bridged to the following:
Notes
I've included a sample project (SetError.zip) demonstrating our use case. It's a simplified project demonstrating our use case.
You'll see that in the same class (Operation.h), we use both _NSArray <NSError > _ and NSSet <NSSError *> * variables and
only the NSArray one will get properly typed over the bridge (see MyCustomOperation.swift).
Workaround
You can extend the appropriate class and declare a new property that does the appropriate casting:
I need to cast my property to be of type Set<NSError> because I can't cast it to Set<Error>
From my understanding, NSError conforms to Hashable but not the Error Protocol.
The text was updated successfully, but these errors were encountered: