@@ -290,7 +290,7 @@ public enum Function<Input: Expression, Output>: Expression where Input.Value: A
290290
291291public enum Index < Array: Expression > : Expression where Array. Value: AnyArray {
292292 public typealias Root = Array . Root
293- public typealias Value = Array . Value . Element
293+ public typealias Value = Array . Value . ArrayElement
294294
295295 case index( Array , Int )
296296 case first( Array )
@@ -371,6 +371,11 @@ public func == <E: Expression, T: Equatable & Primitive> (lhs: E, rhs: T) -> Pre
371371 . comparison( . init( lhs, . equal, rhs) )
372372}
373373
374+ @_disfavoredOverload
375+ public func == < E: Expression > ( lhs: E , rhs: Nil ) -> Predicate < E . Root > where E. Value: OptionalType {
376+ . comparison( . init( lhs, . equal, rhs) )
377+ }
378+
374379public func != < E: Expression , T: Equatable & Primitive > ( lhs: E , rhs: T ) -> Predicate < E . Root > where E. Value == T {
375380 . comparison( . init( lhs, . notEqual, rhs) )
376381}
@@ -495,15 +500,15 @@ extension Expression where Value: AnyArray {
495500 . last( self )
496501 }
497502
498- public func at< T> ( index: Int , _ keyPath: KeyPath < Value . Element , T > ) -> ArrayElementKeyPath < Self , T > {
503+ public func at< T> ( index: Int , _ keyPath: KeyPath < Value . ArrayElement , T > ) -> ArrayElementKeyPath < Self , T > {
499504 . init( . index( index) , self , keyPath)
500505 }
501506
502- public func first< T> ( _ keyPath: KeyPath < Value . Element , T > ) -> ArrayElementKeyPath < Self , T > {
507+ public func first< T> ( _ keyPath: KeyPath < Value . ArrayElement , T > ) -> ArrayElementKeyPath < Self , T > {
503508 . init( . first, self , keyPath)
504509 }
505510
506- public func last< T> ( _ keyPath: KeyPath < Value . Element , T > ) -> ArrayElementKeyPath < Self , T > {
511+ public func last< T> ( _ keyPath: KeyPath < Value . ArrayElement , T > ) -> ArrayElementKeyPath < Self , T > {
507512 . init( . last, self , keyPath)
508513 }
509514}
@@ -600,6 +605,8 @@ extension Expression {
600605
601606// MARK: - Supporting Protocols
602607
608+ // MARK: - StringValue
609+
603610public protocol StringValue {
604611}
605612
@@ -609,10 +616,15 @@ extension String: StringValue {
609616extension Optional : StringValue where Wrapped == String {
610617}
611618
619+ // MARK: - AnyArrayOrSet
620+
612621public protocol AnyArrayOrSet {
613622 associatedtype Element
614623}
615624
625+ extension Array : AnyArrayOrSet {
626+ }
627+
616628extension Set : AnyArrayOrSet {
617629}
618630
@@ -623,16 +635,22 @@ extension Optional: AnyArrayOrSet where Wrapped: AnyArrayOrSet {
623635 public typealias Element = Wrapped . Element
624636}
625637
638+ // MARK: - AnyArray
639+
626640public protocol AnyArray {
627- associatedtype Element
641+ associatedtype ArrayElement
628642}
629643
630- extension Array : AnyArrayOrSet {
644+ extension Array : AnyArray {
645+ public typealias ArrayElement = Element
631646}
632647
633- extension Array : AnyArray {
648+ extension Optional : AnyArray where Wrapped: AnyArray {
649+ public typealias ArrayElement = Wrapped . ArrayElement
634650}
635651
652+ // MARK: - PrimitiveCollection
653+
636654public protocol PrimitiveCollection {
637655 associatedtype PrimitiveElement : Primitive
638656}
@@ -649,6 +667,8 @@ extension Optional: PrimitiveCollection where Wrapped: PrimitiveCollection {
649667 public typealias PrimitiveElement = Wrapped . PrimitiveElement
650668}
651669
670+ // MARK: - AdditiveCollection
671+
652672public protocol AdditiveCollection {
653673 associatedtype AdditiveElement : AdditiveArithmetic & Primitive
654674}
@@ -661,6 +681,8 @@ extension Optional: AdditiveCollection where Wrapped: PrimitiveCollection & Addi
661681 public typealias AdditiveElement = Wrapped . AdditiveElement
662682}
663683
684+ // MARK: - ComparableCollection
685+
664686public protocol ComparableCollection {
665687 associatedtype ComparableElement : Comparable & Primitive
666688}
@@ -673,7 +695,7 @@ extension Optional: ComparableCollection where Wrapped: ComparableCollection {
673695 public typealias ComparableElement = Wrapped . ComparableElement
674696}
675697
676- // MARK: -
698+ // MARK: - Private Initializers
677699
678700extension Comparison {
679701 fileprivate init < E: Expression > (
0 commit comments