|
|
@@ -448,72 +448,6 @@ expect_fail_files() {
|
|
|
expect_fail_files d_badimp_prog "undeclared identifier" d_basic.def d_basic.mod d_badimp_prog.mod
|
|
|
expect_fail_files sig "implementation does not match definition" sig.def sig.mod sig_prog.mod
|
|
|
|
|
|
-# --- two-phase Lower: re-emit from the AST and byte-compare (docs/plan-lower.md).
|
|
|
-# -lower is opt-in and only lowers units in Lower.CanLower's subset. ---
|
|
|
-lower_ok() {
|
|
|
- # $1 = test file
|
|
|
- name="$1"; mod=$(modof "$name")
|
|
|
- rm -f "gen_ssa/${mod}L.ssa"
|
|
|
- if ./M2 -lower "tests/$name" 2>&1 | grep -q "Parsed correctly"; then :; else
|
|
|
- fail=$((fail+1)); echo "FAIL(lower): $name rejected"; return
|
|
|
- fi
|
|
|
- if [ ! -f "gen_ssa/${mod}L.ssa" ]; then
|
|
|
- fail=$((fail+1)); echo "FAIL(lower): $name no gen_ssa/${mod}L.ssa"; return
|
|
|
- fi
|
|
|
- if cmp -s "gen_ssa/$mod.ssa" "gen_ssa/${mod}L.ssa"; then
|
|
|
- pass=$((pass+1)); echo "PASS(lower): $name"
|
|
|
- else
|
|
|
- fail=$((fail+1)); echo "FAIL(lower): $name .ssa mismatch"
|
|
|
- fi
|
|
|
-}
|
|
|
-lower_ok_files() {
|
|
|
- # $1 = program module name, then the session source files (program last)
|
|
|
- prog="$1"; shift
|
|
|
- files=""
|
|
|
- for f in "$@"; do
|
|
|
- case "$f" in */*) files="$files $f";; *) files="$files tests/$f";; esac
|
|
|
- done
|
|
|
- rm -f "gen_ssa/$prog.ssa" "gen_ssa/${prog}L.ssa"
|
|
|
- # generate the legacy image first (self-contained)
|
|
|
- if ./M2 $files 2>&1 | grep -q "Parsed correctly"; then :; else
|
|
|
- fail=$((fail+1)); echo "FAIL(lower): $prog legacy rejected"; return
|
|
|
- fi
|
|
|
- if ./M2 -lower $files 2>&1 | grep -q "Parsed correctly"; then :; else
|
|
|
- fail=$((fail+1)); echo "FAIL(lower): $prog rejected"; return
|
|
|
- fi
|
|
|
- if [ ! -f "gen_ssa/${prog}L.ssa" ]; then
|
|
|
- fail=$((fail+1)); echo "FAIL(lower): $prog no gen_ssa/${prog}L.ssa"; return
|
|
|
- fi
|
|
|
- if cmp -s "gen_ssa/$prog.ssa" "gen_ssa/${prog}L.ssa"; then
|
|
|
- pass=$((pass+1)); echo "PASS(lower): $prog"
|
|
|
- else
|
|
|
- fail=$((fail+1)); echo "FAIL(lower): $prog .ssa mismatch"
|
|
|
- fi
|
|
|
-}
|
|
|
-lower_ok t_exit.mod
|
|
|
-lower_ok t_arith.mod
|
|
|
-lower_ok t_lower1.mod
|
|
|
-lower_ok t_lower2.mod
|
|
|
-lower_ok t_lower3.mod
|
|
|
-lower_ok t_nestedmod.mod
|
|
|
-lower_ok t_classmethod.mod
|
|
|
-lower_ok t_classinherit.mod
|
|
|
-lower_ok t_classsibling.mod
|
|
|
-lower_ok t_class.mod
|
|
|
-lower_ok t_classinit.mod
|
|
|
-lower_ok t_virtual.mod
|
|
|
-lower_ok_files DBasicProg d_basic.def d_basic.mod d_basic_prog.mod
|
|
|
-lower_ok_files DQualProg d_basic.def d_basic.mod d_qual_prog.mod
|
|
|
-lower_ok_files TQual d_libc.def t_qual.mod
|
|
|
-lower_ok_files TQualP d_qualp.def t_qualp.mod
|
|
|
-lower_ok t_lower4.mod
|
|
|
-lower_ok t_lower4case.mod
|
|
|
-lower_ok t_lower4with.mod
|
|
|
-lower_ok t_lower5.mod
|
|
|
-lower_ok t_lower5arr.mod
|
|
|
-lower_ok t_lower5lit.mod
|
|
|
-lower_ok t_lower5set.mod
|
|
|
-
|
|
|
# --- step 7 gate: compiler sources free of gm2-only imports.
|
|
|
# FileIO is the last module to port (see docs/summary_step7.md);
|
|
|
# it is excluded here so the gate guards everything else. ---
|