nicklockwood / SwiftFormat

A command-line tool and Xcode Extension for formatting Swift code
MIT License
7.87k stars 638 forks source link

Extension of Internal struct cannot be public #1606

Open shkhaliq opened 8 months ago

shkhaliq commented 8 months ago

I am seeing a duplicate of #794

extension CategorySurface {
    struct RetailerItemGroup: Hashable {
        let collection: RetailerItemGroupCarousel.RetailerItemGroup
        let clickTrackingEvent: TrackingEvent?
    }
}

public extension CategorySurface.RetailerItemGroup {
    static func placeholder(id: String) -> Self {
        .init(
            collection: RetailerItemGroupCarousel.RetailerItemGroup.placeholder(id: id),
            clickTrackingEvent: nil
        )
    }
}

Screenshot 2024-01-09 at 2 35 23 PM

Environment Xcode Version: 15.1.0 SwiftFormat Version: 0.52.11

shkhaliq commented 8 months ago

@nicklockwood Hopefully this time its reproducible 😬

nicklockwood commented 8 months ago

@shkhaliq just to confirm, what was the "before" here, something like this?

extension CategorySurface {
    struct RetailerItemGroup: Hashable {
        let collection: RetailerItemGroupCarousel.RetailerItemGroup
        let clickTrackingEvent: TrackingEvent?
    }
}

extension CategorySurface.RetailerItemGroup {
    public static func placeholder(id: String) -> Self {
        .init(
            collection: RetailerItemGroupCarousel.RetailerItemGroup.placeholder(id: id),
            clickTrackingEvent: nil
        )
    }
}
shkhaliq commented 8 months ago

Yes exactly