periphery icon indicating copy to clipboard operation
periphery copied to clipboard

False positive calling internal init through typealias

Open samalone opened this issue 1 year ago • 1 comments

I believe I have a false positive when calling an internal init on a type using a typealias.

You can reproduce the false positive using my websocket-actor-system code. Just type periphery scan in the top-level directory.

The init is on line 22 of NIOInvocationDecoder.swift.

public class NIOInvocationDecoder: DistributedTargetInvocationDecoder {
    public typealias SerializationRequirement = any Codable

    let decoder: JSONDecoder
    let envelope: RemoteWebSocketCallEnvelope
    let logger: Logger
    var argumentsIterator: Array<Data>.Iterator

    internal init(system: WebSocketActorSystem, envelope: RemoteWebSocketCallEnvelope) {
        self.envelope = envelope
        self.logger = system.logger
        self.argumentsIterator = envelope.args.makeIterator()

        let decoder = JSONDecoder()
        decoder.userInfo[.actorSystemKey] = system
        self.decoder = decoder
    }

The typealias is on line 84 of WebSocketActorSystem.swift

    public typealias InvocationDecoder = NIOInvocationDecoder

The call to this init is on line 419 of WebSocketActorSystem.swift.

                var decoder = Self.InvocationDecoder(system: self, envelope: envelope)

samalone avatar Nov 20 '23 17:11 samalone

Unfortunately, this appears to be caused by a Swift compiler bug.

ileitch avatar Dec 18 '23 16:12 ileitch