-
Notifications
You must be signed in to change notification settings - Fork 2
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
Extensions on system types (like stat
or time_t
) go missing in importing module
#2
Comments
This can be reproduced with two simple packages: mkdir LibBase LibDep
cd LibBase && swift package init --type library && git init && cd ..
cd LibDep && swift package init --type library && cd .. LibBase.swift: #if os(Windows)
import WinSDK
#elseif os(Linux)
import struct Glibc.timespec
public typealias timespec = Glibc.timespec
public extension timespec {
static func demo() -> timespec { return timespec() }
}
#else // Darwin
import struct Darwin.timespec
public typealias timespec = Darwin.timespec
public extension timespec {
static func demo() -> timespec { return timespec() }
}
#endif // Darwin libdep Package.swift: // swift-tools-version:5.3
import PackageDescription
let package = Package(
name: "LibDep",
dependencies: [ .package(url: "../LibBase", .branch("master")) ],
targets: [ .target(name: "LibDep", dependencies: [ "LibBase" ]) ]
) LibDep.swift: import LibBase
func doIt() {
let x = timespec.demo()
print("X:", x)
} Compile: brew install spmdestinations/tap/spm-dest-5.3-x86_64-ubuntu16.04
swift build --destination \
/usr/local/lib/swift/dst/x86_64-unknown-linux/swift-5.3-ubuntu16.04.xtoolchain/destination.json
Zini18:LibDep helge$ swift build --destination /usr/local/lib/swift/dst/x86_64-unknown-linux/swift-5.3-ubuntu16.04.xtoolchain/destination.json
/Users/helge/Dropbox/dev/Tests/RepoXIssue/LibDep/Sources/LibDep/LibDep.swift:4:20: error: type 'timespec' has no member 'demo'
let x = timespec.demo()
~~~~~~~~ ^~~~ Doing the compilation on the host (or in Docker) works just fine. |
Call one looks good (
Seems to have the right switches on. Call two fails:
Though it does pretty much correct as well? 🤔 |
Ready to use tarball to demo the issue: https://helgehess.eu/patches/RepoXIssue-2020-08-04-1.tgz |
It's not related to the ifdef's, same error w/ this LibBase.swift: import Glibc
public typealias timespec = Glibc.timespec
public extension timespec {
static func demo() -> timespec { return timespec() }
} |
Hm, it is restricted to such libc types though, e.g. an extension to |
stat
or time_t
) go missing in importing module
Adding
gives
Looks like the Ubuntu SDK is missing the shims. |
Macro (and NIO) itself works fine, but
stat
andtimespec
extensions inxsys
andfs
do not make it through toconnect
in MacroExpress.This is declared just fine in
Macro/fs/Utils/StatStruct.swift
.The text was updated successfully, but these errors were encountered: