|
| 1 | +/// Test that an @_exported import is preferred to local non-public imports. |
| 2 | +// RUN: %empty-directory(%t) |
| 3 | +// RUN: split-file --leading-lines %s %t |
| 4 | + |
| 5 | +/// Build the libraries. |
| 6 | +// RUN: %target-swift-frontend -emit-module %t/TargetLib.swift -o %t |
| 7 | +// RUN: %target-swift-frontend -emit-module %t/IndirectLib.swift -I %t -o %t |
| 8 | + |
| 9 | +/// Check acceptable client configurations to access TargetLib publicly. |
| 10 | +// RUN: %target-swift-frontend -typecheck -verify -I %t \ |
| 11 | +// RUN: %t/Client_ImportDirect.swift |
| 12 | +// RUN: %target-swift-frontend -typecheck -verify -I %t \ |
| 13 | +// RUN: %t/Client_ImportDirect.swift %t/Client_FileReexport.swift |
| 14 | +// RUN: %target-swift-frontend -typecheck -verify -I %t \ |
| 15 | +// RUN: %t/Client_ImportDirectAsPrivate.swift %t/Client_FileReexport.swift |
| 16 | +// RUN: %target-swift-frontend -typecheck -verify -I %t \ |
| 17 | +// RUN: %t/Client_ImportIndirectModule.swift |
| 18 | +// RUN: %target-swift-frontend -typecheck -verify -I %t \ |
| 19 | +// RUN: %t/Client_ImportIndirectModule.swift %t/Client_FileReexport.swift |
| 20 | +// RUN: %target-swift-frontend -typecheck -verify -I %t \ |
| 21 | +// RUN: %t/Client_ImportIndirectModuleAsPrivate.swift %t/Client_FileReexport.swift |
| 22 | +// RUN: %target-swift-frontend -typecheck -verify -I %t \ |
| 23 | +// RUN: %t/Client_ImportIndirectLocal.swift %t/Client_FileReexport.swift |
| 24 | + |
| 25 | +//--- TargetLib.swift |
| 26 | +public struct TargetType { |
| 27 | + public init() {} |
| 28 | +} |
| 29 | + |
| 30 | +//--- IndirectLib.swift |
| 31 | +@_exported import TargetLib |
| 32 | + |
| 33 | +//--- Client_FileReexport.swift |
| 34 | +@_exported public import TargetLib |
| 35 | + |
| 36 | +//--- Client_ImportDirect.swift |
| 37 | +public import TargetLib |
| 38 | +public func user(t: TargetType) {} |
| 39 | + |
| 40 | +//--- Client_ImportDirectAsPrivate.swift |
| 41 | +fileprivate import TargetLib |
| 42 | +public func user(t: TargetType) {} |
| 43 | +// Unrestricted as it's @_exported elsewhere in the module |
| 44 | + |
| 45 | +//--- Client_ImportIndirectModule.swift |
| 46 | +public import IndirectLib |
| 47 | +public func user(t: TargetType) {} |
| 48 | + |
| 49 | +//--- Client_ImportIndirectModuleAsPrivate.swift |
| 50 | +fileprivate import IndirectLib |
| 51 | +public func user(t: TargetType) {} |
| 52 | +// Unrestricted as it's @_exported elsewhere in the module |
| 53 | + |
| 54 | +//--- Client_ImportIndirectLocal.swift |
| 55 | +public func user(t: TargetType) {} |
0 commit comments