Files
swift-mirror/test/Interop/Cxx/modules/deep-submodule.swift
Egor Zhdan 106a6af850 [cxx-interop] Determine owning module correctly for C++ decls in nested modules
This fixes a compiler bug that got exposed by f11abac652.

If a C++ type is declared in a nested Clang submodule, Swift was emitting errors that look like:
```
Type alias 'string' is not available due to missing import of defining module 'fwd’
```

rdar://146899125
2025-03-20 19:14:46 +00:00

21 lines
839 B
Swift

// RUN: %target-typecheck-verify-swift -I %S/Inputs -cxx-interoperability-mode=default
// RUN: %target-typecheck-verify-swift -I %S/Inputs -cxx-interoperability-mode=default -enable-upcoming-feature MemberImportVisibility
// RUN: %target-typecheck-verify-swift -I %S/Inputs -cxx-interoperability-mode=default -D IMPORT_TOP_LEVEL
// RUN: %target-typecheck-verify-swift -I %S/Inputs -cxx-interoperability-mode=default -D IMPORT_ANOTHER_SUBMODULE
// REQUIRES: swift_feature_MemberImportVisibility
#if IMPORT_TOP_LEVEL
import TopLevelModule
#elseif IMPORT_ANOTHER_SUBMODULE
import TopLevelModule.SubModule.AnotherDeepSubModule
#else
import TopLevelModule.SubModule.DeepSubModule
#endif
let _: NS.MyStructInDeepSubModule! = nil
extension NS.MyStructInDeepSubModule {
public static func takesInstance(_ i: NS.MyStructInDeepSubModule) {}
}