periphery icon indicating copy to clipboard operation
periphery copied to clipboard

Incorrect warning for unused public protocol.

Open CraigSiemens opened this issue 3 years ago • 0 comments

We're incorrectly getting the following warning when building our project

Protocol 'Something' is declared public, but not used outside of [Framework Target]

Versions

Periphery: 2.9.0 Xcode: 13.4.1

Steps to Reproduce

This is the simplest implementation I could reproduce it with.

Framework Target

public let getSomething = { () -> Something in RealThing() }

public protocol Something {
    func doThing()
}

private struct RealThing: Something {
    func doThing() {
        print("Hello, world!")
    }
}

App Target

getSomething().doThing()

Other Details

It seems like it's an issue with the property's type being inferred from the closure. If the implementation is changed to have and explicit type, the warning is not shown.

public let getSomething: () -> Something = { RealThing() }

CraigSiemens avatar Aug 22 '22 18:08 CraigSiemens