Skip to content

Commit 9cdd3fa

Browse files
authored
Merge pull request #2156 from augusto2112/test-protocol-default-extension-no-self-reference
[lldb] Add test to check that we can resolve self even if there are no references to it in a dynamic context
2 parents 41be35f + bf1d456 commit 9cdd3fa

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SWIFT_SOURCES := main.swift
2+
include Makefile.rules
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""
2+
Test that we can resolve "self" even if there are no references to it in a dynamic context
3+
"""
4+
5+
from lldbsuite.test.lldbtest import *
6+
from lldbsuite.test.decorators import *
7+
8+
9+
class TestDefaultProtocolExtensionNoSelfReference(TestBase):
10+
mydir = TestBase.compute_mydir(__file__)
11+
12+
def setUp(self):
13+
TestBase.setUp(self)
14+
15+
@swiftTest
16+
def test_protocol_default_extension_no_self_reference(self):
17+
"""
18+
Test that we can resolve "self" even if there are no references to it in a dynamic context
19+
"""
20+
self.build()
21+
22+
lldbutil.run_to_source_breakpoint(self, 'break here', lldb.SBFileSpec('main.swift'))
23+
self.expect('e -d no-run-target -- self', substrs=["(a.C) $R0 = 0x"])
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class C : Foo {
2+
}
3+
4+
protocol Foo: class {
5+
func foo()
6+
}
7+
8+
extension Foo {
9+
func foo() {
10+
print(777) // break here
11+
}
12+
}
13+
14+
let c = C()
15+
c.foo()

0 commit comments

Comments
 (0)