mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Explanation: C++ interop synthesizes certain forwarding functions in an _ObjC module. This confuses MemberImportVisibility. This patch adds logic to work this around by keeping a mapping between the synthesized and the original function and looks up where the synthesized functions belong to based on the original functions' parent module. Scope: C++ forward interop when MemberImportVisibility is enabled. Issues: rdar://154887575 Original PRs: #82840 Risk: Low, a narrow change makes getModuleContextForNameLookupForCxxDecl more precise, and it is only used with MemberImportVisibility. Testing: Added a compiler test. Reviewers: @egorzhdan, @tshortli, @hnrklssn
23 lines
567 B
Swift
23 lines
567 B
Swift
// RUN: %target-run-simple-swift(-I %S/Inputs/ -Xfrontend -cxx-interoperability-mode=default -enable-upcoming-feature MemberImportVisibility)
|
|
//
|
|
// REQUIRES: executable_test
|
|
// REQUIRES: swift_feature_MemberImportVisibility
|
|
|
|
import InheritedLookup
|
|
import StdlibUnittest
|
|
|
|
var InheritedMemberTestSuite = TestSuite("Test if inherited lookup works")
|
|
|
|
extension Bar.Derived {
|
|
public func callBase() {
|
|
let _ = baseMethod()
|
|
}
|
|
}
|
|
|
|
InheritedMemberTestSuite.test("Look up base methods from extensions") {
|
|
let a = Bar.Derived()
|
|
a.callBase()
|
|
}
|
|
|
|
runAllTests()
|