Files
swift-mirror/test/Interop/Cxx/namespace/free-functions-module-interface.swift
Egor Zhdan cfc9483f1a C++ Interop: import namespaces redecls as separate extensions
Previously a namespace declaration was imported along with all of its redeclarations, and their members were added to a single Swift extension. This was problematic when a single namespace is declared in multiple modules – the extension belonged to only one of them.
For an example of this, try printing a module interface for `std.string`/`std.iosfwd` – it will be empty, even though the declarations from those modules are actually imported into Swift correctly.

This change makes sure that when we're importing different redeclarations of the same namespace, we're adding them as separate extensions to appropriate modules.
2021-07-23 23:38:46 +03:00

41 lines
1.4 KiB
Swift

// RUN: %target-swift-ide-test -print-module -module-to-print=FreeFunctions -I %S/Inputs -source-filename=x -enable-cxx-interop | %FileCheck %s
// CHECK-NOT: extension
// CHECK: extension FunctionsNS1 {
// CHECK: static func basicFunctionTopLevel() -> UnsafePointer<CChar>!
// CHECK: static func definedOutOfLine() -> UnsafePointer<CChar>!
// CHECK: static func forwardDeclared() -> UnsafePointer<CChar>!
// CHECK: }
// CHECK-NOT: extension
// CHECK: extension FunctionsNS1.FunctionsNS2 {
// CHECK: static func basicFunctionSecondLevel() -> UnsafePointer<CChar>!
// CHECK: }
// CHECK-NOT: extension
// CHECK: extension FunctionsNS1.FunctionsNS2.FunctionsNS3 {
// CHECK: static func basicFunctionLowestLevel() -> UnsafePointer<CChar>!
// CHECK: }
// CHECK-NOT: extension
// CHECK: extension FunctionsNS1 {
// CHECK: static func definedInDefs() -> UnsafePointer<CChar>!
// CHECK: }
// CHECK-NOT: extension
// CHECK: extension FunctionsNS1 {
// CHECK: static func sameNameInChild() -> UnsafePointer<CChar>!
// CHECK: static func sameNameInSibling() -> UnsafePointer<CChar>!
// CHECK: }
// CHECK-NOT: extension
// CHECK: extension FunctionsNS1.FunctionsNS2 {
// CHECK: static func sameNameInChild() -> UnsafePointer<CChar>!
// CHECK: }
// CHECK-NOT: extension
// CHECK: extension FunctionsNS4 {
// CHECK: static func sameNameInSibling() -> UnsafePointer<CChar>!
// CHECK: }
// CHECK-NOT: extension