Skip to content

FileSystem: make all classes final to fix Sendable errors #406

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
Apr 15, 2023
Merged
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
10 changes: 4 additions & 6 deletions Sources/TSCBasic/FileSystem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,7 @@ public extension FileSystem {
}

/// Concrete FileSystem implementation which communicates with the local file system.
private class LocalFileSystem: FileSystem {

private final class LocalFileSystem: FileSystem {
func isExecutableFile(_ path: AbsolutePath) -> Bool {
// Our semantics doesn't consider directories.
return (self.isFile(path) || self.isSymlink(path)) && FileManager.default.isExecutableFile(atPath: path.pathString)
Expand Down Expand Up @@ -549,8 +548,7 @@ private class LocalFileSystem: FileSystem {
}

/// Concrete FileSystem implementation which simulates an empty disk.
public class InMemoryFileSystem: FileSystem {

public final class InMemoryFileSystem: FileSystem {
/// Private internal representation of a file system node.
/// Not threadsafe.
private class Node {
Expand Down Expand Up @@ -589,7 +587,7 @@ public class InMemoryFileSystem: FileSystem {

/// Private internal representation the contents of a directory.
/// Not threadsafe.
private class DirectoryContents {
private final class DirectoryContents {
var entries: [String: Node]

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

Expand Down