Skip to content

Conversation

@MaxDesiatov
Copy link
Contributor

LocalFileSystem doesn't contain any storage for state, it should be safely convertible to struct. For this we have to remove AnyObject requirement from the FileSystem protocol. As a nice benefit, @unchecked Sendable conformance on LocalFileSystem can be removed as it now inherits Sendable conformance from FileSystem.

`LocalFileSystem` doesn't contain any storage for state, it should be safely convertible to `struct`. For this we have to remove `AnyObject` requirement from the `FileSystem` protocol. As a nice benefit, `@unchecked Sendable` conformance on `LocalFileSystem` can be removed as it now inherits `Sendable` conformance from `FileSystem`.
@MaxDesiatov
Copy link
Contributor Author

@swift-ci test

@MaxDesiatov
Copy link
Contributor Author

Build failure due to SourceKit-LSP relying on this being a reference type and using === for an identity comparison:

SKCoreTests/ToolchainRegistryTests.swift:523:48: error: argument type 'any FileSystem' expected to be an instance of a class or class-constrained type
  precondition(!clang && !swiftc && !clangd || fs === localFileSystem || !shouldChmod,

@tomerd should we just remove that precondition there or is it better to keep it as a class and preserve that AnyObject constraint on the FileSystem protocol, effectively closing this PR?

@tomerd
Copy link
Contributor

tomerd commented Apr 19, 2023

I think testing like this for local file system is anti-pattern, this should be replaced with better logic

@MaxDesiatov
Copy link
Contributor Author

@swift-ci test

@MaxDesiatov MaxDesiatov merged commit ae57c40 into main Apr 20, 2023
@MaxDesiatov MaxDesiatov deleted the maxd/local-fs-struct branch April 20, 2023 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants