feat: multi-instance closures, richer stdlib, and Rust-style diagnostics

Introduce fat function pointers (BuxFn {code, env}) so capturing closures
are heap-allocated per value in both bootstrap and selfhost. Expand
Array/Map/Set/String/Test/Result APIs, add proper tuple codegen and
error snippets with multi-char underlines, golden diagnostic tests, and
LSP diagnostics via buxc check.
This commit is contained in:
2026-07-15 16:00:21 +03:00
parent 94e6806dda
commit 61ac06ab5f
48 changed files with 2789 additions and 362 deletions
+32
View File
@@ -0,0 +1,32 @@
// Tuple types: (T, U), return, field access via .0 / .1
import Std::Io::{PrintLine, PrintInt};
import Std::Test::{Test_AssertEqInt, Test_Pass};
func MakePair(a: int, b: int) -> (int, int) {
return (a, b);
}
func Swap(t: (int, int)) -> (int, int) {
return (t.1, t.0);
}
func Main() -> int {
let t: (int, int) = MakePair(10, 20);
Test_AssertEqInt(t.0, 10);
Test_AssertEqInt(t.1, 20);
let s: (int, int) = Swap(t);
Test_AssertEqInt(s.0, 20);
Test_AssertEqInt(s.1, 10);
let lit: (int, int) = (7, 8);
Test_AssertEqInt(lit.0, 7);
Test_AssertEqInt(lit.1, 8);
PrintInt(t.0);
PrintLine("");
PrintInt(t.1);
PrintLine("");
Test_Pass("tuples");
return 0;
}