Skip to content

Commit 68fea29

Browse files
committed
Rename an enum value to be less confusing (there were two cases of the same names in different scopes).
1 parent 6f9389e commit 68fea29

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Sources/PackageLoading/PackageBuilder.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public enum ModuleError: Swift.Error {
2626
/// Describes a way in which a package layout is invalid.
2727
public enum InvalidLayoutType {
2828
case multipleSourceRoots([String])
29-
case invalidLayout([String])
29+
case unexpectedSourceFiles([String])
3030
}
3131

3232
/// A module was marked as being dependent on an executable.
@@ -62,7 +62,7 @@ extension ModuleError.InvalidLayoutType: FixableError {
6262
switch self {
6363
case .multipleSourceRoots(let paths):
6464
return "multiple source roots found: " + paths.sorted().joined(separator: ", ")
65-
case .invalidLayout(let paths):
65+
case .unexpectedSourceFiles(let paths):
6666
return "unexpected source file(s) found: " + paths.sorted().joined(separator: ", ")
6767
}
6868
}
@@ -71,7 +71,7 @@ extension ModuleError.InvalidLayoutType: FixableError {
7171
switch self {
7272
case .multipleSourceRoots(_):
7373
return "remove the extra source roots, or add them to the source root exclude list"
74-
case .invalidLayout(_):
74+
case .unexpectedSourceFiles(_):
7575
return "move the file(s) inside a module"
7676
}
7777
}
@@ -354,7 +354,7 @@ public struct PackageBuilder {
354354
if srcDir != packagePath {
355355
let invalidRootFiles = try directoryContents(packagePath).filter(isValidSource)
356356
guard invalidRootFiles.isEmpty else {
357-
throw ModuleError.invalidLayout(.invalidLayout(invalidRootFiles.map{ $0.asString }))
357+
throw ModuleError.invalidLayout(.unexpectedSourceFiles(invalidRootFiles.map{ $0.asString }))
358358
}
359359
}
360360

@@ -365,7 +365,7 @@ public struct PackageBuilder {
365365
if potentialModulePaths.count == 1 && potentialModulePaths[0] != srcDir {
366366
let invalidModuleFiles = try directoryContents(srcDir).filter(isValidSource)
367367
guard invalidModuleFiles.isEmpty else {
368-
throw ModuleError.invalidLayout(.invalidLayout(invalidModuleFiles.map{ $0.asString }))
368+
throw ModuleError.invalidLayout(.unexpectedSourceFiles(invalidModuleFiles.map{ $0.asString }))
369369
}
370370
}
371371

0 commit comments

Comments
 (0)