Skip to content

Commit 977d20d

Browse files
committed
Add a test for adding new functions and types in the expression evaluator (NFC)
1 parent 1f4f6bc commit 977d20d

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

lldb/source/Plugins/ExpressionParser/Swift/SwiftExpressionParser.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1835,6 +1835,7 @@ SwiftExpressionParser::Parse(DiagnosticManager &diagnostic_manager,
18351835
new SwiftASTManipulatorBase::VariableMetadataPersistent(
18361836
persistent_variable));
18371837

1838+
// This is only exercised by the PlaygroundsREPL tests.
18381839
persistent_state->RegisterSwiftPersistentDecl(decl);
18391840
}
18401841

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
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import lldb
2+
from lldbsuite.test.decorators import *
3+
from lldbsuite.test.lldbtest import *
4+
import lldbsuite.test.lldbutil as lldbutil
5+
6+
7+
class TestSwiftFunctionDefinition(TestBase):
8+
NO_DEBUG_INFO_TESTCASE = True
9+
@swiftTest
10+
def test(self):
11+
"""Test that persistent variables are mutable."""
12+
self.build()
13+
lldbutil.run_to_name_breakpoint(self, "main")
14+
self.expect("expr struct $S { let v : Int }")
15+
self.expect("expr func $dup<T>(_ t: T) -> (T, T) { return (t, t) }")
16+
self.expect("expr $dup($S(v: 1))", substrs=["($S, $S)", "v = 1", "v = 1"])
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// does nothing

0 commit comments

Comments
 (0)