Skip to content

Commit b926896

Browse files
author
git apple-llvm automerger
committed
Merge commit '71b6f8f40249' from swift/release/5.9 into stable/20221013
2 parents d83ae32 + 71b6f8f commit b926896

File tree

5 files changed

+24
-1
lines changed

5 files changed

+24
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1839,6 +1839,7 @@ SwiftExpressionParser::Parse(DiagnosticManager &diagnostic_manager,
18391839
new SwiftASTManipulatorBase::VariableMetadataPersistent(
18401840
persistent_variable));
18411841

1842+
// This is only exercised by the PlaygroundsREPL tests.
18421843
persistent_state->RegisterSwiftPersistentDecl(decl);
18431844
}
18441845

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

lldb/test/API/lang/swift/expression/mutable_persistent_var/TestSwiftMutablePersistentVar.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@
44
import lldbsuite.test.lldbutil as lldbutil
55

66

7-
class TestCase(TestBase):
7+
class TestSwiftMutablePersistentVar(TestBase):
8+
NO_DEBUG_INFO_TESTCASE = True
89
@swiftTest
910
def test(self):
1011
"""Test that persistent variables are mutable."""
1112
self.build()
1213
lldbutil.run_to_name_breakpoint(self, "main")
1314
self.expect("expr var $count = 30")
1415
self.expect("expr $count = 41")
16+
self.expect("expr $count += 1")
17+
self.expect("expr $count", substrs=["42"])

0 commit comments

Comments
 (0)