Open
Description
Previous ID | SR-7318 |
Radar | rdar://problem/39143381 |
Original Reporter | vhbit (JIRA User) |
Type | Bug |
Environment
Swift 4.1 from Xcode 9.3 (9E145)
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Bug, 4.1Regression, TypeChecker |
Assignee | None |
Priority | Medium |
md5: 30fd51ff3ed5acce33a3e35add5f858d
Issue Description:
It seems that sometimes when checking equality with `.none` the other argument is promoted to Optional
which causes unexpected results compared to Swift 4.0
enum Foo {
case none
case always
case smart
}
struct Bar {
let foo: Foo
}
let x: Foo = .none
x != .none // false as expected
let y: Bar? = Bar(foo: x)
(y?.foo ?? .none) != .none // unexpectedly returns true, worked fine on Swift 4.0
(y?.foo ?? .none) != Foo.none // false as expected