Skip to content

Commit

Permalink
Introduce UnorderedComparingArray
Browse files Browse the repository at this point in the history
  • Loading branch information
dfed committed Jan 13, 2024
1 parent 74b5e11 commit c9a9fa1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
2 changes: 0 additions & 2 deletions Sources/SafeDICore/Models/TypeDescription.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ public enum TypeDescription: Codable, Hashable, Comparable, Sendable {
case let .composition(types):
return types
.map { $0.asSource }
// Sort the result to ensure stable code generation.
.sorted()
.joined(separator: " & ")
case let .optional(type):
return "\(type.asSource)?"
Expand Down
4 changes: 1 addition & 3 deletions Tests/SafeDICoreTests/TypeDescriptionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,7 @@ final class TypeDescriptionTests: XCTestCase {
XCTAssertFalse(typeDescription.isUnknown, "Type description is not of known type!")
XCTAssertEqual(
typeDescription.asSource,
// Composition elements are sorted when creating source code in order to
// ensure stable code generation, since composition ordering is arbitrary.
"Bar & Foo"
"Foo & Bar"
)
}

Expand Down

0 comments on commit c9a9fa1

Please sign in to comment.