[ModuleInterface] Always ignore export-as in private swiftinterfaces

Always print the real module name for references in private
swiftinterfaces, ignoring export-as declarations. Keep using the
export-as name for the public swiftinterface only.

The flag `ModuleInterfaceExportAs` used to enable this behavior and
we're removing it to make it the default.

rdar://115922907
This commit is contained in:
Alexis Laferrière
2023-10-16 12:04:08 -07:00
parent 042ccdda01
commit 6f1a774e7d
5 changed files with 26 additions and 55 deletions

View File

@@ -21,7 +21,6 @@
// RUN: %target-swift-typecheck-module-from-interface(%t/Exported.swiftinterface) -I %t -module-name Exporter
/// Build lib with an @exported import of the exported one.
/// Default/old behavior.
// RUN: %target-swift-frontend -emit-module %t/Exporter.swift \
// RUN: -module-name Exporter -swift-version 5 -I %t \
// RUN: -enable-library-evolution \
@@ -31,26 +30,10 @@
// RUN: %target-swift-typecheck-module-from-interface(%t/Exporter.swiftinterface) -I %t
// RUN: %target-swift-typecheck-module-from-interface(%t/Exporter.private.swiftinterface) -module-name Exporter -I %t
// RUN: cat %t/Exporter.swiftinterface | %FileCheck -check-prefix=CHECK-USE-EXPORTER %s
// RUN: cat %t/Exporter.private.swiftinterface | %FileCheck -check-prefix=CHECK-USE-EXPORTER %s
/// Build lib with an @exported import of the exported one.
/// New behavior via flag.
// RUN: %target-swift-frontend -emit-module %t/Exporter.swift \
// RUN: -module-name Exporter -swift-version 5 -I %t \
// RUN: -enable-library-evolution \
// RUN: -emit-module-path %t/Exporter.swiftmodule \
// RUN: -emit-module-interface-path %t/Exporter.swiftinterface \
// RUN: -emit-private-module-interface-path %t/Exporter.private.swiftinterface \
// RUN: -enable-experimental-feature ModuleInterfaceExportAs
// RUN: %target-swift-typecheck-module-from-interface(%t/Exporter.swiftinterface) -I %t
// RUN: %target-swift-typecheck-module-from-interface(%t/Exporter.private.swiftinterface) -module-name Exporter -I %t
// RUN: cat %t/Exporter.swiftinterface | %FileCheck -check-prefix=CHECK-USE-EXPORTER %s
// RUN: cat %t/Exporter.private.swiftinterface | %FileCheck -check-prefix=CHECK-USE-EXPORTED %s
/// Build lib with an @exported import of the exported one.
/// New behavior via env var.
// RUN: env SWIFT_DEBUG_USE_EXPORTED_MODULE_NAME_IN_PUBLIC_ONLY=1 \
// RUN: %target-swift-frontend -emit-module %t/Exporter.swift \
// RUN: %target-swift-frontend -emit-module %t/Exporter.swift \
// RUN: -module-name Exporter -swift-version 5 -I %t \
// RUN: -enable-library-evolution \
// RUN: -emit-module-path %t/Exporter.swiftmodule \
@@ -67,22 +50,20 @@
// RUN: -enable-library-evolution \
// RUN: -emit-module-path %t/Client.swiftmodule \
// RUN: -emit-module-interface-path %t/Client.swiftinterface \
// RUN: -emit-private-module-interface-path %t/Client.private.swiftinterface \
// RUN: -enable-experimental-feature ModuleInterfaceExportAs
// RUN: -emit-private-module-interface-path %t/Client.private.swiftinterface
// RUN: %target-swift-typecheck-module-from-interface(%t/Client.swiftinterface) -I %t
// RUN: %target-swift-typecheck-module-from-interface(%t/Client.private.swiftinterface) -module-name Client -I %t
// RUN: cat %t/Client.swiftinterface | %FileCheck -check-prefix=CHECK-USE-EXPORTER %s
// RUN: cat %t/Client.private.swiftinterface | %FileCheck -check-prefix=CHECK-USE-EXPORTED %s
/// Build a client of the exporter lib.
/// Build a client of the exporter lib against the public swiftinterface.
// RUN: rm %t/Exporter.private.swiftinterface %t/Exporter.swiftmodule
// RUN: %target-swift-frontend -emit-module %t/Client.swift \
// RUN: -module-name Client -swift-version 5 -I %t \
// RUN: -enable-library-evolution \
// RUN: -emit-module-path %t/Client.swiftmodule \
// RUN: -emit-module-interface-path %t/Client.swiftinterface \
// RUN: -emit-private-module-interface-path %t/Client.private.swiftinterface \
// RUN: -enable-experimental-feature ModuleInterfaceExportAs
// RUN: -emit-private-module-interface-path %t/Client.private.swiftinterface
// RUN: %target-swift-typecheck-module-from-interface(%t/Client.swiftinterface) -I %t
// RUN: %target-swift-typecheck-module-from-interface(%t/Client.private.swiftinterface) -module-name Client -I %t
// RUN: cat %t/Client.swiftinterface | %FileCheck -check-prefix=CHECK-USE-EXPORTER %s