Skip to content

Commit 1b123c7

Browse files
committed
fix: when compiling code for the debugger, set is_result_unused to true
1 parent 1a1594f commit 1b123c7

29 files changed

+30
-22
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
## [Unreleased changes] - 2026-MM-DD
44
### Breaking changes
55

6+
### Deprecations
7+
- `list:permutations` is deprecated in favor of `list:combinations`
8+
- `list:permutationsWithReplacement` is deprecated in favor of `list:combinationsWithReplacement`
9+
610
### Added
711
- new debugger commands: `stack <n>` and `locals <n>` to print the values on the stack and in the current locals scope
812
- custom format specifiers for lists:

src/arkreactor/Compiler/Lowerer/ASTLowerer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ namespace Ark::internal
3838
compileExpression(
3939
ast,
4040
/* current_page */ global,
41-
/* is_result_unused */ false,
42-
/* is_terminal */ false);
41+
/* is_result_unused= */ true,
42+
/* is_terminal= */ false);
4343
m_logger.traceEnd();
4444
}
4545

tests/unittests/Suites/BytecodeReaderSuite.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ ut::suite<"BytecodeReader"> bcr_suite = [] {
121121
should("list all code page") = [inst_locations_block, pages, start_code] {
122122
expect(that % start_code == inst_locations_block.end);
123123
expect(that % pages.size() == 2ull);
124-
expect(that % pages[0].size() == 9 * 4ull);
124+
expect(that % pages[0].size() == 10 * 4ull);
125125
expect(that % pages[1].size() == 20 * 4ull);
126126
};
127127
};

tests/unittests/Suites/DiagnosticsSuite.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ ut::suite<"Diagnostics"> diagnostics_suite = [] {
3838
"DiagnosticsSuite/runtime",
3939
[](TestData&& data) {
4040
Ark::State state({ lib_path });
41+
// custom output stream for warnings to hide them, we don't want to test them here
42+
std::stringstream stream;
4143

4244
should("compile without error runtime/" + data.stem) = [&] {
43-
expect(mut(state).doFile(data.path, features));
45+
expect(mut(state).doFile(data.path, features, &stream));
4446
};
4547

4648
should("generate an error at runtime in " + data.stem) = [&] {
@@ -64,9 +66,11 @@ ut::suite<"Diagnostics"> diagnostics_suite = [] {
6466
"DiagnosticsSuite/typeChecking",
6567
[](TestData&& data) {
6668
Ark::State state({ lib_path });
69+
// custom output stream for warnings to hide them, we don't want to test them here
70+
std::stringstream stream;
6771

6872
should("compile without error typeChecking/" + data.stem) = [&] {
69-
expect(mut(state).doFile(data.path, features));
73+
expect(mut(state).doFile(data.path, features, &stream));
7074
};
7175

7276
should("generate an error at runtime (typeChecking) in " + data.stem) = [&] {

tests/unittests/resources/CompilerSuite/ir/ackermann.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ page_0
1212
BUILTIN 9
1313
CALL 2
1414
.L5:
15+
POP 0
1516
HALT 0
1617

1718
page_1

tests/unittests/resources/CompilerSuite/ir/args_attr.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ page_0
1616
BUILTIN 9
1717
CALL 1
1818
.L0:
19+
POP 0
1920
HALT 0
2021

2122
page_1

tests/unittests/resources/CompilerSuite/ir/breakpoints.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ page_0
5050
LOAD_FAST_BY_INDEX 0
5151
CALL 0
5252
.L9:
53+
POP 0
5354
HALT 0
5455

5556
page_1

tests/unittests/resources/CompilerSuite/ir/closures.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ page_0
9191
BUILTIN 9
9292
CALL 2
9393
.L12:
94+
POP 0
9495
HALT 0
9596

9697
page_1

tests/unittests/resources/CompilerSuite/ir/factorial.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ page_0
1111
BUILTIN 9
1212
CALL 2
1313
.L2:
14+
POP 0
1415
HALT 0
1516

1617
page_1

tests/unittests/resources/CompilerSuite/ir/operators.expected

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,5 @@ page_0
6969
BUILTIN 9
7070
CALL 22
7171
.L0:
72-
HALT 0
72+
POP 0
73+
HALT 0

0 commit comments

Comments
 (0)