boot: maps, for k, v in, for i, x in

map[K]V, [:] and ["a": 1] literals, m[k] reads and writes (m[k] += 1 starts from
zero), has/get/remove/clear/keys/values, .len, copy and printing, and a loop over
a map that stops with an error when it adds keys. for i, x in list gives the
index too.

boot.sh: 17 passed, 0 failed, 5 skipped (all five import C).
This commit is contained in:
Nexoniarz 2026-10-25 18:53:39 +01:00
commit 083d66c82b
4 changed files with 460 additions and 16 deletions

View file

@ -21,11 +21,11 @@ fi
pass=0; failed=0; skipped=0
for f in tests/run/*.fch; do
grep -q "^fn main" "$f" || continue
# the bootstrap compiler doesn't do C imports and maps
# the bootstrap compiler doesn't do C imports
# (checked in the test and in the modules it imports)
files="$f"
for m in $(sed -n 's/^import \([a-z_]*\)$/\1/p' "$f"); do files="$files tests/run/$m.fch"; done
if grep -qE '^import "|^link |map\[|for [a-z_]+, ' $files; then
if grep -qE '^import "|^link ' $files; then
skipped=$((skipped + 1))
continue
fi