mxcl / Path.swift

Delightful, robust, cross-platform and chainable file-pathing functions.
The Unlicense
946 stars 36 forks source link

error: 'Path' is not a member type of 'Path' #55

Closed rickwierenga closed 3 years ago

rickwierenga commented 4 years ago

I'm not sure if this is my issue, but I get this error when I try to do anything with Path on Google Colab:

expression produced error: error: /tmp/expr56-6421f7..swift:1:70: error: 'Path' is not a member type of 'Path'
Swift._DebuggerSupport.stringForPrintObject(Swift.UnsafePointer<Path.Path>(bitPattern: 0x7f6d9bca1340)!.pointee)
                                                                ~~~~ ^

Path.Path:1:36: note: 'Path' declared here
@dynamicMemberLookup public struct Path : Equatable, Hashable, Comparable {

My code:

%install-location $cwd/swift-install
%install '.package(url: "https://github.com/mxcl/Path.swift", from: "0.16.1")' Path
import Path
Path("/")
// or:
Path.root
bosr commented 4 years ago

Hi @rickwierenga, did you find a workaround?

Just in case, the problem does not come from Path but from how the DebuggerSupport reflects. The following works fine:

let p = Path.home / "s4tf"
print("\(p)")

Cheers!

rickwierenga commented 4 years ago

Weird. Here is a Colab test and I can confirm your code works perfectly fine... I have no clue as to why this happens. No, I have not found a workaround yet.

only tested this on Colab

mxcl commented 4 years ago

Possibly a Swift compiler bug. The diagnostic certainly looks more fundamental than a source error.

mxcl commented 3 years ago

I added a PathStruct typealias since there is no fix or workaround with Swift 5.5 even.