feat: field-move Drop (partial/nested/ptr), stmt/pat macros, Windows runtime
ci / build (ubuntu) (push) Has been cancelled
ci / macos smoke (push) Has been cancelled
ci / windows smoke (push) Has been cancelled
selfhost-loop / bootstrap determinism (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 / CI gate (push) Has been cancelled

Sessions 70–74: partialMovedPaths + ptrAliases in bootstrap/selfhost CBE,
remaining drops after field moves, macro stmt/pat fragments, runtime_win.c
and MinGW hello CI, examples + drop-move smoke coverage, QUALITY_PLAN update.
This commit is contained in:
2026-07-21 12:29:53 +03:00
parent fe3b1e8b6a
commit a939f74b1b
22 changed files with 2672 additions and 117 deletions
+92 -2
View File
@@ -58,7 +58,97 @@ if sed -n '/^Array_int TakeItems/,/^}/p' "$TMP/mp/build/main.c" | grep -q 'Bag_D
sed -n '/^Array_int TakeItems/,/^}/p' "$TMP/mp/build/main.c"
exit 1
fi
echo " move_field_partial: PASS (run + TakeItems has no Bag_Drop)"
# PeekTagAndTake must Drop the moved-out Array after Array_Len mono (defer restore)
if ! sed -n '/^int PeekTagAndTake/,/^}/p' "$TMP/mp/build/main.c" | grep -q 'Array_Drop'; then
echo "error: PeekTagAndTake missing Array_Drop for moved local (defer restore?)" >&2
sed -n '/^int PeekTagAndTake/,/^}/p' "$TMP/mp/build/main.c"
exit 1
fi
echo " move_field_partial: PASS (run + TakeItems has no Bag_Drop + PeekTag drops moved)"
# --- remaining field Drop after partial move ---
echo "=== smoke: move_field_remaining ==="
mkdir -p "$TMP/mr/src"
cp -a "$ROOT/rt" "$TMP/mr/"
cat > "$TMP/mr/bux.toml" <<'EOF'
[Package]
Name = "move_field_remaining"
Version = "0.1.0"
Type = "bin"
[Build]
Output = "Bin"
EOF
cp "$ROOT/examples/move_field_remaining.bux" "$TMP/mr/src/Main.bux"
(cd "$TMP/mr" && "$BUXC" run .)
# TakeLeft must not PairBag_Drop, but must Tracked_Drop remaining right field
if sed -n '/^Array_int TakeLeft/,/^}/p' "$TMP/mr/build/main.c" | grep -q 'PairBag_Drop'; then
echo "error: TakeLeft still PairBag_Drops after partial field move" >&2
sed -n '/^Array_int TakeLeft/,/^}/p' "$TMP/mr/build/main.c"
exit 1
fi
if ! sed -n '/^Array_int TakeLeft/,/^}/p' "$TMP/mr/build/main.c" | grep -q 'Tracked_Drop'; then
echo "error: TakeLeft missing Tracked_Drop for remaining field" >&2
sed -n '/^Array_int TakeLeft/,/^}/p' "$TMP/mr/build/main.c"
exit 1
fi
echo " move_field_remaining: PASS (run + no PairBag_Drop + Tracked_Drop on right)"
# --- nested path move outer.inner.items ---
echo "=== smoke: move_field_nested ==="
mkdir -p "$TMP/mn/src"
cp -a "$ROOT/rt" "$TMP/mn/"
cat > "$TMP/mn/bux.toml" <<'EOF'
[Package]
Name = "move_field_nested"
Version = "0.1.0"
Type = "bin"
[Build]
Output = "Bin"
EOF
cp "$ROOT/examples/move_field_nested.bux" "$TMP/mn/src/Main.bux"
(cd "$TMP/mn" && "$BUXC" run .)
# TakeNestedItems: no Outer_Drop; must Tracked_Drop remaining note + tag
if sed -n '/^Array_int TakeNestedItems/,/^}/p' "$TMP/mn/build/main.c" | grep -q 'Outer_Drop'; then
echo "error: TakeNestedItems still Outer_Drops after nested path move" >&2
sed -n '/^Array_int TakeNestedItems/,/^}/p' "$TMP/mn/build/main.c"
exit 1
fi
tdrops=$(sed -n '/^Array_int TakeNestedItems/,/^}/p' "$TMP/mn/build/main.c" | grep -c 'Tracked_Drop' || true)
if [[ "${tdrops:-0}" -lt 2 ]]; then
echo "error: TakeNestedItems expected ≥2 Tracked_Drop (inner.note + tag), got $tdrops" >&2
sed -n '/^Array_int TakeNestedItems/,/^}/p' "$TMP/mn/build/main.c"
exit 1
fi
echo " move_field_nested: PASS (run + no Outer_Drop + Tracked_Drop remaining)"
# --- pointer field move p.items / (*p).items ---
echo "=== smoke: move_field_ptr ==="
mkdir -p "$TMP/mptr/src"
cp -a "$ROOT/rt" "$TMP/mptr/"
cat > "$TMP/mptr/bux.toml" <<'EOF'
[Package]
Name = "move_field_ptr"
Version = "0.1.0"
Type = "bin"
[Build]
Output = "Bin"
EOF
cp "$ROOT/examples/move_field_ptr.bux" "$TMP/mptr/src/Main.bux"
(cd "$TMP/mptr" && "$BUXC" run .)
if sed -n '/^Array_int TakeViaPtr/,/^}/p' "$TMP/mptr/build/main.c" | grep -q 'Bag_Drop'; then
echo "error: TakeViaPtr still Bag_Drops after p.items move" >&2
sed -n '/^Array_int TakeViaPtr/,/^}/p' "$TMP/mptr/build/main.c"
exit 1
fi
if ! sed -n '/^Array_int TakeViaPtr/,/^}/p' "$TMP/mptr/build/main.c" | grep -q 'Tracked_Drop'; then
echo "error: TakeViaPtr missing Tracked_Drop for remaining tag" >&2
sed -n '/^Array_int TakeViaPtr/,/^}/p' "$TMP/mptr/build/main.c"
exit 1
fi
echo " move_field_ptr: PASS (run + no Bag_Drop + Tracked_Drop remaining)"
# --- early return Drop counts ---
echo "=== smoke: drop_early_return ==="
@@ -78,4 +168,4 @@ out=$(cd "$TMP/de" && "$BUXC" run .)
echo "$out" | grep -q 'PASS'
echo " drop_early_return: PASS"
echo "PASS: smoke_drop_move (field-move + partial + early-return)"
echo "PASS: smoke_drop_move (field-move + partial + remaining + nested + ptr + early-return)"
+68
View File
@@ -0,0 +1,68 @@
#!/usr/bin/env bash
# Session 71 — Windows / MinGW hello smoke (also testable on Unix via BUX_RUNTIME=win).
# Builds examples/hello.bux with the minimal runtime and checks stdout.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
export BUX_STDLIB="${BUX_STDLIB:-$ROOT/lib}"
unset BUX_DEBUG_FILE || true
# Prefer buxc.exe on Windows, else buxc
if [[ -x "$ROOT/buxc.exe" ]]; then
BUXC="$ROOT/buxc.exe"
elif [[ -x "$ROOT/buxc" ]]; then
BUXC="$ROOT/buxc"
else
(cd "$ROOT" && make build)
if [[ -x "$ROOT/buxc.exe" ]]; then BUXC="$ROOT/buxc.exe"
else BUXC="$ROOT/buxc"
fi
fi
# Force minimal runtime when not already on Windows (Linux/macOS local check)
case "$(uname -s 2>/dev/null || echo unknown)" in
MINGW*|MSYS*|CYGWIN*|Windows_NT) ;;
*)
export BUX_RUNTIME="${BUX_RUNTIME:-win}"
;;
esac
if ! command -v gcc >/dev/null 2>&1 && ! command -v cc >/dev/null 2>&1; then
echo "error: need gcc/cc on PATH (MinGW on Windows)" >&2
exit 1
fi
TMP=$(mktemp -d)
trap 'rm -rf "$TMP"' EXIT
mkdir -p "$TMP/src"
cp -a "$ROOT/rt" "$TMP/"
cat > "$TMP/bux.toml" <<'EOF'
[Package]
Name = "hello"
Version = "0.1.0"
Type = "bin"
[Build]
Output = "Bin"
EOF
cp "$ROOT/examples/hello.bux" "$TMP/src/Main.bux"
echo "=== smoke_windows_hello: build+run ==="
out=$("$BUXC" run "$TMP" 2>&1) || {
echo "$out" >&2
exit 1
}
echo "$out"
echo "$out" | grep -q 'Hello, Bux!'
# Confirm minimal runtime was used when forced / on Windows
if [[ -f "$TMP/build/runtime.c" ]]; then
if ! grep -q 'Windows / MinGW minimal' "$TMP/build/runtime.c"; then
# On native Windows the CLI always copies runtime_win.c content into runtime.c
if grep -q 'pthread\|openssl/evp' "$TMP/build/runtime.c"; then
echo "error: expected runtime_win.c content, found full POSIX runtime" >&2
exit 1
fi
fi
fi
echo "PASS: smoke_windows_hello"