Files
swift-mirror/test/Concurrency/concurrency_module_shadowing.swift
Becca Royal-Gordon 3abbfaa9cb Introduce separately-imported stdlib overlays
The `_Concurrency` and `_StringProcessing` modules are implementation details of the standard library; to developers, their contents should behave as though they are declared directly within module `Swift`. This is the exact same behavior we expect of cross-import overlays, so treat these modules as though they are cross-import overlays with no bystanding module.

Because these modules don’t re-export the standard library, it’s also necessary to treat `Swift` as a separately imported overlay of itself; do so and make that actually work.
2025-10-02 12:05:12 -07:00

25 lines
956 B
Swift

// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/ShadowsConcur.swiftmodule -module-name ShadowsConcur %S/Inputs/ShadowsConcur.swift
// RUN: %target-swift-frontend -I %t -disable-availability-checking %s -emit-sil -o /dev/null -verify
// RUN: %target-swift-frontend -I %t -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=targeted
// RUN: %target-swift-frontend -I %t -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=complete
// REQUIRES: concurrency
import ShadowsConcur
@available(SwiftStdlib 5.1, *)
func f(_ t : UnsafeCurrentTask) -> Bool {
return t.someProperty == "123"
}
@available(SwiftStdlib 5.1, *)
func g(_: _Concurrency.UnsafeCurrentTask) {}
// Should also be allowed since _Concurrency is a separately-imported overlay of
// the standard library.
@available(SwiftStdlib 5.1, *)
func h(_: Swift.UnsafeCurrentTask) {}