Skip to content

Version 1.7.0 fails to build on Swift 5.9 #870

@jbelkins

Description

@jbelkins

Version 1.7.0 of this package fails to compile on Xcode 15 / Swift 5.9, despite the README for this package claiming Swift 5.7+ are supported.

The cause of the compile failure seems to be the use of "scoped imports" introduced in version 1.7.0. See:
https://github.com/apple/swift-argument-parser/pull/804/changes#diff-1d30222d502b2ce39bb68017a7c60ce161ea2dd19e662f10631b136192eb0dd2R15

Scoped imports are apparently experimental in Swift 5.x and require the use of compiler flags to compile successfully.

I experienced this issue on Swift 5.9, but I'm presuming other Swift 5.x versions on Mac have the same issue. This seems to only be a Mac issue, since Swift 5.9 on Linux compiles version 1.7.0 successfully (the scoped import seems to be excluded by compile conditions on Linux.)

ArgumentParser version: 1.7.0
Swift version:

Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)
Target: arm64-apple-macosx14.0

Checklist

  • If possible, I've reproduced the issue using the main branch of this package
  • I've searched for existing GitHub issues

Steps to Reproduce

  • Use Xcode 15.4

Expected behavior

Package builds on Swift 5.9 without compile errors

Actual behavior

Package fails on Swift 5.9 with compile error:

Error: Access level on imports require '-enable-experimental-feature AccessLevelOnImport'
internal import os
^~~~~~~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions