Hi everyone,

Joe Shajrawi nominated an optimizer fix for Swift 3.0.1 where the optimizer was 
crashing due to duplicate conditions in aswitchstatement:

https://bugs.swift.org/browse/SR-2512 <https://bugs.swift.org/browse/SR-2512>
https://github.com/apple/swift/pull/4747 
<https://github.com/apple/swift/pull/4747>
Here’s an example:

public enum DemoEnum {
    case firstCase
    case secondCase

    public static func performSwitch(with value: Int) -> DemoEnum {
        switch value {
        case 0:
            return DemoEnum.firstCase
        case 0:
            return DemoEnum.firstCase
        default:
            return DemoEnum.secondCase
        }
    }
}
I can’t remember why the frontend even accepts this code. Is this intended, or 
just a defect in the compiler’s validity checking ofswitch statements?

Thanks,
Ted
_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev

Reply via email to