From 13d2e2b7019d43356c7ed61375425aa3a44b8a38 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Thu, 9 Jan 2025 16:29:55 +0100 Subject: [PATCH 1/4] Remove newline after recursiveDescription --- .../SwiftInterfaceElement.swift | 4 --- .../ReferencePackageTests.swift | 2 +- ...ference-changes-swift-interface-private.md | 31 ------------------- ...eference-changes-swift-interface-public.md | 28 ----------------- 4 files changed, 1 insertion(+), 64 deletions(-) diff --git a/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement/SwiftInterfaceElement.swift b/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement/SwiftInterfaceElement.swift index eec7d8e..1d0f0b4 100644 --- a/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement/SwiftInterfaceElement.swift +++ b/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement/SwiftInterfaceElement.swift @@ -129,10 +129,6 @@ extension SwiftInterfaceElement { recursiveDescription.append("\n\(String(repeating: spacer, count: indentation))}") } - if indentation == 0 { - recursiveDescription.append("\n") - } - return recursiveDescription } diff --git a/Tests/IntegrationTests/ReferencePackageTests.swift b/Tests/IntegrationTests/ReferencePackageTests.swift index c94302e..c5372ec 100644 --- a/Tests/IntegrationTests/ReferencePackageTests.swift +++ b/Tests/IntegrationTests/ReferencePackageTests.swift @@ -70,7 +70,7 @@ class ReferencePackageTests: XCTestCase { for i in 0.. { associatedtype ParentType: Swift.Equatable where Self.ParentType == Self.Iterator.Element associatedtype Iterator: Swift.Collection } - ``` ```javascript public protocol SimpleProtocol - ``` #### 🔀 Modified ```javascript @@ -108,33 +104,26 @@ Changes: extension Swift.Array { public subscript(safe index: Swift.Int) -> Element? { get } } - ``` ### `CustomClass` #### ❇️ Added ```javascript final public let a: Swift.Int { get } - ``` ```javascript final public let b: Swift.Int { get } - ``` ```javascript final public let c: Swift.Int { get } - ``` ```javascript final public let d: Swift.Double { get } - ``` ```javascript public subscript(index: Swift.Int) -> T? { get set } - ``` ```javascript public var lazyVar: Swift.String { get set } - ``` #### 🔀 Modified ```javascript @@ -181,40 +170,32 @@ Changes: #### ❇️ Added ```javascript case a - ``` ```javascript case b - ``` ```javascript case c - ``` ```javascript case caseWithNamedString(title: T) - ``` ```javascript case d - ``` ```javascript case e(ReferencePackage.CustomEnum.NestedStructInExtension) - ``` ```javascript extension ReferencePackage.CustomEnum where T == Swift.String { public var titleOfCaseWithNamedString: Swift.String? { get } } - ``` ```javascript public struct NestedStructInExtension { public let string: Swift.String { get } public init(string: Swift.String = "Hello") } - ``` #### 🔀 Modified ```javascript @@ -259,19 +240,15 @@ case caseWithString(Swift.String) #### ❇️ Added ```javascript associatedtype AnotherAssociatedType: Swift.Strideable - ``` ```javascript associatedtype AnotherAssociatedType: Swift.Strideable - ``` ```javascript associatedtype CustomAssociatedType: Swift.Equatable - ``` ```javascript associatedtype CustomAssociatedType: Swift.Equatable - ``` #### 🔀 Modified ```javascript @@ -324,23 +301,18 @@ public struct NestedStruct { @available(swift 5.9) public let nestedVar: Swift.String { get } } - ``` ```javascript public typealias AnotherAssociatedType = Swift.Double - ``` ```javascript public typealias CustomAssociatedType = Swift.Int - ``` ```javascript public typealias Iterator = [ReferencePackage.CustomStruct.AnotherAssociatedType] - ``` ```javascript public typealias ParentType = Swift.Double - ``` #### 🔀 Modified ```javascript @@ -386,17 +358,14 @@ Changes: ```javascript @_spi(SystemProgrammingInterface) public typealias AnotherAssociatedType = T - ``` ```javascript @_spi(SystemProgrammingInterface) public typealias Iterator = [Swift.Double] - ``` ```javascript @_spi(SystemProgrammingInterface) public typealias ParentType = Swift.Double - ``` #### 🔀 Modified ```javascript diff --git a/Tests/IntegrationTests/Resources/expected-reference-changes-swift-interface-public.md b/Tests/IntegrationTests/Resources/expected-reference-changes-swift-interface-public.md index 524fbba..465dfa2 100644 --- a/Tests/IntegrationTests/Resources/expected-reference-changes-swift-interface-public.md +++ b/Tests/IntegrationTests/Resources/expected-reference-changes-swift-interface-public.md @@ -13,25 +13,21 @@ public enum RawValueEnum: Swift.String, Swift.Equatable, Swift.Hashable, Swift.R public typealias RawValue = Swift.String public var rawValue: Swift.String { get } } - ``` ```javascript public protocol ParentProtocol { associatedtype ParentType: Swift.Equatable where Self.ParentType == Self.Iterator.Element associatedtype Iterator: Swift.Collection } - ``` ```javascript public protocol ParentProtocol { associatedtype ParentType: Swift.Equatable where Self.ParentType == Self.Iterator.Element associatedtype Iterator: Swift.Collection } - ``` ```javascript public protocol SimpleProtocol - ``` #### 🔀 Modified ```javascript @@ -93,33 +89,26 @@ Changes: extension Swift.Array { public subscript(safe index: Swift.Int) -> Element? { get } } - ``` ### `CustomClass` #### ❇️ Added ```javascript final public let a: Swift.Int { get } - ``` ```javascript final public let b: Swift.Int { get } - ``` ```javascript final public let c: Swift.Int { get } - ``` ```javascript final public let d: Swift.Double { get } - ``` ```javascript public subscript(index: Swift.Int) -> T? { get set } - ``` ```javascript public var lazyVar: Swift.String { get set } - ``` #### 🔀 Modified ```javascript @@ -166,40 +155,32 @@ Changes: #### ❇️ Added ```javascript case a - ``` ```javascript case b - ``` ```javascript case c - ``` ```javascript case caseWithNamedString(title: T) - ``` ```javascript case d - ``` ```javascript case e(ReferencePackage.CustomEnum.NestedStructInExtension) - ``` ```javascript extension ReferencePackage.CustomEnum where T == Swift.String { public var titleOfCaseWithNamedString: Swift.String? { get } } - ``` ```javascript public struct NestedStructInExtension { public let string: Swift.String { get } public init(string: Swift.String = "Hello") } - ``` #### 🔀 Modified ```javascript @@ -244,19 +225,15 @@ case caseWithString(Swift.String) #### ❇️ Added ```javascript associatedtype AnotherAssociatedType: Swift.Strideable - ``` ```javascript associatedtype AnotherAssociatedType: Swift.Strideable - ``` ```javascript associatedtype CustomAssociatedType: Swift.Equatable - ``` ```javascript associatedtype CustomAssociatedType: Swift.Equatable - ``` #### 🔀 Modified ```javascript @@ -309,23 +286,18 @@ public struct NestedStruct { @available(swift 5.9) public let nestedVar: Swift.String { get } } - ``` ```javascript public typealias AnotherAssociatedType = Swift.Double - ``` ```javascript public typealias CustomAssociatedType = Swift.Int - ``` ```javascript public typealias Iterator = [ReferencePackage.CustomStruct.AnotherAssociatedType] - ``` ```javascript public typealias ParentType = Swift.Double - ``` #### 🔀 Modified ```javascript From d8e9516b56529e5226d1254b7fbce44a830274d1 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Thu, 9 Jan 2025 16:30:11 +0100 Subject: [PATCH 2/4] Replacing assertionFailure with print to not crash in debug --- .../SwiftInterfaceChangeConsolidator.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceAnalyzer/SwiftInterfaceChangeConsolidator.swift b/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceAnalyzer/SwiftInterfaceChangeConsolidator.swift index f76e802..018da68 100644 --- a/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceAnalyzer/SwiftInterfaceChangeConsolidator.swift +++ b/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceAnalyzer/SwiftInterfaceChangeConsolidator.swift @@ -52,7 +52,7 @@ struct SwiftInterfaceChangeConsolidator: SwiftInterfaceChangeConsolidating { let listOfChanges = listOfChanges(between: change, and: match) if listOfChanges.isEmpty { - assertionFailure("We should not end up here - investigate how this happened") + print("⚠ We should not end up here - investigate how this happened") break } From 7e3d8eef0f1106c20660f96f0bfbc898b1bae89c Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Fri, 10 Jan 2025 14:35:17 +0100 Subject: [PATCH 3/4] sorting children + inheritance for description --- .../SwiftInterfaceElement+Actor.swift | 2 +- .../SwiftInterfaceElement+AssociatedType.swift | 2 +- .../SwiftInterfaceElement+Class.swift | 2 +- .../SwiftInterfaceElement+Enum.swift | 2 +- .../SwiftInterfaceElement+Extension.swift | 2 +- .../SwiftInterfaceElement+Protocol.swift | 2 +- .../SwiftInterfaceElement+Struct.swift | 2 +- .../SwiftInterfaceElement/SwiftInterfaceElement.swift | 2 +- .../SwiftInterfaceParser/SwiftInterfaceParser+Root.swift | 3 +-- .../expected-reference-changes-swift-interface-private.md | 8 ++++---- .../expected-reference-changes-swift-interface-public.md | 8 ++++---- 11 files changed, 17 insertions(+), 18 deletions(-) diff --git a/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+Actor.swift b/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+Actor.swift index df41ffa..065528f 100644 --- a/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+Actor.swift +++ b/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+Actor.swift @@ -83,7 +83,7 @@ private extension SwiftInterfaceActor { description.append("actor", with: modifiers.isEmpty ? "" : " ") description.append(name, with: " ") description.append(genericParameterDescription, with: "") - description.append(inheritance?.joined(separator: ", "), with: "") { ": \($0)" } + description.append(inheritance?.sorted().joined(separator: ", "), with: "") { ": \($0)" } description.append(genericWhereClauseDescription, with: " ") return description } diff --git a/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+AssociatedType.swift b/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+AssociatedType.swift index b4283b9..e6f0eac 100644 --- a/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+AssociatedType.swift +++ b/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+AssociatedType.swift @@ -79,7 +79,7 @@ private extension SwiftInterfaceAssociatedType { if modifiers.isEmpty && !attributes.isEmpty { description.append("\n") } description.append("associatedtype", with: modifiers.isEmpty ? "" : " ") description.append(name, with: " ") - description.append(inheritance?.joined(separator: ", "), with: "") { ": \($0)" } + description.append(inheritance?.sorted().joined(separator: ", "), with: "") { ": \($0)" } description.append(initializerValue, with: " ") { "= \($0)" } description.append(genericWhereClauseDescription, with: " ") return description diff --git a/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+Class.swift b/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+Class.swift index a7c6346..d0eb60d 100644 --- a/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+Class.swift +++ b/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+Class.swift @@ -83,7 +83,7 @@ private extension SwiftInterfaceClass { description.append("class", with: modifiers.isEmpty ? "" : " ") description.append(name, with: " ") description.append(genericParameterDescription, with: "") - description.append(inheritance?.joined(separator: ", "), with: "") { ": \($0)" } + description.append(inheritance?.sorted().joined(separator: ", "), with: "") { ": \($0)" } description.append(genericWhereClauseDescription, with: " ") return description } diff --git a/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+Enum.swift b/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+Enum.swift index 54c9f25..859735a 100644 --- a/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+Enum.swift +++ b/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+Enum.swift @@ -81,7 +81,7 @@ private extension SwiftInterfaceEnum { description.append("enum", with: modifiers.isEmpty ? "" : " ") description.append(name, with: " ") description.append(genericParameterDescription, with: "") - description.append(inheritance?.joined(separator: ", "), with: "") { ": \($0)" } + description.append(inheritance?.sorted().joined(separator: ", "), with: "") { ": \($0)" } description.append(genericWhereClauseDescription, with: " ") return description } diff --git a/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+Extension.swift b/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+Extension.swift index 0fee4e5..d3889c3 100644 --- a/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+Extension.swift +++ b/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+Extension.swift @@ -77,7 +77,7 @@ private extension SwiftInterfaceExtension { if modifiers.isEmpty && !attributes.isEmpty { description.append("\n") } description.append("extension", with: modifiers.isEmpty ? "" : " ") description.append(extendedType, with: " ") - description.append(inheritance?.joined(separator: ", "), with: "") { ": \($0)" } + description.append(inheritance?.sorted().joined(separator: ", "), with: "") { ": \($0)" } description.append(genericWhereClauseDescription, with: " ") return description } diff --git a/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+Protocol.swift b/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+Protocol.swift index 5ead175..8860300 100644 --- a/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+Protocol.swift +++ b/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+Protocol.swift @@ -81,7 +81,7 @@ private extension SwiftInterfaceProtocol { description.append("protocol", with: modifiers.isEmpty ? "" : " ") description.append(name, with: " ") description.append(primaryAssociatedTypes.map { "<\($0.joined(separator: ", "))>" }, with: "") - description.append(inheritance?.joined(separator: ", "), with: "") { ": \($0)" } + description.append(inheritance?.sorted().joined(separator: ", "), with: "") { ": \($0)" } description.append(genericWhereClauseDescription, with: " ") return description } diff --git a/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+Struct.swift b/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+Struct.swift index 02ef3fc..0e7a967 100644 --- a/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+Struct.swift +++ b/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement+Declaration/SwiftInterfaceElement+Struct.swift @@ -81,7 +81,7 @@ private extension SwiftInterfaceStruct { description.append("struct", with: modifiers.isEmpty ? "" : " ") description.append(name, with: " ") description.append(genericParameterDescription, with: "") - description.append(inheritance?.joined(separator: ", "), with: "") { ": \($0)" } + description.append(inheritance?.sorted().joined(separator: ", "), with: "") { ": \($0)" } description.append(genericWhereClauseDescription, with: " ") return description } diff --git a/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement/SwiftInterfaceElement.swift b/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement/SwiftInterfaceElement.swift index 1d0f0b4..4b37708 100644 --- a/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement/SwiftInterfaceElement.swift +++ b/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceElement/SwiftInterfaceElement.swift @@ -123,7 +123,7 @@ extension SwiftInterfaceElement { var recursiveDescription = "\(indentedDescription(indentation: indentation))" if !self.children.isEmpty { recursiveDescription.append(" {") - for child in self.children { + for child in self.children.sorted(by: { $0.description < $1.description }) { recursiveDescription.append("\n\(child.recursiveDescription(indentation: indentation + 1))") } recursiveDescription.append("\n\(String(repeating: spacer, count: indentation))}") diff --git a/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceParser+Root.swift b/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceParser+Root.swift index 107e151..78ffe17 100644 --- a/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceParser+Root.swift +++ b/Sources/PublicModules/PADSwiftInterfaceDiff/SwiftInterfaceParser/SwiftInterfaceParser+Root.swift @@ -34,9 +34,8 @@ extension SwiftInterfaceParser { init(moduleName: String, elements: [any SwiftInterfaceElement]) { self.moduleName = moduleName - self.children = elements - self.children = Self.mergeExtensions(for: self.children, moduleName: moduleName) + self.children = Self.mergeExtensions(for: elements, moduleName: moduleName) self.children.forEach { $0.setupParentRelationships(parent: self) } } diff --git a/Tests/IntegrationTests/Resources/expected-reference-changes-swift-interface-private.md b/Tests/IntegrationTests/Resources/expected-reference-changes-swift-interface-private.md index d29bba9..33972a9 100644 --- a/Tests/IntegrationTests/Resources/expected-reference-changes-swift-interface-private.md +++ b/Tests/IntegrationTests/Resources/expected-reference-changes-swift-interface-private.md @@ -6,7 +6,7 @@ _Comparing `new_private` to `old_private`_ ## `ReferencePackage` #### ❇️ Added ```javascript -public enum RawValueEnum: Swift.String, Swift.Equatable, Swift.Hashable, Swift.RawRepresentable { +public enum RawValueEnum: Swift.Equatable, Swift.Hashable, Swift.RawRepresentable, Swift.String { case one case two public init?(rawValue: Swift.String) @@ -16,14 +16,14 @@ public enum RawValueEnum: Swift.String, Swift.Equatable, Swift.Hashable, Swift.R ``` ```javascript public protocol ParentProtocol { - associatedtype ParentType: Swift.Equatable where Self.ParentType == Self.Iterator.Element associatedtype Iterator: Swift.Collection + associatedtype ParentType: Swift.Equatable where Self.ParentType == Self.Iterator.Element } ``` ```javascript public protocol ParentProtocol { - associatedtype ParentType: Swift.Equatable where Self.ParentType == Self.Iterator.Element associatedtype Iterator: Swift.Collection + associatedtype ParentType: Swift.Equatable where Self.ParentType == Self.Iterator.Element } ``` ```javascript @@ -193,8 +193,8 @@ extension ReferencePackage.CustomEnum where T == Swift.String { ``` ```javascript public struct NestedStructInExtension { - public let string: Swift.String { get } public init(string: Swift.String = "Hello") + public let string: Swift.String { get } } ``` #### 🔀 Modified diff --git a/Tests/IntegrationTests/Resources/expected-reference-changes-swift-interface-public.md b/Tests/IntegrationTests/Resources/expected-reference-changes-swift-interface-public.md index 465dfa2..bf27f2c 100644 --- a/Tests/IntegrationTests/Resources/expected-reference-changes-swift-interface-public.md +++ b/Tests/IntegrationTests/Resources/expected-reference-changes-swift-interface-public.md @@ -6,7 +6,7 @@ _Comparing `new_public` to `old_public`_ ## `ReferencePackage` #### ❇️ Added ```javascript -public enum RawValueEnum: Swift.String, Swift.Equatable, Swift.Hashable, Swift.RawRepresentable { +public enum RawValueEnum: Swift.Equatable, Swift.Hashable, Swift.RawRepresentable, Swift.String { case one case two public init?(rawValue: Swift.String) @@ -16,14 +16,14 @@ public enum RawValueEnum: Swift.String, Swift.Equatable, Swift.Hashable, Swift.R ``` ```javascript public protocol ParentProtocol { - associatedtype ParentType: Swift.Equatable where Self.ParentType == Self.Iterator.Element associatedtype Iterator: Swift.Collection + associatedtype ParentType: Swift.Equatable where Self.ParentType == Self.Iterator.Element } ``` ```javascript public protocol ParentProtocol { - associatedtype ParentType: Swift.Equatable where Self.ParentType == Self.Iterator.Element associatedtype Iterator: Swift.Collection + associatedtype ParentType: Swift.Equatable where Self.ParentType == Self.Iterator.Element } ``` ```javascript @@ -178,8 +178,8 @@ extension ReferencePackage.CustomEnum where T == Swift.String { ``` ```javascript public struct NestedStructInExtension { - public let string: Swift.String { get } public init(string: Swift.String = "Hello") + public let string: Swift.String { get } } ``` #### 🔀 Modified From 8bdfaff9c0e7296707d78eb218f81b2291d44519 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Fri, 10 Jan 2025 17:18:35 +0100 Subject: [PATCH 4/4] Adding tests for extensions to types in extensions --- .../Sources/ReferencePackage/ReferencePackage.swift | 4 ++-- Tests/IntegrationTests/ReferencePackageTests.swift | 2 +- .../expected-reference-changes-swift-interface-private.md | 3 ++- .../expected-reference-changes-swift-interface-public.md | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ReferencePackages/UpdatedPackage/Sources/ReferencePackage/ReferencePackage.swift b/ReferencePackages/UpdatedPackage/Sources/ReferencePackage/ReferencePackage.swift index a2ca7e7..bd2304c 100644 --- a/ReferencePackages/UpdatedPackage/Sources/ReferencePackage/ReferencePackage.swift +++ b/ReferencePackages/UpdatedPackage/Sources/ReferencePackage/ReferencePackage.swift @@ -195,9 +195,9 @@ extension CustomEnum: SimpleProtocol { } } -extension CustomEnum.NestedStructInExtension { +extension CustomEnum.NestedStructInExtension: CustomStringConvertible { - var description: String { + public var description: String { return string } } diff --git a/Tests/IntegrationTests/ReferencePackageTests.swift b/Tests/IntegrationTests/ReferencePackageTests.swift index c5372ec..daeacf4 100644 --- a/Tests/IntegrationTests/ReferencePackageTests.swift +++ b/Tests/IntegrationTests/ReferencePackageTests.swift @@ -67,7 +67,7 @@ class ReferencePackageTests: XCTestCase { let expectedLines = sanitizeOutput(expectedOutput).components(separatedBy: "\n") let markdownOutputLines = sanitizeOutput(markdownOutput).components(separatedBy: "\n") - + for i in 0..