mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This makes sure that when Swift is generating a `.swiftinterface` file for a Swift module with a dependency on C++ module, `-enable-experimental-cxx-interop` is emitted under `// swift-module-flags:`. The module interface might refer to C++ symbols which are not available in Swift without C++ interop enabled. This caused a build error for Swift LLVM bindings during `verify-module-interface` stage: Swift tried to import the module interface and couldn't find C++ stdlib headers because C++ interop was disabled.
25 lines
876 B
Swift
25 lines
876 B
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: cd %t
|
|
// RUN: %target-build-swift -I %S/Inputs -Xfrontend -enable-experimental-cxx-interop %S/Inputs/namespace-extension-lib.swift -emit-module -emit-library -static -module-name NamespaceExtensionLib
|
|
// RUN: %target-build-swift %s -I %S/Inputs -Xfrontend -enable-experimental-cxx-interop -o %t/run -I %t/ -L %t/ -lNamespaceExtensionLib
|
|
// RUN: %target-codesign %t/run
|
|
// RUN: %target-run %t/run
|
|
//
|
|
// REQUIRES: executable_test
|
|
// XFAIL: OS=windows-msvc
|
|
|
|
import StdlibUnittest
|
|
import Namespaces
|
|
import NamespaceExtensionLib
|
|
|
|
var NamespacesTestSuite = TestSuite("Extension in library on namespace")
|
|
|
|
NamespacesTestSuite.test("Call functions from extension") {
|
|
expectEqual(Namespace.Parent.test(), 42)
|
|
expectEqual(Namespace.Parent.Child.test(), 52)
|
|
expectEqual(Namespace.NestedNamespace.NestedStruct().test(), 62)
|
|
}
|
|
|
|
runAllTests()
|
|
|