Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Medium
-
Resolution: Won't Do
-
Component/s: None
-
Labels:None
Description
Preface: I'm totally aware that this code is using undefined behavior and honestly I was surprised it ever worked. That being said, I figured I'd open up a bug in the off-chance this was indicative of a larger breaking change, or if this change wasn't known/intended.
In Swift 4.0 and 4.1, we were able to define a function that, given a type that conforming to Hashable and RawRepresentable, could return an array containing all of the cases of that type. This served as a hacky custom implementation of what 4.2 ships with CaseIterable.
When running this same code in Swift 4.2, even in compatibility mode, the behavior of the hashing algorithm seems to change, and so this code starts returning an empty array.
I've attached a playground that includes the code to reproduce the change. You can flip between toolsets and see that small assertion pass/fail accordingly.