Skip to content

Commit c668b2b

Browse files
authored
Merge pull request #79 from Adyen/remove-assertion-failure
Fixed recursiveDescription formatting
2 parents 748b253 + 8bdfaff commit c668b2b

14 files changed

+26
-88
lines changed

ReferencePackages/UpdatedPackage/Sources/ReferencePackage/ReferencePackage.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,9 @@ extension CustomEnum: SimpleProtocol {
195195
}
196196
}
197197

198-
extension CustomEnum.NestedStructInExtension {
198+
extension CustomEnum.NestedStructInExtension: CustomStringConvertible {
199199

200-
var description: String {
200+
public var description: String {
201201
return string
202202
}
203203
}

Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceAnalyzer/SwiftInterfaceChangeConsolidator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ struct SwiftInterfaceChangeConsolidator: SwiftInterfaceChangeConsolidating {
5252
let listOfChanges = listOfChanges(between: change, and: match)
5353

5454
if listOfChanges.isEmpty {
55-
assertionFailure("We should not end up here - investigate how this happened")
55+
print("We should not end up here - investigate how this happened")
5656
break
5757
}
5858

Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+Actor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ private extension SwiftInterfaceActor {
8383
description.append("actor", with: modifiers.isEmpty ? "" : " ")
8484
description.append(name, with: " ")
8585
description.append(genericParameterDescription, with: "")
86-
description.append(inheritance?.joined(separator: ", "), with: "") { ": \($0)" }
86+
description.append(inheritance?.sorted().joined(separator: ", "), with: "") { ": \($0)" }
8787
description.append(genericWhereClauseDescription, with: " ")
8888
return description
8989
}

Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+AssociatedType.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ private extension SwiftInterfaceAssociatedType {
7979
if modifiers.isEmpty && !attributes.isEmpty { description.append("\n") }
8080
description.append("associatedtype", with: modifiers.isEmpty ? "" : " ")
8181
description.append(name, with: " ")
82-
description.append(inheritance?.joined(separator: ", "), with: "") { ": \($0)" }
82+
description.append(inheritance?.sorted().joined(separator: ", "), with: "") { ": \($0)" }
8383
description.append(initializerValue, with: " ") { "= \($0)" }
8484
description.append(genericWhereClauseDescription, with: " ")
8585
return description

Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+Class.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ private extension SwiftInterfaceClass {
8383
description.append("class", with: modifiers.isEmpty ? "" : " ")
8484
description.append(name, with: " ")
8585
description.append(genericParameterDescription, with: "")
86-
description.append(inheritance?.joined(separator: ", "), with: "") { ": \($0)" }
86+
description.append(inheritance?.sorted().joined(separator: ", "), with: "") { ": \($0)" }
8787
description.append(genericWhereClauseDescription, with: " ")
8888
return description
8989
}

Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+Enum.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ private extension SwiftInterfaceEnum {
8181
description.append("enum", with: modifiers.isEmpty ? "" : " ")
8282
description.append(name, with: " ")
8383
description.append(genericParameterDescription, with: "")
84-
description.append(inheritance?.joined(separator: ", "), with: "") { ": \($0)" }
84+
description.append(inheritance?.sorted().joined(separator: ", "), with: "") { ": \($0)" }
8585
description.append(genericWhereClauseDescription, with: " ")
8686
return description
8787
}

Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+Extension.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ private extension SwiftInterfaceExtension {
7777
if modifiers.isEmpty && !attributes.isEmpty { description.append("\n") }
7878
description.append("extension", with: modifiers.isEmpty ? "" : " ")
7979
description.append(extendedType, with: " ")
80-
description.append(inheritance?.joined(separator: ", "), with: "") { ": \($0)" }
80+
description.append(inheritance?.sorted().joined(separator: ", "), with: "") { ": \($0)" }
8181
description.append(genericWhereClauseDescription, with: " ")
8282
return description
8383
}

Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+Protocol.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ private extension SwiftInterfaceProtocol {
8181
description.append("protocol", with: modifiers.isEmpty ? "" : " ")
8282
description.append(name, with: " ")
8383
description.append(primaryAssociatedTypes.map { "<\($0.joined(separator: ", "))>" }, with: "")
84-
description.append(inheritance?.joined(separator: ", "), with: "") { ": \($0)" }
84+
description.append(inheritance?.sorted().joined(separator: ", "), with: "") { ": \($0)" }
8585
description.append(genericWhereClauseDescription, with: " ")
8686
return description
8787
}

Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+Struct.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ private extension SwiftInterfaceStruct {
8181
description.append("struct", with: modifiers.isEmpty ? "" : " ")
8282
description.append(name, with: " ")
8383
description.append(genericParameterDescription, with: "")
84-
description.append(inheritance?.joined(separator: ", "), with: "") { ": \($0)" }
84+
description.append(inheritance?.sorted().joined(separator: ", "), with: "") { ": \($0)" }
8585
description.append(genericWhereClauseDescription, with: " ")
8686
return description
8787
}

Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement/SwiftInterfaceElement.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,12 @@ extension SwiftInterfaceElement {
123123
var recursiveDescription = "\(indentedDescription(indentation: indentation))"
124124
if !self.children.isEmpty {
125125
recursiveDescription.append(" {")
126-
for child in self.children {
126+
for child in self.children.sorted(by: { $0.description < $1.description }) {
127127
recursiveDescription.append("\n\(child.recursiveDescription(indentation: indentation + 1))")
128128
}
129129
recursiveDescription.append("\n\(String(repeating: spacer, count: indentation))}")
130130
}
131131

132-
if indentation == 0 {
133-
recursiveDescription.append("\n")
134-
}
135-
136132
return recursiveDescription
137133
}
138134

0 commit comments

Comments
 (0)