[swift-evolution] [swift-dev] Possible bug with arithmetic optional comparison ?

Robert Widmann devteam.codafi at gmail.com
Tue May 24 11:07:03 CDT 2016


Behaves as intended, albeit counterintuitively.

[~ indicates appropriate coercion]

1) (nil : Optional<T ~ Int>) == (0 : Int ~ Optional<Int>) false because nil is the lower bound of all possible integers.
2) (nil : Optional<T ~ Int>) < (0 : Int ~ Optional<Int>) true for reasons above
3) (nil : Optional<T ~ Int>) > (0 : Int ~ Optional<Int>) false for reason above.

~Robert Widmann

2016/05/24 2:27、Yaman JAIOUCH via swift-dev <swift-dev at swift.org> のメッセージ:

> nil == 0 // false
> nil < 0 // true
> nil > 0 // false
> 
> Is this a potential bug or an intended behavior ?
> _______________________________________________
> swift-dev mailing list
> swift-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-dev


More information about the swift-evolution mailing list