Permalink
Browse files

[stdlib] Make Optional, Array and Dictionary conditionally Equatable.

  • Loading branch information...
Huon Wilson authored and DougGregor committed Nov 11, 2017
1 parent 44d8720 commit 39e0a951b83e664b6e7fe69ca7ca9c6b89463f99
@@ -2187,7 +2187,7 @@ extension _ArrayBufferProtocol {
% for (Self, a_Self) in arrayTypes: % for (Self, a_Self) in arrayTypes:
extension ${Self} where Element : Equatable { extension ${Self} : Equatable where Element : Equatable {
/// Returns `true` if these arrays contain the same elements. /// Returns `true` if these arrays contain the same elements.
@_inlineable @_inlineable
public static func ==(lhs: ${Self}<Element>, rhs: ${Self}<Element>) -> Bool { public static func ==(lhs: ${Self}<Element>, rhs: ${Self}<Element>) -> Bool {
@@ -2709,7 +2709,7 @@ extension Dictionary {
} }
} }
extension Dictionary where Value : Equatable { extension Dictionary : Equatable where Value : Equatable {
@_inlineable // FIXME(sil-serialize-all) @_inlineable // FIXME(sil-serialize-all)
public static func == (lhs: [Key : Value], rhs: [Key : Value]) -> Bool { public static func == (lhs: [Key : Value], rhs: [Key : Value]) -> Bool {
switch (lhs._variantBuffer, rhs._variantBuffer) { switch (lhs._variantBuffer, rhs._variantBuffer) {
@@ -313,7 +313,7 @@ func _diagnoseUnexpectedNilOptional(_filenameStart: Builtin.RawPointer,
line: UInt(_line)) line: UInt(_line))
} }
extension Optional where Wrapped : Equatable { extension Optional : Equatable where Wrapped : Equatable {

This comment has been minimized.

@marcusrossel

marcusrossel Nov 30, 2017

Contributor

Could the !=-Method be removed, as it is now auto-generated via Equatable-conformance?

This comment has been minimized.

@DougGregor

DougGregor Dec 1, 2017

Member

IIRC, I ran into problems when I tried that early on, but it's worth investigating further. Thanks!

/// Returns a Boolean value indicating whether two optional instances are /// Returns a Boolean value indicating whether two optional instances are
/// equal. /// equal.
/// ///

0 comments on commit 39e0a95

Please sign in to comment.