Skip to content

Fix warnings #2354

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

Merged
merged 1 commit into from
Sep 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions Sources/PackageGraph/Pubgrub.swift
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,7 @@ public struct Incompatibility: Equatable, Hashable {
// Remove the root package from generated incompatibilities, since it will
// always be selected.
var terms = terms
if terms.count > 1,
case .conflict(conflict: _, other: _) = cause,
if terms.count > 1, cause.isConflict,
terms.contains(where: { $0.isPositive && $0.package == root }) {
terms = OrderedSet(terms.filter { !$0.isPositive || $0.package != root })
}
Expand Down Expand Up @@ -262,6 +261,11 @@ extension Incompatibility {
/// └────────────┘
/// ```
indirect enum Cause: Equatable, Hashable {
struct ConflictCause: Hashable {
let conflict: Incompatibility
let other: Incompatibility
}

/// The root incompatibility.
case root

Expand All @@ -271,7 +275,7 @@ extension Incompatibility {

/// The incompatibility was derived from two others during conflict
/// resolution.
case conflict(conflict: Incompatibility, other: Incompatibility)
case conflict(cause: ConflictCause)

/// There exists no version to fulfill the specified requirement.
case noAvailableVersion
Expand Down Expand Up @@ -1104,7 +1108,7 @@ public final class PubgrubDependencyResolver {
incompatibility = Incompatibility(
OrderedSet(newTerms),
root: root!,
cause: .conflict(conflict: incompatibility, other: priorCause))
cause: .conflict(cause: .init(conflict: incompatibility, other: priorCause)))
createdIncompatibility = true

log("CR: \(mostRecentTerm?.description ?? "") is\(difference != nil ? " partially" : "") satisfied by \(_mostRecentSatisfier)")
Expand Down Expand Up @@ -1193,9 +1197,9 @@ private final class DiagnosticReportBuilder {
/// Populate `derivations`.
func countDerivations(_ i: Incompatibility) {
derivations[i, default: 0] += 1
if case .conflict(let lhs, let rhs) = i.cause {
countDerivations(lhs)
countDerivations(rhs)
if case .conflict(let cause) = i.cause {
countDerivations(cause.conflict)
countDerivations(cause.other)
}
}

Expand Down
8 changes: 4 additions & 4 deletions Sources/PackageLoading/ModuleMapGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public struct ModuleMapGenerator {
extension ModuleMapGenerator.ModuleMapError: CustomStringConvertible {
public var description: String {
switch self {
case .unsupportedIncludeLayoutForModule(let (name, problem)):
case .unsupportedIncludeLayoutForModule(let name, let problem):
return "target '\(name)' failed modulemap generation; \(problem)"
}
}
Expand All @@ -192,15 +192,15 @@ extension ModuleMapGenerator.ModuleMapError: CustomStringConvertible {
extension ModuleMapGenerator.ModuleMapError.UnsupportedIncludeLayoutType: CustomStringConvertible {
public var description: String {
switch self {
case .umbrellaHeaderWithAdditionalNonEmptyDirectories(let (umbrella, dirs)):
case .umbrellaHeaderWithAdditionalNonEmptyDirectories(let umbrella, let dirs):
return "umbrella header defined at '\(umbrella)', but directories exist: " +
dirs.map({ $0.description }).sorted().joined(separator: ", ") +
"; consider removing them"
case .umbrellaHeaderWithAdditionalDirectoriesInIncludeDirectory(let (umbrella, dirs)):
case .umbrellaHeaderWithAdditionalDirectoriesInIncludeDirectory(let umbrella, let dirs):
return "umbrella header defined at '\(umbrella)', but more than one directories exist: " +
dirs.map({ $0.description }).sorted().joined(separator: ", ") +
"; consider reducing them to one"
case .umbrellaHeaderWithAdditionalFilesInIncludeDirectory(let (umbrella, files)):
case .umbrellaHeaderWithAdditionalFilesInIncludeDirectory(let umbrella, let files):
return "umbrella header defined at '\(umbrella)', but files exist:" +
files.map({ $0.description }).sorted().joined(separator: ", ") +
"; consider removing them"
Expand Down
2 changes: 1 addition & 1 deletion Sources/TSCUtility/PkgConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ struct PkgConfigParser {
variables["pcfiledir"] = pcFile.parentDirectory.pathString

// Add pc_sysrootdir variable. This is the path of the sysroot directory for pc files.
variables["pc_sysrootdir"] = Process.env["PKG_CONFIG_SYSROOT_DIR"] ?? "/"
variables["pc_sysrootdir"] = ProcessEnv.vars["PKG_CONFIG_SYSROOT_DIR"] ?? "/"

let fileContents = try fileSystem.readFileContents(pcFile)
// FIXME: Should we error out instead if content is not UTF8 representable?
Expand Down
2 changes: 1 addition & 1 deletion Tests/PackageLoadingTests/PD5LoadingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class PackageDescription5LoadingTests: XCTestCase {
) {
do {
try loadManifestThrowing(contents, line: line, body: body)
} catch ManifestParseError.invalidManifestFormat(let error) {
} catch ManifestParseError.invalidManifestFormat(let error, _) {
print(error)
XCTFail(file: #file, line: line)
} catch {
Expand Down