Skip to content

Commit

Permalink
[stdlib] Make Optional, Array and Dictionary conditionally Equatable.
Browse files Browse the repository at this point in the history
  • Loading branch information
huonw authored and DougGregor committed Nov 28, 2017
1 parent 44d8720 commit 39e0a95
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion stdlib/public/core/Arrays.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -2187,7 +2187,7 @@ extension _ArrayBufferProtocol {

% 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.
@_inlineable
public static func ==(lhs: ${Self}<Element>, rhs: ${Self}<Element>) -> Bool {
Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/core/HashedCollections.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -2709,7 +2709,7 @@ extension Dictionary {
}
}

extension Dictionary where Value : Equatable {
extension Dictionary : Equatable where Value : Equatable {
@_inlineable // FIXME(sil-serialize-all)
public static func == (lhs: [Key : Value], rhs: [Key : Value]) -> Bool {
switch (lhs._variantBuffer, rhs._variantBuffer) {
Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/core/Optional.swift
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ func _diagnoseUnexpectedNilOptional(_filenameStart: Builtin.RawPointer,
line: UInt(_line))
}

extension Optional where Wrapped : Equatable {
extension Optional : Equatable where Wrapped : Equatable {

This comment has been minimized.

Copy link
@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.

Copy link
@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
/// equal.
///
Expand Down

0 comments on commit 39e0a95

Please sign in to comment.