Skip to content

[lldb] Add test to check that we can resolve self even if there are no references to it in a dynamic context #2156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SWIFT_SOURCES := main.swift
include Makefile.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""
Test that we can resolve "self" even if there are no references to it in a dynamic context
"""

from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *


class TestDefaultProtocolExtensionNoSelfReference(TestBase):
mydir = TestBase.compute_mydir(__file__)

def setUp(self):
TestBase.setUp(self)

@swiftTest
def test_protocol_default_extension_no_self_reference(self):
"""
Test that we can resolve "self" even if there are no references to it in a dynamic context
"""
self.build()

lldbutil.run_to_source_breakpoint(self, 'break here', lldb.SBFileSpec('main.swift'))
self.expect('e -d no-run-target -- self', substrs=["(a.C) $R0 = 0x"])
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class C : Foo {
}

protocol Foo: class {
func foo()
}

extension Foo {
func foo() {
print(777) // break here
}
}

let c = C()
c.foo()