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:
Davide Sibilio
2024-10-24 12:50:12 +02:00
committed by GitHub
parent dca83054ac
commit c7000eff80
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -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 }