Skip to content

Incorrect usage of @retroactive on internal type AccessLevel in Swift 6 builds #147

@jonzim-cmd

Description

@jonzim-cmd

Describe the bug

When compiling the package with Swift 6 (Xcode 16), there is a compiler warning/error regarding the conformance of AccessLevel to ExpressibleByArgument.

The current implementation uses:

#if compiler(>=6.0)
extension AccessLevel: @retroactive ArgumentParser.ExpressibleByArgument {}
#else
// ...
#endif
The @retroactive attribute is explicitly intended for conforming types that are defined in other modules/packages. However, AccessLevel appears to be defined within this package itself. Using @retroactive on a type owned by the defining module is incorrect and causes issues in strict Swift 6 mode.

To Reproduce
Open the project in Xcode 16.

Enable Swift 6 build mode / strict concurrency checks.

Build the package.

Observe the warning regarding the unnecessary or incorrect usage of @retroactive.

Suggested Fix
Since AccessLevel is defined within the package, the @retroactive keyword should be removed from the extension in the Swift 6 compiler block:

Swift

#if compiler(>=6.0)
extension AccessLevel: ArgumentParser.ExpressibleByArgument {}
#endif
Environment
Xcode Version: 16.0+

Swift Version: 6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions