Skip to content

Commit 5e1f556

Browse files
authored
FileSystem: make all classes final to fix Sendable errors (#406)
These classes can't be `Sendable` if they aren't final. Somehow it didn't cause CI failures before, but had impact on Swift Driver build jobs. rdar://108040704
1 parent 8b46709 commit 5e1f556

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Sources/TSCBasic/FileSystem.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,7 @@ public extension FileSystem {
296296
}
297297

298298
/// Concrete FileSystem implementation which communicates with the local file system.
299-
private class LocalFileSystem: FileSystem {
300-
299+
private final class LocalFileSystem: FileSystem {
301300
func isExecutableFile(_ path: AbsolutePath) -> Bool {
302301
// Our semantics doesn't consider directories.
303302
return (self.isFile(path) || self.isSymlink(path)) && FileManager.default.isExecutableFile(atPath: path.pathString)
@@ -549,8 +548,7 @@ private class LocalFileSystem: FileSystem {
549548
}
550549

551550
/// Concrete FileSystem implementation which simulates an empty disk.
552-
public class InMemoryFileSystem: FileSystem {
553-
551+
public final class InMemoryFileSystem: FileSystem {
554552
/// Private internal representation of a file system node.
555553
/// Not threadsafe.
556554
private class Node {
@@ -589,7 +587,7 @@ public class InMemoryFileSystem: FileSystem {
589587

590588
/// Private internal representation the contents of a directory.
591589
/// Not threadsafe.
592-
private class DirectoryContents {
590+
private final class DirectoryContents {
593591
var entries: [String: Node]
594592

595593
init(entries: [String: Node] = [:]) {
@@ -1021,7 +1019,7 @@ extension InMemoryFileSystem: @unchecked Sendable {}
10211019
/// is designed for situations where a client is only interested in the contents
10221020
/// *visible* within a subpath and is agnostic to the actual location of those
10231021
/// contents.
1024-
public class RerootedFileSystemView: FileSystem {
1022+
public final class RerootedFileSystemView: FileSystem {
10251023
/// The underlying file system.
10261024
private var underlyingFileSystem: FileSystem
10271025

0 commit comments

Comments
 (0)