From 58d8e648b91fa2653b89bfad9b28af7d84e94293 Mon Sep 17 00:00:00 2001 From: a dinosaur Date: Sun, 6 Jul 2025 17:12:52 +1000 Subject: [PATCH] Fix compilation --- Sources/apk/Graph/ApkPackageGraph.swift | 4 ++-- Sources/apk/Index/ApkIndexRequirementRef.swift | 2 +- Sources/apk/Version/ApkVersionSpecification.swift | 11 +++++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Sources/apk/Graph/ApkPackageGraph.swift b/Sources/apk/Graph/ApkPackageGraph.swift index 1c6a80e..dd03ba6 100644 --- a/Sources/apk/Graph/ApkPackageGraph.swift +++ b/Sources/apk/Graph/ApkPackageGraph.swift @@ -32,7 +32,7 @@ public class ApkPackageGraph { for (id, package) in pkgIndex.packages.enumerated() { let children: [ApkIndexRequirementRef] = package.dependencies.compactMap { dependency in - guard dependency.requirement.versionSpec != .conflict, + guard !dependency.requirement.versionSpec.conflict, let id = provides[dependency.requirement.name] else { return nil } @@ -104,7 +104,7 @@ extension ApkPackageGraph { var working = self._nodes.reduce(into: [ApkPackageGraphNode: Set]()) { d, node in d[node] = Set(node.children.filter { child in if case .dep(let version) = child.constraint { - version != .conflict && child.packageID != node.packageID + !version.conflict && child.packageID != node.packageID } else { false } }.map { self._nodes[$0.packageID] }) } diff --git a/Sources/apk/Index/ApkIndexRequirementRef.swift b/Sources/apk/Index/ApkIndexRequirementRef.swift index b1d2cad..b8e2144 100644 --- a/Sources/apk/Index/ApkIndexRequirementRef.swift +++ b/Sources/apk/Index/ApkIndexRequirementRef.swift @@ -24,7 +24,7 @@ struct ApkIndexRequirementRef { } func normalize() -> ApkIndexRequirementRef { - .init(self._graph!, id: self.packageID, constraint: .dep(version: .any)) + .init(self._graph!, id: self.packageID, constraint: .dep(version: .any())) } } diff --git a/Sources/apk/Version/ApkVersionSpecification.swift b/Sources/apk/Version/ApkVersionSpecification.swift index afa6324..eae3b55 100644 --- a/Sources/apk/Version/ApkVersionSpecification.swift +++ b/Sources/apk/Version/ApkVersionSpecification.swift @@ -21,6 +21,17 @@ extension ApkVersionSpecification { } } +internal extension ApkVersionSpecification { + @inlinable var conflict: Bool { + switch self { + case .any(invert: true), .constraint(invert: true, _, _): + return true + default: + return false + } + } +} + extension ApkVersionSpecification.Operator: CustomStringConvertible { var description: String { switch self {