Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InternalError on packages with -latest component in their version #7658

Open
1 task done
stephencelis opened this issue Jun 12, 2024 · 4 comments
Open
1 task done
Labels

Comments

@stephencelis
Copy link
Contributor

Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?

  • Confirmed reproduction steps with SwiftPM CLI.

Description

The following package fails to resolve:

// swift-tools-version: 6.0

import PackageDescription

let package = Package(
  name: "FigureOutDependencies",
  platforms: [.macOS(.v10_15)],
  dependencies: [
    .package(url: "https://github.com/pointfreeco/swift-snapshot-testing", exact: "1.16.1"),
    .package(url: "https://github.com/apple/swift-syntax", from: "600.0.0-latest"),
  ],
  swiftLanguageVersions: [.v6]
)

But removing the swiftLanguageVersions parameter causes it to resolve just fine.

Expected behavior

I expect the package to resolve in both Swift 5 and 6 language modes.

Actual behavior

Failure to resolve:

🛑 Showing Recent Issues
InternalError(description: "Internal error. Please file a bug at https://github.com/apple/swift-package-manager/issues with this info. Expected root cause {swift-snapshot-testing[everything] 1.16.1, ¬swift-syntax[everything] 508.0.1..<601.0.0} to almost satisfy the current partial solution:\n * [Decision 0: figureoutdependencies[everything] 1.0.0]\n * [Derivation: swift-syntax[everything] 600.0.0-latest..<601.0.0 ← {figureoutdependencies[everything] 1.0.0, ¬swift-syntax[everything] 600.0.0-latest..<601.0.0}]\n * [Derivation: swift-snapshot-testing[everything] 1.16.1..<2.0.0 ← {figureoutdependencies[everything] 1.0.0, ¬swift-snapshot-testing[everything] 1.16.1..<2.0.0}]\n * [Derivation: ¬swift-snapshot-testing[everything] 1.16.2..<2.0.0 ← {swift-snapshot-testing[everything] 1.16.2..<2.0.0}]\n")

Steps to reproduce

Create a new package with the above Package.swift file, or simply download and open FigureOutDependencies.zip.

Swift Package Manager version/commit hash

Swift Package Manager - Swift 6.0.0-dev (Xcode 16 beta 1)

Swift & OS version (output of swift --version ; uname -a)

swift-driver version: 1.109.2 Apple Swift version 6.0 (swiftlang-6.0.0.3.300 clang-1600.0.20.10)
Target: arm64-apple-macosx14.0
Darwin MacBook-Pro.lan 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:14:38 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6020 arm64

@abidon
Copy link

abidon commented Jun 13, 2024

I was coming here to report the same thing. Adding another Package.swift in case it can help resolve the issue.

Description

The following package fails to resolve:

// swift-tools-version: 6.0

import PackageDescription

let package = Package(
    name: "ReproSPMBug",
    products: [
    ],
    dependencies: [
        .package(
            url: "https://github.com/abidon/Mockable.git",
            branch: "2d1a7a48665b2719f3abf812ac97f4daf23685a8"
        ),
        .package(
            url: "https://github.com/apple/swift-testing.git",
            exact: "0.10.0"
        ),
        .package(
            url: "https://github.com/pointfreeco/swift-dependencies.git",
            exact: "1.3.1"
        ),
    ]
)

Adding or removing the swiftLanguageVersions: [.v6] parameter doesn't seem to have an impact in this case.

Expected behavior

I expect the package to resolve in both Swift 5 and 6 language modes.

Actual behavior

Failure to resolve:

InternalError(description: "Internal error. Please file a bug at https://github.com/apple/swift-package-manager/issues with this info. Expected root cause {swift-dependencies[everything] 1.3.1, ¬swift-syntax[everything] 509.0.0..<601.0.0} to almost satisfy the current partial solution:\n * [Decision 0: repro-spm-bug[everything] 1.0.0]\n * [Derivation: swift-syntax[everything] 600.0.0-latest..<601.0.0 ← {repro-spm-bug[everything] 1.0.0, ¬swift-syntax[everything] 600.0.0-latest..<601.0.0}]\n * [Derivation: swift-dependencies[everything] 1.3.1 ← {repro-spm-bug[everything] 1.0.0, ¬swift-dependencies[everything] 1.3.1}]\n * [Derivation: swift-testing[everything] 0.10.0 ← {repro-spm-bug[everything] 1.0.0, ¬swift-testing[everything] 0.10.0}]\n")

Steps to reproduce

Create a new package with the above Package.swift file.

Swift Package Manager version/commit hash

Swift Package Manager - Swift 6.0.0-dev (Xcode 16 beta 1)

Swift & OS version

MacOS 15.0 Beta (24A5264n) // Xcode 16.0 Beta (16A5171c)

swift-driver version: 1.109.2 Apple Swift version 6.0 (swiftlang-6.0.0.3.300 clang-1600.0.20.10)
Target: arm64-apple-macosx15.0
Darwin Beam.local 24.0.0 Darwin Kernel Version 24.0.0: Thu May 30 21:30:12 PDT 2024; root:xnu-11215.0.31.511.2~1/RELEASE_ARM64_T6000 arm64

@xedin
Copy link
Contributor

xedin commented Jun 18, 2024

Looks like the problem here is not 6.0 but the fast that one of the depedencies is using -latest now. There is a Swift forums thread about this behavior - https://forums.swift.org/t/what-does-this-dependency-resolution-error-mean/72278/8

@kabiroberai
Copy link
Contributor

kabiroberai commented Jun 23, 2024

Looks like this is partly intentional

https://github.com/apple/swift-tools-support-core/blob/b170d46b94d6c1cd91db97d2e3a1e0bdb5b79a24/Sources/TSCUtility/Version.swift#L347-L360

But I believe the InternalError is still considered a bug — the diagnostic here should be better. Possibly related to TSCUtility.Version.< and Range<Version>.contains (overload defined in TSCUtility) having different version ordering semantics?

@MaxDesiatov
Copy link
Contributor

But removing the swiftLanguageVersions parameter causes it to resolve just fine.

I don't find this to be the case, removing swiftLanguageVersions has no effect with swift-DEVELOPMENT-SNAPSHOT-2024-06-13-a.

@MaxDesiatov MaxDesiatov changed the title Using swift language version 6 breaks a package's resolution InternalError on packages with -latest component in their version Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants