File tree Expand file tree Collapse file tree 5 files changed +24
-0
lines changed
Sources/PeripheryKit/Syntax
AccessibilityProject/Sources Expand file tree Collapse file tree 5 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 1414- Fix unused parameter analysis for shorthand if-let syntax.
1515- Workaround Swift shorthand if-let syntax bug (https://github.com/apple/swift/issues/61509 ). Global properties are not handled by this workaround.
1616- Fix retaining inferred associated types.
17+ - Fix redundant public accessibility analysis for types used in closure signatures.
1718
1819## 2.10.0 (2022-10-10)
1920
Original file line number Diff line number Diff line change @@ -171,11 +171,15 @@ final class DeclarationVisitor: PeripherySyntaxVisitor {
171171 func visitPost( _ node: VariableDeclSyntax ) {
172172 for binding in node. bindings {
173173 if binding. pattern. is ( IdentifierPatternSyntax . self) {
174+ let closureSignature = binding. initializer? . value. as ( ClosureExprSyntax . self) ? . signature
175+ let closureParameters = closureSignature? . input? . as ( ParameterClauseSyntax . self)
174176 parse (
175177 modifiers: node. modifiers,
176178 attributes: node. attributes,
177179 trivia: node. leadingTrivia,
178180 variableType: binding. typeAnnotation? . type,
181+ parameterClause: closureParameters,
182+ returnClause: closureSignature? . output,
179183 at: binding. positionAfterSkippingLeadingTrivia
180184 )
181185 } else if let tuplePatternSyntax = binding. pattern. as ( TuplePatternSyntax . self) {
Original file line number Diff line number Diff line change @@ -54,3 +54,6 @@ _ = InternalClassAdoptingPublicProtocolRetainer()
5454let _: PublicProtocolRefiningPublicProtocol ? = nil
5555_ = InternalProtocolRefiningPublicProtocolRetainer ( )
5656
57+ // Closure
58+ let _ = PublicTypeUsedInPublicClosureRetainer ( ) . closure
59+
Original file line number Diff line number Diff line change 1+ import Foundation
2+
3+ public class PublicTypeUsedInPublicClosureReturnType { }
4+ public class PublicTypeUsedInPublicClosureInputType { }
5+
6+ public class PublicTypeUsedInPublicClosureRetainer {
7+ public var closure = { ( a: PublicTypeUsedInPublicClosureInputType ) -> PublicTypeUsedInPublicClosureReturnType in
8+ PublicTypeUsedInPublicClosureReturnType ( )
9+ }
10+ public init ( ) { }
11+ }
Original file line number Diff line number Diff line change @@ -148,4 +148,9 @@ class RedundantPublicAccessibilityTest: SourceGraphTestCase {
148148 assertNotRedundantPublicAccessibility ( . typealias( " PublicTypealiasWithClosureType " ) )
149149 assertNotRedundantPublicAccessibility ( . struct( " PublicTypealiasStruct " ) )
150150 }
151+
152+ func testPublicTypeUsedInPublicClosure( ) {
153+ assertNotRedundantPublicAccessibility ( . class( " PublicTypeUsedInPublicClosureReturnType " ) )
154+ assertNotRedundantPublicAccessibility ( . class( " PublicTypeUsedInPublicClosureInputType " ) )
155+ }
151156}
You can’t perform that action at this time.
0 commit comments