mirror of
https://github.com/krzysztofzablocki/Sourcery.git
synced 2026-04-07 19:17:40 +00:00
fix: AutoEquatable Stencil to use any for protocols (#1367)
* fix: AutoEquatable Stencil to use `any` for protocols * chore: Updated AutoEquatable Expected file --------- Co-authored-by: Davide Sibilio <davide.sibilio@neatorobotics.com>
This commit is contained in:
@@ -29,7 +29,7 @@ fileprivate func compareArrays<T>(lhs: [T], rhs: [T], compare: (_ lhs: T, _ rhs:
|
||||
// MARK: - {{ type.name }} AutoEquatable
|
||||
{% if not type.kind == "protocol" and not type.based.NSObject %}extension {{ type.name }}: Equatable {}{% endif %}
|
||||
{% if type.supertype.based.Equatable or type.supertype.implements.AutoEquatable or type.supertype|annotated:"AutoEquatable" %}THIS WONT COMPILE, WE DONT SUPPORT INHERITANCE for AutoEquatable{% endif %}
|
||||
{{ type.accessLevel }} func == (lhs: {{ type.name }}, rhs: {{ type.name }}) -> Bool {
|
||||
{{ type.accessLevel }} func == (lhs:{% if type.kind == "protocol" %} any{% endif %} {{ type.name }}, rhs:{% if type.kind == "protocol" %} any{% endif %} {{ type.name }}) -> Bool {
|
||||
{% if not type.kind == "protocol" %}
|
||||
{% call compareVariables type.storedVariables %}
|
||||
{% else %}
|
||||
|
||||
@@ -58,7 +58,7 @@ internal func == (lhs: AutoEquatableNSObject, rhs: AutoEquatableNSObject) -> Boo
|
||||
return true
|
||||
}
|
||||
// MARK: - AutoEquatableProtocol AutoEquatable
|
||||
internal func == (lhs: AutoEquatableProtocol, rhs: AutoEquatableProtocol) -> Bool {
|
||||
internal func == (lhs: any AutoEquatableProtocol, rhs: any AutoEquatableProtocol) -> Bool {
|
||||
guard lhs.width == rhs.width else { return false }
|
||||
guard lhs.height == rhs.height else { return false }
|
||||
guard lhs.name == rhs.name else { return false }
|
||||
|
||||
Reference in New Issue
Block a user