Files
swift-mirror/test/Concurrency/predates_concurrency_import_emitmodule.swift
Doug Gregor f88abdedd2 Don't emit @preconcurrency import remarks when we're skipping function bodies
This eliminates spurious warnings suggesting that folks remove
`@preconcurrency` from imports that occur during `-emit-module` phases,
because we're skipping function bodies and, therefore, the code that
would depend on the `@preconcurrency` import.

Fixes https://github.com/apple/swift/issues/58183 / rdar://89940926.
2022-07-05 12:42:58 -07:00

29 lines
1.1 KiB
Swift

// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/StrictModule.swiftmodule -module-name StrictModule -swift-version 6 %S/Inputs/StrictModule.swift
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/NonStrictModule.swiftmodule -module-name NonStrictModule %S/Inputs/NonStrictModule.swift
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/OtherActors.swiftmodule -module-name OtherActors %S/Inputs/OtherActors.swift -disable-availability-checking
// RUN: %target-swift-frontend -emit-module -I %t -verify -primary-file %s -emit-module-path %t/predates_concurrency_import_swiftmodule.swiftmodule -experimental-skip-all-function-bodies
// REQUIRES: concurrency
// REQUIRES: asserts
@preconcurrency import NonStrictModule
@preconcurrency import StrictModule
@preconcurrency import OtherActors
// expected-no-warning
func acceptSendable<T: Sendable>(_: T) { }
@available(SwiftStdlib 5.1, *)
func test(
ss: StrictStruct, ns: NonStrictClass, oma: OtherModuleActor,
ssc: SomeSendableClass
) async {
acceptSendable(ss)
acceptSendable(ns)
acceptSendable(oma)
acceptSendable(ssc)
}