Skip to content

xcodebuild archive fails on swift-syntax: switch statements need @unknown default for library evolution #674

@vsarunas

Description

@vsarunas

Description

When swift-syntax prebuilt binaries have infrastrucutre issues or swift-syntax is not prebuilt for OS/Swift/combination (nightly/macOS Tahoe), we're not able to compile a project which enables library evolution:

Parser-Swift.h -serialize-diagnostics-path /Users/sarunas/Xcode-xcf/swift-syntax.derived/Build/Intermediates.noindex/ArchiveIntermediates/AddOneToIntegerLiterals/IntermediateBuildFilesPath/swift-syntax.build/Debug/SwiftParser.build/Objects-normal/x86_64/SwiftParser-master-emit-module.dia -emit-dependencies-path /Users/sarunas/Xcode-xcf/swift-syntax.derived/Build/Intermediates.noindex/ArchiveIntermediates/AddOneToIntegerLiterals/IntermediateBuildFilesPath/swift-syntax.build/Debug/SwiftParser.build/Objects-normal/x86_64/SwiftParser-master-emit-module.d -o /Users/sarunas/Xcode-xcf/swift-syntax.derived/Build/Intermediates.noindex/ArchiveIntermediates/AddOneToIntegerLiterals/IntermediateBuildFilesPath/swift-syntax.build/Debug/SwiftParser.build/Objects-normal/x86_64/SwiftParser.swiftmodule -emit-abi-descriptor-path /Users/sarunas/Xcode-xcf/swift-syntax.derived/Build/Intermediates.noindex/ArchiveIntermediates/AddOneToIntegerLiterals/IntermediateBuildFilesPath/swift-syntax.build/Debug/SwiftParser.build/Objects-normal/x86_64/SwiftParser.abi.json
/Users/sarunas/swift-syntax/Sources/SwiftParser/Declarations.swift:574:9: error: switch covers known cases, but 'RawSameTypeRequirementSyntax.LeftType' may have additional unknown values
        switch firstArgument {
        ^
/Users/sarunas/swift-syntax/Sources/SwiftParser/Declarations.swift:574:9: note: handle unknown values using "@unknown default"
        switch firstArgument {
        ^
/Users/sarunas/swift-syntax/Sources/SwiftParser/TokenPrecedence.swift:194:5: error: switch covers known cases, but 'Keyword' may have additional unknown values
    switch keyword {
    ^
/Users/sarunas/swift-syntax/Sources/SwiftParser/TokenPrecedence.swift:194:5: note: handle unknown values using "@unknown default"
    switch keyword {

Steps to Reproduce

git clone https://github.com/swiftlang/swift-syntax.git
cd swift-syntax/Examples
git checkout 601.0.1

sed -i '' 's|path: "\.\./"|url: "https://github.com/swiftlang/swift-syntax", exact: "601.0.1"|' Package.swift

rm -rf $HOME/Xcode-xcf/; xcodebuild archive -quiet -scheme AddOneToIntegerLiterals -configuration Debug -destination 'platform=macOS,arch=arm64' -archivePath $HOME/Xcode-xcf/swift-syntax.xcarchive -derivedDataPath $HOME/Xcode-xcf/swift-syntax.derived BUILD_LIBRARY_FOR_DISTRIBUTION=YES

Does not happen if using something 602 version, for example an old: 602.0.0-prerelease-2025-04-10; nor when BUILD_LIBRARY_FOR_DISTRIBUTION=NO

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions