mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
When a module has been imported `@preconcurrency` in source, when it is printed in a `swiftinterface` file it should be printed along with the attribute to ensure that type checking of the module's public declarations behaves consistently. This fix is a little unsatisfying because it adds another a linear scan over all imports in the source for each printed import. This should be improved, but it can be done later. Resolves rdar://136857313.
38 lines
1.4 KiB
Swift
38 lines
1.4 KiB
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: split-file %s %t
|
|
|
|
// RUN: %target-swift-frontend -emit-module %t/PreconcurrencyLib.swift -module-name PreconcurrencyLib -swift-version 5 -enable-library-evolution -emit-module-path %t/PreconcurrencyLib.swiftmodule -emit-module-interface-path %t/PreconcurrencyLib.swiftinterface
|
|
// RUN: %target-swift-frontend -emit-module %t/OtherLib.swift -module-name OtherLib -swift-version 5 -enable-library-evolution -emit-module-path %t/OtherLib.swiftmodule -emit-module-interface-path %t/OtherLib.swiftinterface
|
|
|
|
// RUN: %target-swift-emit-module-interface(%t/ClientLib.swiftinterface) -swift-version 6 %t/ClientLib_file1.swift %t/ClientLib_file2.swift -module-name ClientLib -I %t
|
|
// RUN: %target-swift-typecheck-module-from-interface(%t/ClientLib.swiftinterface) -module-name ClientLib -I %t
|
|
// RUN: %FileCheck %s < %t/ClientLib.swiftinterface
|
|
|
|
// CHECK: {{^}}@preconcurrency import OtherLib
|
|
// CHECK: {{^}}@preconcurrency import PreconcurrencyLib
|
|
// CHECK: public struct Struct1 : Swift.Sendable
|
|
// CHECK: public struct Struct2
|
|
|
|
//--- PreconcurrencyLib.swift
|
|
|
|
public class C {}
|
|
|
|
//--- OtherLib.swift
|
|
// Intentionally empty
|
|
|
|
//--- ClientLib_file1.swift
|
|
|
|
@preconcurrency public import PreconcurrencyLib
|
|
public import OtherLib
|
|
|
|
public struct Struct1: Sendable {
|
|
public var c: C
|
|
}
|
|
|
|
//--- ClientLib_file2.swift
|
|
|
|
internal import PreconcurrencyLib
|
|
@preconcurrency internal import OtherLib
|
|
|
|
public struct Struct2 {}
|