feat: try/unwrap payload types, LSP format, macro paste, freestanding runtime
ci / build (ubuntu) (push) Has been cancelled
ci / unit + fmt (push) Has been cancelled
ci / examples (push) Has been cancelled
ci / goldens + tools (push) Has been cancelled
ci / apps (push) Has been cancelled
ci / selfhost smoke (push) Has been cancelled
ci / macos smoke (push) Has been cancelled
ci / windows smoke (push) Has been cancelled
ci / CI gate (push) Has been cancelled
selfhost-loop / bootstrap determinism (push) Has been cancelled

- Type `?`/`!` as Result/Option Ok payload (not always int); fix unwrap C types
- LSP 0.18 document formatting (bux fmt) + VS Code format-on-save
- Macro `:type` generics (Array_New<$t>) and operators-only tt paste
- Ship runtime_freestanding.c + BUX_RUNTIME=freestanding + smokes/examples
This commit is contained in:
2026-07-28 16:56:35 +03:00
parent db7ba1dff2
commit ec5984762b
22 changed files with 1332 additions and 68 deletions
+66
View File
@@ -0,0 +1,66 @@
#!/usr/bin/env bash
# Smoke: freestanding runtime compiles under -ffreestanding; optional package build.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
RT="$ROOT/rt/runtime_freestanding.c"
TMP=$(mktemp -d)
trap 'rm -rf "$TMP"' EXIT
if [[ ! -f "$RT" ]]; then
echo "FAIL: missing $RT"
exit 1
fi
CC="${BUX_CC:-cc}"
echo "=== freestanding: -ffreestanding -c runtime ==="
"$CC" -ffreestanding -std=c11 -Wall -Wextra -c "$RT" -o "$TMP/rt_fs.o"
echo "PASS: runtime_freestanding.o"
echo "=== freestanding: BUX_RUNTIME=freestanding build hello-ish ==="
mkdir -p "$TMP/pkg/src"
cat > "$TMP/pkg/bux.toml" <<'EOF'
[Package]
Name = "fs_smoke"
Version = "0.1.0"
EOF
cat > "$TMP/pkg/src/Main.bux" <<'EOF'
func Main() -> int {
return 42;
}
EOF
if [[ ! -x "$ROOT/buxc" ]]; then
echo "building buxc..."
(cd "$ROOT" && make build >/dev/null)
fi
# Hosted link still uses libc for crt0; runtime body is freestanding.
BUX_RUNTIME=freestanding "$ROOT/buxc" build "$TMP/pkg" --release >/dev/null
OUT="$TMP/pkg/build/fs_smoke"
if [[ ! -x "$OUT" ]]; then
echo "FAIL: binary not produced"
exit 1
fi
CODE=$("$OUT"; echo $?)
if [[ "$CODE" != "42" ]]; then
echo "FAIL: expected exit 42, got $CODE"
exit 1
fi
echo "PASS: freestanding runtime package exit 42"
# Optional: object-level nostdlib link experiment (may need extra crt — soft)
echo "=== freestanding: optional -ffreestanding object of Main.c ==="
# Generate C then compile Main only with freestanding flags
BUX_RUNTIME=freestanding "$ROOT/buxc" build "$TMP/pkg" --release >/dev/null
if [[ -f "$TMP/pkg/build/main.c" ]]; then
if "$CC" -ffreestanding -std=c11 -c "$TMP/pkg/build/main.c" -o "$TMP/main_fs.o" 2>"$TMP/main_fs.err"; then
echo "PASS: main.c compiles under -ffreestanding"
else
# Hosted headers in generated C may pull stdint — not a hard fail
echo "SKIP: main.c -ffreestanding (generated C may need hosted headers)"
head -5 "$TMP/main_fs.err" || true
fi
fi
echo "PASS: freestanding smoke"