diff options
| author | 2026-10-14 08:29:46 +0330 | |
|---|---|---|
| committer | 2026-10-14 08:29:46 +0330 | |
| commit | 1c53304d03414890af0da7432d1aea87e754a14a (patch) | |
| tree | 97190d86cf548c9bc63f68c86a4d2a4f09809713 /tests/icon/reject | |
| parent | a (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/reject')
42 files changed, 228 insertions, 0 deletions
diff --git a/tests/icon/reject/bad_delimiter_replacement.expected b/tests/icon/reject/bad_delimiter_replacement.expected new file mode 100644 index 0000000..363c912 --- /dev/null +++ b/tests/icon/reject/bad_delimiter_replacement.expected @@ -0,0 +1 @@ +1 1 3 diff --git a/tests/icon/reject/bad_delimiter_replacement.zc b/tests/icon/reject/bad_delimiter_replacement.zc new file mode 100644 index 0000000..faffd90 --- /dev/null +++ b/tests/icon/reject/bad_delimiter_replacement.zc @@ -0,0 +1,9 @@ +include rt; +include run; +include icon; +fn main() { + let q = run.tokens("return 3;"), pattern = run.tokens("$int"), replacement = run.tokens("("); + let edited = icon.rewrite(q, pattern, replacement); + rt.put_n(edited == 0); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(' '); rt.put_n(run.eval(q)); rt.put_c(10); + return 0; +} diff --git a/tests/icon/reject/bind_function.expected b/tests/icon/reject/bind_function.expected new file mode 100644 index 0000000..65cd68b --- /dev/null +++ b/tests/icon/reject/bind_function.expected @@ -0,0 +1 @@ +0 2 diff --git a/tests/icon/reject/bind_function.zc b/tests/icon/reject/bind_function.zc new file mode 100644 index 0000000..1348c90 --- /dev/null +++ b/tests/icon/reject/bind_function.zc @@ -0,0 +1,10 @@ +include rt; +include run; +include icon; +int target() { return 1; } +fn main() { + let q = run.tokens("return 0;"), frame = icon.begin(q); + rt.put_n(icon.bind_global(frame, "target")); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(10); + icon.close(d*frame); + return 0; +} diff --git a/tests/icon/reject/bind_pointer.expected b/tests/icon/reject/bind_pointer.expected new file mode 100644 index 0000000..6517ee9 --- /dev/null +++ b/tests/icon/reject/bind_pointer.expected @@ -0,0 +1 @@ +0 2 preserved diff --git a/tests/icon/reject/bind_pointer.zc b/tests/icon/reject/bind_pointer.zc new file mode 100644 index 0000000..4834dde --- /dev/null +++ b/tests/icon/reject/bind_pointer.zc @@ -0,0 +1,10 @@ +include rt; +include run; +include icon; +char* message = "preserved"; +fn main() { + let q = run.tokens("return 0;"), frame = icon.begin(q); + rt.put_n(icon.bind_global(frame, "message")); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(' '); rt.put_s(message); rt.put_c(10); + icon.close(d*frame); + return 0; +} diff --git a/tests/icon/reject/expression_boundary.expected b/tests/icon/reject/expression_boundary.expected new file mode 100644 index 0000000..65cd68b --- /dev/null +++ b/tests/icon/reject/expression_boundary.expected @@ -0,0 +1 @@ +0 2 diff --git a/tests/icon/reject/expression_boundary.zc b/tests/icon/reject/expression_boundary.zc new file mode 100644 index 0000000..5c84dbd --- /dev/null +++ b/tests/icon/reject/expression_boundary.zc @@ -0,0 +1,8 @@ +include rt; +include run; +include icon; +fn main() { + let q = run.tokens("(7)"); + rt.put_n(icon.calculate(q, 0, 2)); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(10); + return 0; +} diff --git a/tests/icon/reject/implicit_global.expected b/tests/icon/reject/implicit_global.expected new file mode 100644 index 0000000..3ff996e --- /dev/null +++ b/tests/icon/reject/implicit_global.expected @@ -0,0 +1 @@ +0 2 5 diff --git a/tests/icon/reject/implicit_global.zc b/tests/icon/reject/implicit_global.zc new file mode 100644 index 0000000..ce8e25d --- /dev/null +++ b/tests/icon/reject/implicit_global.zc @@ -0,0 +1,11 @@ +include rt; +include run; +include icon; +int hidden = 41; +fn main() { + let q = run.tokens("return hidden;"); + let f = icon.begin(q); + rt.put_n(icon.step(f)); rt.put_c(' '); rt.put_n(icon.state(f)); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(10); + icon.close(d*f); + return 0; +} diff --git a/tests/icon/reject/incomplete_expression.expected b/tests/icon/reject/incomplete_expression.expected new file mode 100644 index 0000000..65cd68b --- /dev/null +++ b/tests/icon/reject/incomplete_expression.expected @@ -0,0 +1 @@ +0 2 diff --git a/tests/icon/reject/incomplete_expression.zc b/tests/icon/reject/incomplete_expression.zc new file mode 100644 index 0000000..8a0366c --- /dev/null +++ b/tests/icon/reject/incomplete_expression.zc @@ -0,0 +1,8 @@ +include rt; +include run; +include icon; +fn main() { + let q = run.tokens("1 +"); + rt.put_n(icon.calculate(q, 0, q[0])); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(10); + return 0; +} diff --git a/tests/icon/reject/multiple_bindings.expected b/tests/icon/reject/multiple_bindings.expected new file mode 100644 index 0000000..43cebf1 --- /dev/null +++ b/tests/icon/reject/multiple_bindings.expected @@ -0,0 +1 @@ +1 2 2 diff --git a/tests/icon/reject/multiple_bindings.zc b/tests/icon/reject/multiple_bindings.zc new file mode 100644 index 0000000..2b7b5e0 --- /dev/null +++ b/tests/icon/reject/multiple_bindings.zc @@ -0,0 +1,9 @@ +include rt; +include run; +include icon; +fn main() { + let q = run.tokens("int a = 1, b = 2; return b;"); + let changed = icon.undeclare(q, "a"); + rt.put_n(changed == 0); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(' '); rt.put_n(run.eval(q)); rt.put_c(10); + return 0; +} diff --git a/tests/icon/reject/non_declaration.expected b/tests/icon/reject/non_declaration.expected new file mode 100644 index 0000000..8d04f96 --- /dev/null +++ b/tests/icon/reject/non_declaration.expected @@ -0,0 +1 @@ +1 2 diff --git a/tests/icon/reject/non_declaration.zc b/tests/icon/reject/non_declaration.zc new file mode 100644 index 0000000..b4233f9 --- /dev/null +++ b/tests/icon/reject/non_declaration.zc @@ -0,0 +1,9 @@ +include rt; +include run; +include icon; +fn main() { + let q = run.tokens("rt.put_n(n); return 0;"); + let changed = icon.undeclare(q, "n"); + rt.put_n(changed == 0); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(10); + return 0; +} diff --git a/tests/icon/reject/null_inputs.expected b/tests/icon/reject/null_inputs.expected new file mode 100644 index 0000000..75f3fe4 --- /dev/null +++ b/tests/icon/reject/null_inputs.expected @@ -0,0 +1,4 @@ +0 2 +1 2 +1 2 +1 2 diff --git a/tests/icon/reject/null_inputs.zc b/tests/icon/reject/null_inputs.zc new file mode 100644 index 0000000..41a7c4e --- /dev/null +++ b/tests/icon/reject/null_inputs.zc @@ -0,0 +1,10 @@ +include rt; +include run; +include icon; +fn main() { + rt.put_n(icon.calculate(0, 0, 1)); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(10); + let a = icon.undeclare(0, "n"); rt.put_n(a == 0); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(10); + let b = icon.change_type(0, "n", 0); rt.put_n(b == 0); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(10); + let c = icon.insert_block(0, 0, 0); rt.put_n(c == 0); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(10); + return 0; +} diff --git a/tests/icon/reject/publication_return_type.expected b/tests/icon/reject/publication_return_type.expected new file mode 100644 index 0000000..3f070c0 --- /dev/null +++ b/tests/icon/reject/publication_return_type.expected @@ -0,0 +1 @@ +0 4 diff --git a/tests/icon/reject/publication_return_type.zc b/tests/icon/reject/publication_return_type.zc new file mode 100644 index 0000000..03822c5 --- /dev/null +++ b/tests/icon/reject/publication_return_type.zc @@ -0,0 +1,11 @@ +include rt; +include run; +include icon; +typecheck on; +int target() { return 4; } +fn main() { + let pattern = run.tokens("return $int;"), replacement = run.tokens("return \"invalid\";"); + rt.put_n(icon.find_replace(target, pattern, replacement)); rt.put_c(' '); + rt.put_n(target()); rt.put_c(10); + return 0; +} diff --git a/tests/icon/reject/publication_signature.expected b/tests/icon/reject/publication_signature.expected new file mode 100644 index 0000000..3f070c0 --- /dev/null +++ b/tests/icon/reject/publication_signature.expected @@ -0,0 +1 @@ +0 4 diff --git a/tests/icon/reject/publication_signature.zc b/tests/icon/reject/publication_signature.zc new file mode 100644 index 0000000..01646e0 --- /dev/null +++ b/tests/icon/reject/publication_signature.zc @@ -0,0 +1,11 @@ +include rt; +include run; +include icon; +typecheck on; +int target(int value) { return value + 1; } +fn main() { + let replacement = run.tokens("int target(char* value) { return 9; }"); + rt.put_n(run.replace_function(target, replacement)); rt.put_c(' '); + rt.put_n(target(3)); rt.put_c(10); + return 0; +} diff --git a/tests/icon/reject/range.expected b/tests/icon/reject/range.expected new file mode 100644 index 0000000..8d04f96 --- /dev/null +++ b/tests/icon/reject/range.expected @@ -0,0 +1 @@ +1 2 diff --git a/tests/icon/reject/range.zc b/tests/icon/reject/range.zc new file mode 100644 index 0000000..42bc0f4 --- /dev/null +++ b/tests/icon/reject/range.zc @@ -0,0 +1,9 @@ +include rt; +include run; +include icon; +fn main() { + let q = run.tokens("return 1;"), r = run.tokens("2"); + let changed = icon.splice(q, -1, 1, r); + rt.put_n(changed == 0); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(10); + return 0; +} diff --git a/tests/icon/reject/sized_frame.expected b/tests/icon/reject/sized_frame.expected new file mode 100644 index 0000000..a57b07e --- /dev/null +++ b/tests/icon/reject/sized_frame.expected @@ -0,0 +1 @@ +2 5 diff --git a/tests/icon/reject/sized_frame.zc b/tests/icon/reject/sized_frame.zc new file mode 100644 index 0000000..43e44fa --- /dev/null +++ b/tests/icon/reject/sized_frame.zc @@ -0,0 +1,11 @@ +include rt; +include run; +include icon; +fn main() { + let q = run.tokens("i8 n = 300; return n;"); + let frame = icon.begin(q); + icon.step(frame); + rt.put_n(icon.state(frame)); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(10); + icon.close(d*frame); + return 0; +} diff --git a/tests/icon/reject/step_else_side_effect.expected b/tests/icon/reject/step_else_side_effect.expected new file mode 100644 index 0000000..c24938b --- /dev/null +++ b/tests/icon/reject/step_else_side_effect.expected @@ -0,0 +1 @@ +0 2 0 diff --git a/tests/icon/reject/step_else_side_effect.zc b/tests/icon/reject/step_else_side_effect.zc new file mode 100644 index 0000000..43c0d5d --- /dev/null +++ b/tests/icon/reject/step_else_side_effect.zc @@ -0,0 +1,12 @@ +include rt; +include run; +include icon; +int calls; +int condition() { calls++; return 1; } +fn main() { + let q = run.tokens("if (condition()) { return 1; } else return 2;"); + let f = icon.begin(q); + rt.put_n(icon.step(f)); rt.put_c(' '); rt.put_n(icon.state(f)); rt.put_c(' '); rt.put_n(calls); rt.put_c(10); + icon.close(d*f); + return 0; +} diff --git a/tests/icon/reject/step_local_mutation.expected b/tests/icon/reject/step_local_mutation.expected new file mode 100644 index 0000000..f8c518e --- /dev/null +++ b/tests/icon/reject/step_local_mutation.expected @@ -0,0 +1 @@ +0 2 1 diff --git a/tests/icon/reject/step_local_mutation.zc b/tests/icon/reject/step_local_mutation.zc new file mode 100644 index 0000000..6ef0a51 --- /dev/null +++ b/tests/icon/reject/step_local_mutation.zc @@ -0,0 +1,11 @@ +include rt; +include run; +include icon; +fn main() { + let q = run.tokens("int n = 1; return n++;"); + let f = icon.begin(q); + icon.step(f); + rt.put_n(icon.step(f)); rt.put_c(' '); rt.put_n(icon.state(f)); rt.put_c(' '); rt.put_n(icon.local(f, "n")); rt.put_c(10); + icon.close(d*f); + return 0; +} diff --git a/tests/icon/reject/step_multiple_bindings.expected b/tests/icon/reject/step_multiple_bindings.expected new file mode 100644 index 0000000..057d934 --- /dev/null +++ b/tests/icon/reject/step_multiple_bindings.expected @@ -0,0 +1 @@ +0 2 5 0 diff --git a/tests/icon/reject/step_multiple_bindings.zc b/tests/icon/reject/step_multiple_bindings.zc new file mode 100644 index 0000000..d1dba73 --- /dev/null +++ b/tests/icon/reject/step_multiple_bindings.zc @@ -0,0 +1,10 @@ +include rt; +include run; +include icon; +fn main() { + let q = run.tokens("int n = 1, m = 2;"); + let f = icon.begin(q); + rt.put_n(icon.step(f)); rt.put_c(' '); rt.put_n(icon.state(f)); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(' '); rt.put_n(icon.local_count(f)); rt.put_c(10); + icon.close(d*f); + return 0; +} diff --git a/tests/icon/reject/type_name_binding.expected b/tests/icon/reject/type_name_binding.expected new file mode 100644 index 0000000..8d04f96 --- /dev/null +++ b/tests/icon/reject/type_name_binding.expected @@ -0,0 +1 @@ +1 2 diff --git a/tests/icon/reject/type_name_binding.zc b/tests/icon/reject/type_name_binding.zc new file mode 100644 index 0000000..7ee62a9 --- /dev/null +++ b/tests/icon/reject/type_name_binding.zc @@ -0,0 +1,9 @@ +include rt; +include run; +include icon; +fn main() { + let q = run.tokens("int* pointer;"); + let r = icon.undeclare(q, "int"); + rt.put_n(r == 0); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(10); + return 0; +} diff --git a/tests/icon/reject/unbalanced.expected b/tests/icon/reject/unbalanced.expected new file mode 100644 index 0000000..573541a --- /dev/null +++ b/tests/icon/reject/unbalanced.expected @@ -0,0 +1 @@ +0 diff --git a/tests/icon/reject/unbalanced.zc b/tests/icon/reject/unbalanced.zc new file mode 100644 index 0000000..d6ab110 --- /dev/null +++ b/tests/icon/reject/unbalanced.zc @@ -0,0 +1,8 @@ +include rt; +include run; +include icon; +fn main() { + let q = run.tokens("return (1 + 2;"); + rt.put_n(icon.validate(q)); rt.put_c(10); + return 0; +} diff --git a/tests/icon/reject/unknown_pattern.expected b/tests/icon/reject/unknown_pattern.expected new file mode 100644 index 0000000..2fb73a0 --- /dev/null +++ b/tests/icon/reject/unknown_pattern.expected @@ -0,0 +1 @@ +1 1 diff --git a/tests/icon/reject/unknown_pattern.zc b/tests/icon/reject/unknown_pattern.zc new file mode 100644 index 0000000..74850c3 --- /dev/null +++ b/tests/icon/reject/unknown_pattern.zc @@ -0,0 +1,9 @@ +include rt; +include run; +include icon; +fn main() { + let q = run.tokens("return 1;"), pattern = run.tokens("$unknown"), replacement = run.tokens("2"); + let changed = icon.rewrite(q, pattern, replacement); + rt.put_n(changed == 0); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(10); + return 0; +} diff --git a/tests/icon/reject/unresolved_capture.expected b/tests/icon/reject/unresolved_capture.expected new file mode 100644 index 0000000..4ef63d7 --- /dev/null +++ b/tests/icon/reject/unresolved_capture.expected @@ -0,0 +1 @@ +1 3 3 diff --git a/tests/icon/reject/unresolved_capture.zc b/tests/icon/reject/unresolved_capture.zc new file mode 100644 index 0000000..71584e3 --- /dev/null +++ b/tests/icon/reject/unresolved_capture.zc @@ -0,0 +1,9 @@ +include rt; +include run; +include icon; +fn main() { + let q = run.tokens("return 1 + 2;"), p = run.tokens("$int + $int"), r = run.tokens("$missing"); + let changed = icon.rewrite(q, p, r); + rt.put_n(changed == 0); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(' '); rt.put_n(run.eval(q)); rt.put_c(10); + return 0; +} diff --git a/tests/icon/reject/unsupported_step.expected b/tests/icon/reject/unsupported_step.expected new file mode 100644 index 0000000..a57b07e --- /dev/null +++ b/tests/icon/reject/unsupported_step.expected @@ -0,0 +1 @@ +2 5 diff --git a/tests/icon/reject/unsupported_step.zc b/tests/icon/reject/unsupported_step.zc new file mode 100644 index 0000000..944c5b6 --- /dev/null +++ b/tests/icon/reject/unsupported_step.zc @@ -0,0 +1,10 @@ +include rt; +include run; +include icon; +fn main() { + let q = run.tokens("for (int i = 0; i < 2; i++) {}"); + let frame = icon.begin(q); + icon.step(frame); rt.put_n(icon.state(frame)); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(10); + icon.close(d*frame); + return 0; +} |
