Bladeren bron

docs: step 4d + the architectural conclusion on FwdVar*

Records the first check moved to the walk (forward-tainted assignments)
and the conclusion that FwdVar*/NoteForward cannot be deleted by moving
checks alone: Design must still bind a not-yet-declared name, which needs
a genuinely two-phase parse (declarations before bodies).
Eric Streit 1 dag geleden
bovenliggende
commit
73586b76f2
1 gewijzigde bestanden met toevoegingen van 20 en 0 verwijderingen
  1. 20 0
      docs/plan-resolve-check.md

+ 20 - 0
docs/plan-resolve-check.md

@@ -286,4 +286,24 @@ Measured while scaffolding (branch `resolve-check`):
   divergence: a procedure value's type is `ClProc` at parse time but
   `ClInvalid` in `Lower`.
 
+- **2026-10-15 (`8efae2e`, step 4d)** — the first check moves to the
+  walk: an assignment whose operand was a forward reference is now
+  type-checked *after* resolution.  `PropNode` returns "touched by a
+  forward reference" (a forward designator node is marked `Op=1`; a node
+  `PropNode` re-types also counts), and `CheckAssign` re-checks such an
+  assignment (`Assignable` / class class).  Previously `n := "abc"` with
+  a later `VAR n : INTEGER` was **silently accepted**.  Non-forward
+  assignments keep the parser's check, so there are no duplicate
+  diagnostics and `-noresolve` still checks fully.  New `expect_fail`
+  test `t_bad_fwd.mod`; suite 193/193.
+- **Pattern for the remaining checks**: the same shape — a check the
+  parser had to skip for a forward operand is re-run in `PropNode` for a
+  touched subtree (control-flow conditions, `RETURN`, arity, …).
+- **Architectural conclusion**: `FwdVar*`/`NoteForward` *cannot* be
+  deleted this way.  Even with every check moved, `Design` must still
+  bind a not-yet-declared name — which needs the compiler to parse
+  declarations before bodies (a genuinely two-phase parse).  The
+  resolve/check pass improves *diagnostics* for forward references and
+  gives the type layer; the deletion needs the parse restructure.
+