Skip to content

Commit

Permalink
Fix assign-only property regression
Browse files Browse the repository at this point in the history
  • Loading branch information
ileitch committed Jan 10, 2024
1 parent 72bfce3 commit 432ec21
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ final class AssignOnlyPropertyReferenceEliminator: SourceGraphMutator {
!retainAssignOnlyPropertyTypes.contains(declaredType),
!graph.isRetained(property),
!property.isComplexProperty,
// A protocol property can technically be assigned and never used when the protocol is used as an existential
// type, however communicating that succinctly would be very tricky, and most likely just lead to confusion.
// Here we filter out protocol properties and thus restrict this analysis only to concrete properties.
property.parent?.kind != .protocol,
!graph.references(to: property).contains(where: { $0.parent?.parent?.kind == .protocol }),
let setter = property.declarations.first(where: { $0.kind == .functionAccessorSetter }),
let getter = property.declarations.first(where: { $0.kind == .functionAccessorGetter }),
Expand Down

0 comments on commit 432ec21

Please sign in to comment.