[SR-1419] rawValue enum initializer does not fail for enums imported from Objective-C when given an invalid value #44028
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
CodeGen
compiler
The Swift compiler in itself
standard library
Area: Standard library umbrella
Environment
XCode 7.3.1
Swift: 2.2
Additional Detail from JIRA
md5: 62ca942b34051dc9fa0f59a32b3e7592
Issue Description:
Description:
The rawValue enum initializer does not fail as designed for enums imported from Objective-C when given an invalid value. It does however fail for enums that are Objective-C compatible or exported to Objective-C.
Expected result:
code should succeed
Actual Result:
assert is triggered,
testVal
has a value ofUInt.max
Notes:
This may be design behavior due to the fact that many imported
NS_OPTIONS
need this behavior. In order to maintain compatibility a secondfailIfInvalid:Bool
parameter that defaults tofalse
could be added to the generatedinit
The text was updated successfully, but these errors were encountered: