Skip to content

Commit be64343

Browse files
committed
Removed ping due to the const method being empty and therefore being optimizd out
1 parent 43f757f commit be64343

File tree

2 files changed

+10
-21
lines changed

2 files changed

+10
-21
lines changed

test/Interop/Cxx/class/method/Inputs/ambiguous_methods.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33

44
struct HasAmbiguousMethods {
55

6-
// No input
7-
void ping() { ++mutableMethodsCalledCount; }
8-
void ping() const {}
9-
106
// One input (const first)
117
int increment(int a) const {
128
return a + 1;

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

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,7 @@ var CxxAmbiguousMethodTestSuite = TestSuite("CxxAmbiguousMethods")
1111
// It's important to check that both calling the const version first
1212
// and the mutable version first pass. This helps confirm that the lookup
1313
// 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-
30-
CxxAmbiguousMethodTestSuite.test("numberOfMutableMethodsCalled: () -> Int") {
14+
CxxAmbiguousMethodTestSuite.test("[Const First] numberOfMutableMethodsCalled: () -> Int") {
3115
var instance = HasAmbiguousMethods()
3216

3317
// Sanity check. Make sure we start at 0
@@ -41,6 +25,15 @@ CxxAmbiguousMethodTestSuite.test("numberOfMutableMethodsCalled: () -> Int") {
4125
expectEqual(1, instance.numberOfMutableMethodsCalledMutating())
4226
}
4327

28+
CxxAmbiguousMethodTestSuite.test("[Mutable First] numberOfMutableMethodsCalled: () -> Int") {
29+
var instance = HasAmbiguousMethods()
30+
31+
// Call mutable first
32+
expectEqual(1, instance.numberOfMutableMethodsCalledMutating())
33+
expectEqual(1, instance.numberOfMutableMethodsCalled())
34+
35+
}
36+
4437
CxxAmbiguousMethodTestSuite.test("Basic Increment: (Int) -> Int") {
4538
var instance = HasAmbiguousMethods()
4639
var a: Int32 = 0

0 commit comments

Comments
 (0)