Skip to content

Fix @preconcurrency import Android in CocoaError+FilePath.swift #1281

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
May 3, 2025

Conversation

marcprux
Copy link
Contributor

@marcprux marcprux commented May 3, 2025

This fixes the Android build error that I noted at #1280 (comment):

/home/runner/work/swift-package-builds/swift-package-builds/swift-foundation/Sources/FoundationEssentials/Error/CocoaError+FilePath.swift:76:37: error: initializer 'init(rawValue:)' is not available due to missing import of defining module 'Android'
 18 | #elseif canImport(Bionic)
 19 | @preconcurrency import Bionic
 20 | #elseif canImport(Glibc)
    | `- note: add import of module 'Android'
 21 | @preconcurrency import Glibc
 22 | #elseif canImport(Musl)
    :
 74 |         // (130280235) POSIXError.Code does not have a case for EOPNOTSUPP
 75 |         guard errno != EOPNOTSUPP else { return nil }
 76 |         guard let code = POSIXError.Code(rawValue: errno) else {
    |                                     `- error: initializer 'init(rawValue:)' is not available due to missing import of defining module 'Android'
 77 |             fatalError("Invalid posix errno \(errno)")
 78 |         }

@finagolfin
Copy link
Member

Makes sense, as I've noted weird import issues with these platform overlays before and turning on the MemberImportVisibility feature has required changing the imports like this before, as that feature closes up a well-known Swift import leak.

@marcprux
Copy link
Contributor Author

marcprux commented May 3, 2025

Do you think we should just change the remaining 14 instances of import Bionic to import Android? Or best to leave them alone until they cause problems?

@finagolfin
Copy link
Member

Ideally, we'd audit all 14 and see what file invokes which APIs and check if they're currently correct, but I'm not too happy with the Bionic module we have now, as it only covers a fraction of the Bionic headers.

The current overlays are just what we could get to work, given the opacity of what's included and the various import leaks. It will all need to be properly organized and separated out in time.

Given all that, I don't have a good answer: leave it alone and we'll figure it out later?

@finagolfin
Copy link
Member

@swift-ci test

@finagolfin finagolfin merged commit bd7483e into swiftlang:main May 3, 2025
15 checks passed
marcprux added a commit to swift-everywhere/swift-package-builds that referenced this pull request May 3, 2025
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.

2 participants