Description
Periphery produces contradictory diagnostics for a public class that is used in a constrained extension of a public protocol.
Environment
Setup
// Module A
public protocol MapViewMarkerModel { }
public class DefaultMapViewMarkerModel: MapViewMarkerModel {
// ... properties
}
extension MapViewMarkerModel where Self == DefaultMapViewMarkerModel {
public func ...
// ... convenience API
}
DefaultMapViewMarkerModel is not referenced directly outside the module, but its public access level is required because it appears in the generic constraint of an extension on MapViewMarkerModel, containing public properties.
Problem
There is a no-win situation with Periphery diagnostics:
-
Without // periphery:ignore — Periphery reports:
DefaultMapViewMarkerModel is declared public is declared public, but not used outside of module
This is a false positive because removing public would cause a compiler error: the class is used in a where Self == constraint on a public extension, so it must also be public.
-
With // periphery:ignore — Periphery reports that the ignore annotation is unnecessary.
This creates a contradictory state where the diagnostic cannot be resolved by any means other than excluding the file entirely. Ignore worked fine in 3.2.0 version, but was false-positive.
Expected Behavior
Periphery should recognize that a type referenced in a generic constraint of an extension containing public properties (e.g., where Self == SomeType) requires public accessibility, and should not flag it as "redundant public".
Description
Periphery produces contradictory diagnostics for a
publicclass that is used in a constrained extension of apublicprotocol.Environment
Setup
DefaultMapViewMarkerModelis not referenced directly outside the module, but itspublicaccess level is required because it appears in the generic constraint of an extension onMapViewMarkerModel, containing public properties.Problem
There is a no-win situation with Periphery diagnostics:
Without
// periphery:ignore— Periphery reports:This is a false positive because removing
publicwould cause a compiler error: the class is used in awhere Self ==constraint on apublicextension, so it must also bepublic.With
// periphery:ignore— Periphery reports that the ignore annotation is unnecessary.This creates a contradictory state where the diagnostic cannot be resolved by any means other than excluding the file entirely. Ignore worked fine in 3.2.0 version, but was false-positive.
Expected Behavior
Periphery should recognize that a type referenced in a generic constraint of an extension containing public properties (e.g.,
where Self == SomeType) requirespublicaccessibility, and should not flag it as "redundant public".