Skip to content

Commit 43f757f

Browse files
committed
Clean up & add test
1 parent 52dfb1a commit 43f757f

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

lib/ClangImporter/ImportDecl.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3651,16 +3651,6 @@ namespace {
36513651
}
36523652
}
36533653

3654-
//
3655-
// for (auto &cxxMethod : Impl.cxxMethods) {
3656-
// for (auto &mutFuncPtr : cxxMethod.getSecond().second) {
3657-
// Decl *member =
3658-
// Impl.importDecl(mutFuncPtr->getUnderlyingDecl(),
3659-
// getActiveSwiftVersion());
3660-
// if(member)
3661-
// result->addMemberToLookupTable(member);
3662-
// }
3663-
// }
36643654
result->setMemberLoader(&Impl, 0);
36653655
return result;
36663656
}

test/Interop/Cxx/class/method/ambiguous-methods.swift

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,37 @@ import AmbiguousMethods
88

99
var CxxAmbiguousMethodTestSuite = TestSuite("CxxAmbiguousMethods")
1010

11+
// It's important to check that both calling the const version first
12+
// and the mutable version first pass. This helps confirm that the lookup
13+
// table is being properly seeded.
14+
CxxAmbiguousMethodTestSuite.test("ping const first") {
15+
var instance = HasAmbiguousMethods()
16+
17+
instance.ping()
18+
instance.pingMutable()
19+
expectEqual(1, instance.numberOfMutableMethodsCalled())
20+
}
21+
22+
CxxAmbiguousMethodTestSuite.test("ping mutable first") {
23+
var instance = HasAmbiguousMethods()
24+
25+
instance.pingMutable()
26+
instance.ping()
27+
expectEqual(1, instance.numberOfMutableMethodsCalled())
28+
}
29+
1130
CxxAmbiguousMethodTestSuite.test("numberOfMutableMethodsCalled: () -> Int") {
1231
var instance = HasAmbiguousMethods()
1332

1433
// Sanity check. Make sure we start at 0
34+
// and that calling numberOfMutableMethodsCalled doesn't change
35+
// the count
1536
expectEqual(0, instance.numberOfMutableMethodsCalled())
16-
17-
// Make sure calling numberOfMutableMethodsCalled above didn't
18-
// change the count
1937
expectEqual(0, instance.numberOfMutableMethodsCalled())
2038

2139
// Check that mutable version _does_ change the mutable call count
40+
expectEqual(0, instance.numberOfMutableMethodsCalled())
2241
expectEqual(1, instance.numberOfMutableMethodsCalledMutating())
23-
24-
expectEqual(1, instance.numberOfMutableMethodsCalled())
2542
}
2643

2744
CxxAmbiguousMethodTestSuite.test("Basic Increment: (Int) -> Int") {

0 commit comments

Comments
 (0)