Skip to content

Commit 1f786b8

Browse files
committed
Merge branch 'main' into reference-packages-macos
2 parents c32f61e + e5d9afb commit 1f786b8

21 files changed

+285
-64
lines changed

Package.resolved

Lines changed: 2 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ let package = Package(
3535
.package(url: "https://github.com/swiftlang/swift-syntax", from: "601.0.1"),
3636
.package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.55.5"),
3737
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.4.3"),
38-
.package(url: "https://github.com/SimplyDanny/SwiftLintPlugins", from: "0.59.0")
38+
.package(url: "https://github.com/SimplyDanny/SwiftLintPlugins", from: "0.59.1")
3939
],
4040
targets: [
4141

ReferencePackages/UpdatedPackage/Sources/ReferencePackage/ReferencePackage.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ public protocol CustomProtocol<CustomAssociatedType, AnotherAssociatedType>: Par
3838
func function() -> CustomAssociatedType
3939
}
4040

41+
public protocol ProtocolWithDefaultImplementation {
42+
func function() -> String
43+
}
44+
45+
extension ProtocolWithDefaultImplementation {
46+
public func function() -> String {
47+
fatalError()
48+
}
49+
}
50+
4151
public struct CustomStruct<T: Strideable>: CustomProtocol {
4252
public typealias CustomAssociatedType = Int
4353
public typealias AnotherAssociatedType = Double

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ class SwiftInterfaceActor: SwiftInterfaceExtendableElement {
3636

3737
var consolidatableName: String { name }
3838

39-
var description: String { compileDescription() }
39+
func description(incl tokens: Set<SwiftInterfaceElementDescriptionToken>) -> String {
40+
compileDescription(incl: tokens)
41+
}
4042

4143
var typeName: String { name }
4244

@@ -75,8 +77,12 @@ extension SwiftInterfaceActor {
7577

7678
private extension SwiftInterfaceActor {
7779

78-
func compileDescription() -> String {
80+
func compileDescription(incl tokens: Set<SwiftInterfaceElementDescriptionToken>) -> String {
7981
var description = ""
82+
var modifiers = modifiers
83+
if !tokens.contains(.modifiers) { modifiers = [] }
84+
var attributes = attributes
85+
if !tokens.contains(.attributes) { attributes = [] }
8086
description.append(attributes.joined(separator: "\n"), with: "")
8187
description.append(modifiers.joined(separator: " "), with: "\n")
8288
if modifiers.isEmpty && !attributes.isEmpty { description.append("\n") }

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ class SwiftInterfaceAssociatedType: SwiftInterfaceElement {
3737

3838
var consolidatableName: String { name }
3939

40-
var description: String { compileDescription() }
40+
func description(incl tokens: Set<SwiftInterfaceElementDescriptionToken>) -> String {
41+
compileDescription(incl: tokens)
42+
}
4143

4244
init(
4345
attributes: [String],
@@ -72,8 +74,12 @@ extension SwiftInterfaceAssociatedType {
7274

7375
private extension SwiftInterfaceAssociatedType {
7476

75-
func compileDescription() -> String {
77+
func compileDescription(incl tokens: Set<SwiftInterfaceElementDescriptionToken>) -> String {
7678
var description = ""
79+
var modifiers = modifiers
80+
if !tokens.contains(.modifiers) { modifiers = [] }
81+
var attributes = attributes
82+
if !tokens.contains(.attributes) { attributes = [] }
7783
description.append(attributes.joined(separator: "\n"), with: "")
7884
description.append(modifiers.joined(separator: " "), with: "\n")
7985
if modifiers.isEmpty && !attributes.isEmpty { description.append("\n") }

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ class SwiftInterfaceClass: SwiftInterfaceExtendableElement {
3636

3737
var consolidatableName: String { name }
3838

39-
var description: String { compileDescription() }
39+
func description(incl tokens: Set<SwiftInterfaceElementDescriptionToken>) -> String {
40+
compileDescription(incl: tokens)
41+
}
4042

4143
var typeName: String { name }
4244

@@ -75,8 +77,12 @@ extension SwiftInterfaceClass {
7577

7678
private extension SwiftInterfaceClass {
7779

78-
func compileDescription() -> String {
80+
func compileDescription(incl tokens: Set<SwiftInterfaceElementDescriptionToken>) -> String {
7981
var description = ""
82+
var modifiers = modifiers
83+
if !tokens.contains(.modifiers) { modifiers = [] }
84+
var attributes = attributes
85+
if !tokens.contains(.attributes) { attributes = [] }
8086
description.append(attributes.joined(separator: "\n"), with: "")
8187
description.append(modifiers.joined(separator: " "), with: "\n")
8288
if modifiers.isEmpty && !attributes.isEmpty { description.append("\n") }

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ class SwiftInterfaceEnum: SwiftInterfaceExtendableElement {
3434

3535
var consolidatableName: String { name }
3636

37-
var description: String { compileDescription() }
37+
func description(incl tokens: Set<SwiftInterfaceElementDescriptionToken>) -> String {
38+
compileDescription(incl: tokens)
39+
}
3840

3941
var typeName: String { name }
4042

@@ -73,8 +75,12 @@ extension SwiftInterfaceEnum {
7375

7476
private extension SwiftInterfaceEnum {
7577

76-
func compileDescription() -> String {
78+
func compileDescription(incl tokens: Set<SwiftInterfaceElementDescriptionToken>) -> String {
7779
var description = ""
80+
var modifiers = modifiers
81+
if !tokens.contains(.modifiers) { modifiers = [] }
82+
var attributes = attributes
83+
if !tokens.contains(.attributes) { attributes = [] }
7884
description.append(attributes.joined(separator: "\n"), with: "")
7985
description.append(modifiers.joined(separator: " "), with: "\n")
8086
if modifiers.isEmpty && !attributes.isEmpty { description.append("\n") }

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ class SwiftInterfaceEnumCase: SwiftInterfaceElement {
6464

6565
var consolidatableName: String { name }
6666

67-
var description: String { compileDescription() }
67+
func description(incl tokens: Set<SwiftInterfaceElementDescriptionToken>) -> String {
68+
compileDescription(incl: tokens)
69+
}
6870

6971
init(
7072
attributes: [String],
@@ -101,8 +103,12 @@ private extension SwiftInterfaceEnumCase {
101103
return formattedParameterDescription(for: parameters.map(\.description))
102104
}
103105

104-
func compileDescription() -> String {
106+
func compileDescription(incl tokens: Set<SwiftInterfaceElementDescriptionToken>) -> String {
105107
var description = ""
108+
var modifiers = modifiers
109+
if !tokens.contains(.modifiers) { modifiers = [] }
110+
var attributes = attributes
111+
if !tokens.contains(.attributes) { attributes = [] }
106112
description.append(attributes.joined(separator: "\n"), with: "")
107113
description.append(modifiers.joined(separator: " "), with: "\n")
108114
if modifiers.isEmpty && !attributes.isEmpty { description.append("\n") }

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ class SwiftInterfaceExtension: SwiftInterfaceElement {
3434

3535
var consolidatableName: String { extendedType }
3636

37-
var description: String {
38-
compileDescription()
37+
func description(incl tokens: Set<SwiftInterfaceElementDescriptionToken>) -> String {
38+
compileDescription(incl: tokens)
3939
}
4040

4141
init(
@@ -70,8 +70,12 @@ extension SwiftInterfaceExtension {
7070

7171
private extension SwiftInterfaceExtension {
7272

73-
func compileDescription() -> String {
73+
func compileDescription(incl tokens: Set<SwiftInterfaceElementDescriptionToken>) -> String {
7474
var description = ""
75+
var modifiers = modifiers
76+
if !tokens.contains(.modifiers) { modifiers = [] }
77+
var attributes = attributes
78+
if !tokens.contains(.attributes) { attributes = [] }
7579
description.append(attributes.joined(separator: "\n"), with: "")
7680
description.append(modifiers.joined(separator: " "), with: "\n")
7781
if modifiers.isEmpty && !attributes.isEmpty { description.append("\n") }

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ class SwiftInterfaceFunction: SwiftInterfaceElement {
8181

8282
var consolidatableName: String { name }
8383

84-
var description: String { compileDescription() }
84+
func description(incl tokens: Set<SwiftInterfaceElementDescriptionToken>) -> String {
85+
compileDescription(incl: tokens)
86+
}
8587

8688
init(
8789
attributes: [String],
@@ -126,8 +128,12 @@ private extension SwiftInterfaceFunction {
126128
formattedParameterDescription(for: parameters.map(\.description))
127129
}
128130

129-
func compileDescription() -> String {
131+
func compileDescription(incl tokens: Set<SwiftInterfaceElementDescriptionToken>) -> String {
130132
var description = ""
133+
var modifiers = modifiers
134+
if !tokens.contains(.modifiers) { modifiers = [] }
135+
var attributes = attributes
136+
if !tokens.contains(.attributes) { attributes = [] }
131137
description.append(attributes.joined(separator: "\n"), with: "")
132138
description.append(modifiers.joined(separator: " "), with: "\n")
133139
if modifiers.isEmpty && !attributes.isEmpty { description.append("\n") }

0 commit comments

Comments
 (0)