Created
March 11, 2021 16:02
-
-
Save alexito4/fba53a1fe00b0776358c480e87f086a5 to your computer and use it in GitHub Desktop.
Sourcery 1.3 regressions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CODE: | |
/* | |
docs | |
*/ | |
@objc(WAGiveRecognitionCoordinator) | |
// sourcery: AutoProtocol, AutoMockable | |
class GiveRecognitionCoordinator: NSObject { | |
} | |
TEMPLATE: | |
{% for type in types.all where type|annotated:"AutoProtocol" %} | |
{% set protoName %}{{ type.localName }}Protocol{% endset %} | |
// MARK: {{ protoName }} | |
{{ type.attributes.objc.first }} protocol {{ protoName }} { | |
} | |
{% endfor %} | |
GENERATED | |
/* | |
docs | |
*/ | |
@objc(WAGiveRecognitionCoordinator) protocol GiveRecognitionCoordinatorProtocol { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final class AA: AutoEquatable { | |
let onTap: (() -> Void)? // <- this propery used to report isClosure true | |
init() { | |
self.onTap = nil | |
} | |
} | |
// TEMPLATE: | |
{% macro compareVariables variables %} | |
{% for variable in variables where variable.readAccess != "private" and variable.readAccess != "fileprivate" and not variable.typeName.isClosure and not variable.typeName.isTuple %}{% if not variable.annotations.skipEquality %}guard {% if not variable.isOptional %}{% if not variable.annotations.arrayEquality %}lhs.{{ variable.name }} == rhs.{{ variable.name }}{% else %}compareArrays(lhs: lhs.{{ variable.name }}, rhs: rhs.{{ variable.name }}, compare: ==){% endif %}{% else %}compareOptionals(lhs: lhs.{{ variable.name }}, rhs: rhs.{{ variable.name }}, compare: ==){% endif %} else { return false }{{ variable.typeName }}{% endif %} | |
{% endfor %} | |
{% endmacro %} | |
{% for type in types.types|!enum where type.implements.AutoEquatable %} | |
// MARK: - {{ type.name }} AutoEquatable HubComponent | |
extension {{ type.name }}: Equatable { | |
{% 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 %} | |
static func == (lhs: {{ type.name }}, rhs: {{ type.name }}) -> Bool { | |
{% call compareVariables type.storedVariables %} | |
return true | |
} | |
} | |
{% endfor %} | |
GENERATED: | |
extension AA: Equatable { | |
static func == (lhs: AA, rhs: AA) -> Bool { | |
guard compareOptionals(lhs: lhs.onTap, rhs: rhs.onTap, compare: ==) else { return false }(() -> Void)? | |
return true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment