From 20e7632a9567e9459ed5036d64f310c83aa7bdfb Mon Sep 17 00:00:00 2001 From: Igor Kislyuk Date: Tue, 29 May 2018 15:24:49 +0300 Subject: [PATCH 1/3] Fix class template --- Swift/Class.swift.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Swift/Class.swift.twig b/Swift/Class.swift.twig index d4ab617..53a3591 100644 --- a/Swift/Class.swift.twig +++ b/Swift/Class.swift.twig @@ -53,7 +53,7 @@ import LeadKit return false } - return{%- if hasParent %} super.isEqual(to: other){%- endif %}{%- if (fields is not empty) and hasParent %} &&{% endif %} {% include 'blocks/class/fields-equal.twig' with { fields: fields } %} + return{%- if hasParent %} super.isEqual(to: other){%- endif %}{%- if (fields is not empty) and hasParent %} &&{% endif %} {% include 'blocks/class/fields-equal.twig' with { fields: fields } %}{% if (fields is empty) and (not hasParent) %} false{% endif %} }{{ "\n" }} {%- endif %} } From 26206e70c52e209d635effb7263e9f84179167ec Mon Sep 17 00:00:00 2001 From: Igor Kislyuk Date: Tue, 29 May 2018 15:30:20 +0300 Subject: [PATCH 2/3] Fix swift warning --- Swift/Class.swift.twig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Swift/Class.swift.twig b/Swift/Class.swift.twig index 53a3591..83fab00 100644 --- a/Swift/Class.swift.twig +++ b/Swift/Class.swift.twig @@ -49,11 +49,15 @@ import LeadKit {% if (not hasGenerics) and (not fieldsHasGenericsOrNonEqutableCollections) -%} func isEqual(to other: {{ classType }}?) -> Bool { + {% if (fields is empty) and (not hasParent) %} + return false + {% elseif %} guard let other = other else { return false } - return{%- if hasParent %} super.isEqual(to: other){%- endif %}{%- if (fields is not empty) and hasParent %} &&{% endif %} {% include 'blocks/class/fields-equal.twig' with { fields: fields } %}{% if (fields is empty) and (not hasParent) %} false{% endif %} + return{%- if hasParent %} super.isEqual(to: other){%- endif %}{%- if (fields is not empty) and hasParent %} &&{% endif %} {% include 'blocks/class/fields-equal.twig' with { fields: fields } %} + {% endif %} }{{ "\n" }} {%- endif %} } From b86ace9a01fbec09f615eb300a6133c2c44939f7 Mon Sep 17 00:00:00 2001 From: Igor Kislyuk Date: Tue, 29 May 2018 15:31:54 +0300 Subject: [PATCH 3/3] Fix if else --- Swift/Class.swift.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Swift/Class.swift.twig b/Swift/Class.swift.twig index 83fab00..0da1dd9 100644 --- a/Swift/Class.swift.twig +++ b/Swift/Class.swift.twig @@ -51,7 +51,7 @@ import LeadKit func isEqual(to other: {{ classType }}?) -> Bool { {% if (fields is empty) and (not hasParent) %} return false - {% elseif %} + {% else %} guard let other = other else { return false }