mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[ModuleInterface] Support aliasing a module loaded from a swiftinterface
This commit is contained in:
@@ -1027,9 +1027,10 @@ class ModuleInterfaceLoaderImpl {
|
||||
}
|
||||
// Set up a builder if we need to build the module. It'll also set up
|
||||
// the genericSubInvocation we'll need to use to compute the cache paths.
|
||||
Identifier realName = ctx.getRealModuleName(ctx.getIdentifier(moduleName));
|
||||
ImplicitModuleInterfaceBuilder builder(
|
||||
ctx.SourceMgr, diagsToUse,
|
||||
astDelegate, interfacePath, moduleName, cacheDir,
|
||||
astDelegate, interfacePath, realName.str(), cacheDir,
|
||||
prebuiltCacheDir, backupInterfaceDir, StringRef(),
|
||||
Opts.disableInterfaceLock,
|
||||
ctx.IgnoreAdjacentModules, diagnosticLoc,
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/// Check that we can alias a module imported from a swiftinterface
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: split-file %s %t
|
||||
|
||||
// RUN: %target-swift-frontend -emit-module -module-name Lib \
|
||||
// RUN: -swift-version 5 -enable-library-evolution \
|
||||
// RUN: -o %t/Lib.swiftmodule \
|
||||
// RUN: -emit-module-interface-path %t/Lib.swiftinterface \
|
||||
// RUN: %t/Lib.swift
|
||||
|
||||
/// We can alias an imported module built from a swiftmodule
|
||||
// RUN: %target-swift-frontend -typecheck -module-name Client \
|
||||
// RUN: -swift-version 5 \
|
||||
// RUN: -module-alias AliasedLib=Lib \
|
||||
// RUN: %t/Client.swift -I%t
|
||||
|
||||
/// We can alias an imported module built from a swiftinterface
|
||||
// RUN: rm %t/Lib.swiftmodule
|
||||
// RUN: %target-swift-frontend -typecheck -module-name Client \
|
||||
// RUN: -swift-version 5 \
|
||||
// RUN: -module-alias AliasedLib=Lib \
|
||||
// RUN: %t/Client.swift -I%t
|
||||
|
||||
//--- Lib.swift
|
||||
public func foo() {}
|
||||
|
||||
//--- Client.swift
|
||||
import AliasedLib
|
||||
|
||||
func main() {
|
||||
AliasedLib.foo()
|
||||
}
|
||||
Reference in New Issue
Block a user