aboutsummaryrefslogtreecommitdiff
path: root/tests/icon/accept
diff options
context:
space:
mode:
authorGravatar Moon Flower <moonflower@elhenney.local> 2026-10-14 08:29:46 +0330
committerGravatar Moon Flower <moonflower@elhenney.local> 2026-10-14 08:29:46 +0330
commit1c53304d03414890af0da7432d1aea87e754a14a (patch)
tree97190d86cf548c9bc63f68c86a4d2a4f09809713 /tests/icon/accept
parenta (diff)
feat: grow memory limits, add icon/actor libraries, overhaul LSP diagnostics
Compiler and VM - make every memory map limit dynamic and adjustable at both build time and runtime, including compiler tables, stacks, and every execution region - reserve and grow tables, operand and return stacks, frame segments, and image-building output without relocating live code or globals - rename i/o and string helpers consistently (puts -> put_s, putn -> put_n, scat -> cat_s) across compiler, runtime, examples, tests, and docs - recast and consume values assigned to globals from inside functions - allow fixed and const together, add typed closure returns (fn:t(...)), multi-include syntax (include rt, run, core;), and recurse type inference - never infer string literals as word, anywhere, as argument, variable, or return type - draft docs/BORROW.md: a borrow checker less intrusive than Rust's but more intelligent LSP and editor integration - require explicit includes and give every toolchain area its own namespace (rt, lsp, run, core) - hover for built-in types, inferred types, values known at hover time, array and pointer lifetime/size, library names in include statements, and inferred lifetimes with explanations - honor /* */ comments as documentation for variables and arguments, and stop misattributing section headers or trailing comments as variable hints - stream diagnostics and cancel stale requests on change - jump to definition and references, including cross-file - quick fixes with automatic library import, and namespace completion Hints and diagnostics - render hints as blue squigglies by default, with hints on/small/off per file - suppress magic-number hints via a preceding /* */ comment, and say so - warn on unused arguments; allow multiple _ discards in parameters, pattern matching, and tagged enums, warning if a _ is actually used - rewrite hint and comment prose in professional compiler-doc register Libraries - add icon.zc: run-time self-modification, find/replace syntax, type and block edits, and step-through inspection of locals and globals - add actor.zc: async actors with Actor<I,O>, implicit this, spawn/recv/send, injected into the compiler machinery at include time rather than built in Tooling and docs - reorganize sources, tests, and designs into subdirectories - unify windows entry points in tinyvm.bat and add a matching tinyvm.sh - add --help across the toolchain - polish the learning guide, stdlib docs, and design notes Tests - add accept, reject, and regression coverage across the compiler, LSP, - runtime, icon, actors, threads, formatting, and the toolchain contracts, plus fuzzers and property tests
Diffstat (limited to 'tests/icon/accept')
-rw-r--r--tests/icon/accept/bound_global.expected1
-rw-r--r--tests/icon/accept/bound_global.zc13
-rw-r--r--tests/icon/accept/branch_edit.expected1
-rw-r--r--tests/icon/accept/branch_edit.zc11
-rw-r--r--tests/icon/accept/calculate.expected1
-rw-r--r--tests/icon/accept/calculate.zc8
-rw-r--r--tests/icon/accept/edit_declaration.expected1
-rw-r--r--tests/icon/accept/edit_declaration.zc12
-rw-r--r--tests/icon/accept/function_step.expected1
-rw-r--r--tests/icon/accept/function_step.zc12
-rw-r--r--tests/icon/accept/literal_replace.expected1
-rw-r--r--tests/icon/accept/literal_replace.zc9
-rw-r--r--tests/icon/accept/loop_step.expected1
-rw-r--r--tests/icon/accept/loop_step.zc12
-rw-r--r--tests/icon/accept/named_capture.expected1
-rw-r--r--tests/icon/accept/named_capture.zc10
-rw-r--r--tests/icon/accept/nested_declaration.expected1
-rw-r--r--tests/icon/accept/nested_declaration.zc11
-rw-r--r--tests/icon/accept/step.expected1
-rw-r--r--tests/icon/accept/step.zc12
-rw-r--r--tests/icon/accept/token_replace.expected1
-rw-r--r--tests/icon/accept/token_replace.zc11
22 files changed, 132 insertions, 0 deletions
diff --git a/tests/icon/accept/bound_global.expected b/tests/icon/accept/bound_global.expected
new file mode 100644
index 0000000..938d790
--- /dev/null
+++ b/tests/icon/accept/bound_global.expected
@@ -0,0 +1 @@
+1 10 10
diff --git a/tests/icon/accept/bound_global.zc b/tests/icon/accept/bound_global.zc
new file mode 100644
index 0000000..f49a76b
--- /dev/null
+++ b/tests/icon/accept/bound_global.zc
@@ -0,0 +1,13 @@
+include rt;
+include run;
+include icon;
+int counter = 6;
+fn main() {
+ let q = run.tokens("counter += 4; return counter;");
+ let frame = icon.begin(q);
+ rt.put_n(icon.bind_global(frame, "counter")); rt.put_c(' ');
+ icon.resume(frame, 3);
+ rt.put_n(counter); rt.put_c(' '); rt.put_n(icon.result(frame)); rt.put_c(10);
+ icon.close(d*frame);
+ return 0;
+}
diff --git a/tests/icon/accept/branch_edit.expected b/tests/icon/accept/branch_edit.expected
new file mode 100644
index 0000000..9c1b765
--- /dev/null
+++ b/tests/icon/accept/branch_edit.expected
@@ -0,0 +1 @@
+9 7
diff --git a/tests/icon/accept/branch_edit.zc b/tests/icon/accept/branch_edit.zc
new file mode 100644
index 0000000..b360a6a
--- /dev/null
+++ b/tests/icon/accept/branch_edit.zc
@@ -0,0 +1,11 @@
+include rt;
+include run;
+include icon;
+fn main() {
+ let q = run.tokens("if (1) { return 7; } else { return 9; }");
+ let pattern = run.tokens("if ($expr:condition) { $stmt:yes } else { $stmt:no }");
+ let replacement = run.tokens("if ($condition) { $no } else { $yes }");
+ let edited = icon.rewrite(q, pattern, replacement);
+ rt.put_n(run.eval(edited)); rt.put_c(' '); rt.put_n(run.eval(q)); rt.put_c(10);
+ return 0;
+}
diff --git a/tests/icon/accept/calculate.expected b/tests/icon/accept/calculate.expected
new file mode 100644
index 0000000..d81cc07
--- /dev/null
+++ b/tests/icon/accept/calculate.expected
@@ -0,0 +1 @@
+42
diff --git a/tests/icon/accept/calculate.zc b/tests/icon/accept/calculate.zc
new file mode 100644
index 0000000..77ba7ea
--- /dev/null
+++ b/tests/icon/accept/calculate.zc
@@ -0,0 +1,8 @@
+include rt;
+include run;
+include icon;
+fn main() {
+ let q = run.tokens("(3 + 4) * (8 - 2)");
+ rt.put_n(icon.calculate(q, 0, q[0])); rt.put_c(10);
+ return 0;
+}
diff --git a/tests/icon/accept/edit_declaration.expected b/tests/icon/accept/edit_declaration.expected
new file mode 100644
index 0000000..f599e28
--- /dev/null
+++ b/tests/icon/accept/edit_declaration.expected
@@ -0,0 +1 @@
+10
diff --git a/tests/icon/accept/edit_declaration.zc b/tests/icon/accept/edit_declaration.zc
new file mode 100644
index 0000000..59b7eb8
--- /dev/null
+++ b/tests/icon/accept/edit_declaration.zc
@@ -0,0 +1,12 @@
+include rt;
+include run;
+include icon;
+fn main() {
+ let q = run.tokens("int discarded = 8; int n = 5; return n * 2;");
+ let a = icon.undeclare(q, "discarded");
+ let type = run.tokens("i32"), block = run.tokens("int extra = 2;");
+ let b = icon.change_type(a, "n", type);
+ let c = icon.insert_block(b, 0, block);
+ rt.put_n(run.eval(c)); rt.put_c(10);
+ return 0;
+}
diff --git a/tests/icon/accept/function_step.expected b/tests/icon/accept/function_step.expected
new file mode 100644
index 0000000..c2096ed
--- /dev/null
+++ b/tests/icon/accept/function_step.expected
@@ -0,0 +1 @@
+13 5
diff --git a/tests/icon/accept/function_step.zc b/tests/icon/accept/function_step.zc
new file mode 100644
index 0000000..6bdf344
--- /dev/null
+++ b/tests/icon/accept/function_step.zc
@@ -0,0 +1,12 @@
+include rt;
+include run;
+include icon;
+int target(int value) { int n = value * 2; return n + 1; }
+fn main() {
+ let frame = icon.begin_function(target);
+ icon.set_local(frame, "value", 6);
+ icon.resume(frame, 8);
+ rt.put_n(icon.result(frame)); rt.put_c(' '); rt.put_n(target(2)); rt.put_c(10);
+ icon.close(d*frame);
+ return 0;
+}
diff --git a/tests/icon/accept/literal_replace.expected b/tests/icon/accept/literal_replace.expected
new file mode 100644
index 0000000..9c67935
--- /dev/null
+++ b/tests/icon/accept/literal_replace.expected
@@ -0,0 +1 @@
+1 4
diff --git a/tests/icon/accept/literal_replace.zc b/tests/icon/accept/literal_replace.zc
new file mode 100644
index 0000000..70f7527
--- /dev/null
+++ b/tests/icon/accept/literal_replace.zc
@@ -0,0 +1,9 @@
+include rt;
+include run;
+include icon;
+int addition() { return 7 + 3; }
+fn main() {
+ let changed = icon.find_replace(addition, ${ $int + $int }, ${ $int - $int });
+ rt.put_n(changed); rt.put_c(' '); rt.put_n(addition()); rt.put_c(10);
+ return 0;
+}
diff --git a/tests/icon/accept/loop_step.expected b/tests/icon/accept/loop_step.expected
new file mode 100644
index 0000000..15d5109
--- /dev/null
+++ b/tests/icon/accept/loop_step.expected
@@ -0,0 +1 @@
+1 8 1
diff --git a/tests/icon/accept/loop_step.zc b/tests/icon/accept/loop_step.zc
new file mode 100644
index 0000000..7a0368e
--- /dev/null
+++ b/tests/icon/accept/loop_step.zc
@@ -0,0 +1,12 @@
+include rt;
+include run;
+include icon;
+fn main() {
+ let q = run.tokens("int n = 0; while (n < limit) { n += 1; } if (n == 4) { n *= 2; } else { n = 99; } return n;");
+ let frame = icon.begin(q);
+ icon.set_global(frame, "limit", 4);
+ icon.resume(frame, 3); rt.put_n(icon.local(frame, "n")); rt.put_c(' ');
+ icon.resume(frame, 30); rt.put_n(icon.result(frame)); rt.put_c(' '); rt.put_n(icon.state(frame)); rt.put_c(10);
+ icon.close(d*frame);
+ return 0;
+}
diff --git a/tests/icon/accept/named_capture.expected b/tests/icon/accept/named_capture.expected
new file mode 100644
index 0000000..45a4fb7
--- /dev/null
+++ b/tests/icon/accept/named_capture.expected
@@ -0,0 +1 @@
+8
diff --git a/tests/icon/accept/named_capture.zc b/tests/icon/accept/named_capture.zc
new file mode 100644
index 0000000..258004d
--- /dev/null
+++ b/tests/icon/accept/named_capture.zc
@@ -0,0 +1,10 @@
+include rt;
+include run;
+include icon;
+fn main() {
+ let q = run.tokens("return (2 + 5) * (2 + 5);");
+ let p = run.tokens("$expr:x * $expr:x"), r = run.tokens("$x + 1");
+ let changed = icon.rewrite(q, p, r);
+ rt.put_n(run.eval(changed)); rt.put_c(10);
+ return 0;
+}
diff --git a/tests/icon/accept/nested_declaration.expected b/tests/icon/accept/nested_declaration.expected
new file mode 100644
index 0000000..7ed6ff8
--- /dev/null
+++ b/tests/icon/accept/nested_declaration.expected
@@ -0,0 +1 @@
+5
diff --git a/tests/icon/accept/nested_declaration.zc b/tests/icon/accept/nested_declaration.zc
new file mode 100644
index 0000000..9b360e8
--- /dev/null
+++ b/tests/icon/accept/nested_declaration.zc
@@ -0,0 +1,11 @@
+include rt;
+include run;
+include icon;
+fn main() {
+ let q = run.tokens("int n = 2; { int unused = 9; int added = 3; n += added; } return n;");
+ let type = run.tokens("i32");
+ let a = icon.undeclare(q, "unused");
+ let b = icon.change_type(a, "added", type);
+ rt.put_n(run.eval(b)); rt.put_c(10);
+ return 0;
+}
diff --git a/tests/icon/accept/step.expected b/tests/icon/accept/step.expected
new file mode 100644
index 0000000..a370d71
--- /dev/null
+++ b/tests/icon/accept/step.expected
@@ -0,0 +1 @@
+4 12 14
diff --git a/tests/icon/accept/step.zc b/tests/icon/accept/step.zc
new file mode 100644
index 0000000..d394e1e
--- /dev/null
+++ b/tests/icon/accept/step.zc
@@ -0,0 +1,12 @@
+include rt;
+include run;
+include icon;
+fn main() {
+ let q = run.tokens("int n = 4; n = n * 3; return n + bias;");
+ let frame = icon.begin(q);
+ icon.set_global(frame, "bias", 2);
+ icon.step(frame); rt.put_n(icon.local(frame, "n")); rt.put_c(' ');
+ icon.step(frame); rt.put_n(icon.local(frame, "n")); rt.put_c(' ');
+ icon.step(frame); rt.put_n(icon.result(frame)); rt.put_c(10);
+ return 0;
+}
diff --git a/tests/icon/accept/token_replace.expected b/tests/icon/accept/token_replace.expected
new file mode 100644
index 0000000..8351c19
--- /dev/null
+++ b/tests/icon/accept/token_replace.expected
@@ -0,0 +1 @@
+14
diff --git a/tests/icon/accept/token_replace.zc b/tests/icon/accept/token_replace.zc
new file mode 100644
index 0000000..bf80548
--- /dev/null
+++ b/tests/icon/accept/token_replace.zc
@@ -0,0 +1,11 @@
+include rt;
+include run;
+include icon;
+fn main() {
+ let source = run.tokens("return (9 + 2) * 3;");
+ let pattern = run.tokens("$expr:left * $int:right");
+ let replacement = run.tokens("$left + $right");
+ let edited = icon.rewrite(source, pattern, replacement);
+ rt.put_n(run.eval(edited)); rt.put_c(10);
+ return 0;
+}