Skip to content

@preconcurrency makes import order significant #76842

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

Open
saagarjha opened this issue Oct 3, 2024 · 0 comments
Open

@preconcurrency makes import order significant #76842

saagarjha opened this issue Oct 3, 2024 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. concurrency Feature: umbrella label for concurrency language features triage needed This issue needs more specific labels

Comments

@saagarjha
Copy link
Contributor

Description

When using @preconcurrency the order of imports becomes significant. In particular, when importing a module with @preconcurrency, it sometimes must go first or its annotation will not take effect. I think this is because the annotation is somehow not being applied consistently to reexported modules?

Reproduction

import Foundation
@preconcurrency import Darwin

optind

Expected behavior

This should compile. Darwin is imported using @preconcurrency, which means that optind that Darwin exposes should be marked with it.

Environment

$ swiftc -version
swift-driver version: 1.115 Apple Swift version 6.0 (swiftlang-6.0.0.9.11 clang-1600.0.26.2)
Target: arm64-apple-macosx15.0

Additional information

For completeness, the following code compiles:

@preconcurrency import Darwin
import Foundation

optind

I had originally brought this up as a swift-format bug at swiftlang/swift-format#826 but @ahoppen thinks this is a compiler bug so I'm reporting it here instead.

@saagarjha saagarjha added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels Oct 3, 2024
@ktoso ktoso added the concurrency Feature: umbrella label for concurrency language features label Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. concurrency Feature: umbrella label for concurrency language features triage needed This issue needs more specific labels
Projects
None yet
Development

No branches or pull requests

2 participants