@@ -21,6 +21,13 @@ extension SDKDump.Element {
2121 diff += differences ( toIsDynamic: otherElement. isDynamic)
2222 diff += differences ( toIsMutating: otherElement. isMutating)
2323 diff += differences ( toIsRequired: otherElement. isRequired)
24+ diff += differences ( toIsOpen: otherElement. isOpen)
25+ diff += differences ( toIsInternal: otherElement. isInternal)
26+ diff += differences ( toIsPrefix: otherElement. isPrefix)
27+ diff += differences ( toIsInfix: otherElement. isInfix)
28+ diff += differences ( toIsPostfix: otherElement. isPostfix)
29+ diff += differences ( toIsInlinable: otherElement. isInlinable)
30+ diff += differences ( toIsIndirect: otherElement. isIndirect)
2431
2532 if let functionDescription = asFunction, let otherFunctionDescription = otherElement. asFunction {
2633 diff += functionDescription. differences ( toFunction: otherFunctionDescription)
@@ -34,22 +41,12 @@ private extension SDKDump.Element {
3441
3542 func differences( toIsFinal otherIsFinal: Bool ) -> [ String ] {
3643 guard isFinal != otherIsFinal else { return [ ] }
37-
38- if otherIsFinal {
39- return [ " Added `final` keyword " ]
40- } else {
41- return [ " Removed `final` keyword " ]
42- }
44+ return [ " \( otherIsFinal ? " Added " : " Removed " ) `final` keyword " ]
4345 }
4446
4547 func differences( toIsThrowing otherIsThrowing: Bool ) -> [ String ] {
4648 guard isThrowing != otherIsThrowing else { return [ ] }
47-
48- if otherIsThrowing {
49- return [ " Added `throws` keyword " ]
50- } else {
51- return [ " Removed `throws` keyword " ]
52- }
49+ return [ " \( otherIsThrowing ? " Added " : " Removed " ) `throws` keyword " ]
5350 }
5451
5552 func differences( toSpiGroupNames otherSpiGroupNames: [ String ] ? ) -> [ String ] {
@@ -59,11 +56,7 @@ private extension SDKDump.Element {
5956 let otherSpiGroupNames = Set ( otherSpiGroupNames ?? [ ] )
6057
6158 return ownSpiGroupNames. symmetricDifference ( otherSpiGroupNames) . map {
62- if otherSpiGroupNames. contains ( $0) {
63- return " Added `@_spi( \( $0) )` "
64- } else {
65- return " Removed `@_spi( \( $0) )` "
66- }
59+ " \( otherSpiGroupNames. contains ( $0) ? " Added " : " Removed " ) `@_spi( \( $0) )` "
6760 }
6861 }
6962
@@ -74,11 +67,7 @@ private extension SDKDump.Element {
7467 let otherConformances = Set ( otherConformances ?? [ ] )
7568
7669 return ownConformances. symmetricDifference ( otherConformances) . map {
77- if otherConformances. contains ( $0) {
78- return " Added ` \( $0. printedName) ` conformance "
79- } else {
80- return " Removed ` \( $0. printedName) ` conformance "
81- }
70+ " \( otherConformances. contains ( $0) ? " Added " : " Removed " ) ` \( $0. printedName) ` conformance "
8271 }
8372 }
8473
@@ -89,22 +78,13 @@ private extension SDKDump.Element {
8978 let otherAccessors = Set ( otherAccessors? . map ( \. printedName) ?? [ ] )
9079
9180 return ownAccessors. symmetricDifference ( otherAccessors) . map {
92- if otherAccessors. contains ( $0) {
93- return " Added ` \( $0) ` accessor "
94- } else {
95- return " Removed ` \( $0) ` accessor "
96- }
81+ " \( otherAccessors. contains ( $0) ? " Added " : " Removed " ) ` \( $0) ` accessor "
9782 }
9883 }
9984
10085 func differences( toHasDiscardableResult otherHasDiscardableResult: Bool ) -> [ String ] {
10186 guard hasDiscardableResult != otherHasDiscardableResult else { return [ ] }
102-
103- if otherHasDiscardableResult {
104- return [ " Added `@discardableResult` keyword " ]
105- } else {
106- return [ " Removed `@discardableResult` keyword " ]
107- }
87+ return [ " \( otherHasDiscardableResult ? " Added " : " Removed " ) `@discardableResult` keyword " ]
10888 }
10989
11090 func differences( toInitKind otherInitKind: String ? ) -> [ String ] {
@@ -133,52 +113,62 @@ private extension SDKDump.Element {
133113
134114 func differences( toIsObjcAccessible otherIsObjcAccessible: Bool ) -> [ String ] {
135115 guard isObjcAccessible != otherIsObjcAccessible else { return [ ] }
136-
137- if otherIsObjcAccessible {
138- return [ " Added `@objc` keyword " ]
139- } else {
140- return [ " Removed `@objc` keyword " ]
141- }
116+ return [ " \( otherIsObjcAccessible ? " Added " : " Removed " ) `@objc` keyword " ]
142117 }
143118
144119 func differences( toIsOverride otherIsOverride: Bool ) -> [ String ] {
145120 guard isOverride != otherIsOverride else { return [ ] }
146-
147- if otherIsOverride {
148- return [ " Added `override` keyword " ]
149- } else {
150- return [ " Removed `override` keyword " ]
151- }
121+ return [ " \( otherIsOverride ? " Added " : " Removed " ) `override` keyword " ]
152122 }
153123
154124 func differences( toIsDynamic otherIsDynamic: Bool ) -> [ String ] {
155125 guard isDynamic != otherIsDynamic else { return [ ] }
156-
157- if otherIsDynamic {
158- return [ " Added `dynamic` keyword " ]
159- } else {
160- return [ " Removed `dynamic` keyword " ]
161- }
126+ return [ " \( otherIsDynamic ? " Added " : " Removed " ) `dynamic` keyword " ]
162127 }
163128
164129 func differences( toIsMutating otherIsMutating: Bool ) -> [ String ] {
165130 guard isMutating != otherIsMutating else { return [ ] }
166-
167- if otherIsMutating {
168- return [ " Added `mutating` keyword " ]
169- } else {
170- return [ " Removed `mutating` keyword " ]
171- }
131+ return [ " \( otherIsMutating ? " Added " : " Removed " ) `mutating` keyword " ]
172132 }
173133
174134 func differences( toIsRequired otherIsRequired: Bool ) -> [ String ] {
175135 guard isRequired != otherIsRequired else { return [ ] }
176-
177- if otherIsRequired {
178- return [ " Added `required` keyword " ]
179- } else {
180- return [ " Removed `required` keyword " ]
181- }
136+ return [ " \( otherIsRequired ? " Added " : " Removed " ) `required` keyword " ]
137+ }
138+
139+ func differences( toIsOpen otherIsOpen: Bool ) -> [ String ] {
140+ guard isOpen != otherIsOpen else { return [ ] }
141+ return [ " \( otherIsOpen ? " Added " : " Removed " ) `open` keyword " ]
142+ }
143+
144+ func differences( toIsInternal otherIsInternal: Bool ) -> [ String ] {
145+ guard isInternal != otherIsInternal else { return [ ] }
146+ return [ " \( otherIsInternal ? " Added " : " Removed " ) `internal` keyword " ]
147+ }
148+
149+ func differences( toIsPrefix otherIsPrefix: Bool ) -> [ String ] {
150+ guard isPrefix != otherIsPrefix else { return [ ] }
151+ return [ " \( otherIsPrefix ? " Added " : " Removed " ) `prefix` keyword " ]
152+ }
153+
154+ func differences( toIsPostfix otherIsPostfix: Bool ) -> [ String ] {
155+ guard isPostfix != otherIsPostfix else { return [ ] }
156+ return [ " \( otherIsPostfix ? " Added " : " Removed " ) `postfix` keyword " ]
157+ }
158+
159+ func differences( toIsInfix otherIsInfix: Bool ) -> [ String ] {
160+ guard isInfix != otherIsInfix else { return [ ] }
161+ return [ " \( otherIsInfix ? " Added " : " Removed " ) `infix` keyword " ]
162+ }
163+
164+ func differences( toIsInlinable otherIsInlinable: Bool ) -> [ String ] {
165+ guard isInlinable != otherIsInlinable else { return [ ] }
166+ return [ " \( otherIsInlinable ? " Added " : " Removed " ) `@inlinable` keyword " ]
167+ }
168+
169+ func differences( toIsIndirect otherIsIndirect: Bool ) -> [ String ] {
170+ guard isIndirect != otherIsIndirect else { return [ ] }
171+ return [ " \( otherIsIndirect ? " Added " : " Removed " ) `indirect` keyword " ]
182172 }
183173}
184174
@@ -190,17 +180,11 @@ extension SDKDump.FunctionElement {
190180
191181 guard ownArguments != otherArguments else { return [ ] }
192182
193- // TODO: Indicate more in depth if the order, type and/or default arg changed
194-
195183 let ownArgumentNames = Set ( arguments. map ( \. description) )
196184 let otherArgumentNames = Set ( otherArguments. map ( \. description) )
197185
198186 return ownArgumentNames. symmetricDifference ( otherArgumentNames) . map {
199- if otherArgumentNames. contains ( $0) {
200- return " Added ` \( $0) ` "
201- } else {
202- return " Removed ` \( $0) ` "
203- }
187+ " \( otherArgumentNames. contains ( $0) ? " Added " : " Removed " ) ` \( $0) ` "
204188 }
205189 }
206190}
0 commit comments