From 6c3b7d1cf97eb39c4a1b287884475d783a630cce Mon Sep 17 00:00:00 2001 From: giles Date: Wed, 27 May 2026 20:41:02 +0000 Subject: [PATCH] =?UTF-8?q?go:=20types.sx=20scaffold=20=E2=80=94=20synth/c?= =?UTF-8?q?heck=20skeleton=20+=2012=20tests;=20Phase=203=20starts=20[shape?= =?UTF-8?q?s-static-types-bidirectional]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit First slice of Phase 3 (bidirectional type checker). lib/go/types.sx defines: * go-ctx-empty / go-ctx-extend / go-ctx-lookup — context as a value. * go-ctx-extend-field — consumes the (:field NAMES TYPE) shape from the parser, binding every name to the shared type. This is the cross-deliverable validation of the :field binding-group observation made during Phase 2 func decls: parser produces it, type checker consumes it, same shape end-to-end. * go-predeclared — true / false / nil baked in. Full list expanded on demand. * go-synth — currently handles variable lookup; literals / calls / binops follow in subsequent iterations. * go-check — v0 defers to synth + structural type equality. Untyped- constant flow and assignment-compatibility relations land later. * Type errors carry first-class tags (:unbound, :mismatch, :unsupported-synth) so consumers and tooling can dispatch. Conformance.sh wired with new types suite. Scoreboard cleanup: drop the "pending" types row since the suite is now real. types 12/12, total 317/317. Phase 3 underway. Sister-plan static-types-bidirectional diary updated with the synth/check shape: judgment skeleton, error tag structure, and the proposal that `check` should accept a `subtype?` predicate parameter so each consumer (Go untyped-constants, TS variance, Rust lifetimes) plugs in its own variance discipline without rewriting the judgment. Co-Authored-By: Claude Opus 4.7 (1M context) --- lib/go/conformance.sh | 7 +- lib/go/scoreboard.json | 6 +- lib/go/scoreboard.md | 4 +- lib/go/tests/types.sx | 111 ++++++++++++++++ lib/go/types.sx | 125 ++++++++++++++++++ plans/go-on-sx.md | 48 ++++--- plans/lib-guest-static-types-bidirectional.md | 30 +++++ 7 files changed, 307 insertions(+), 24 deletions(-) create mode 100644 lib/go/tests/types.sx create mode 100644 lib/go/types.sx diff --git a/lib/go/conformance.sh b/lib/go/conformance.sh index b978edf8..c7d1127a 100755 --- a/lib/go/conformance.sh +++ b/lib/go/conformance.sh @@ -29,6 +29,7 @@ trap "rm -f $TMPFILE $OUTFILE" EXIT SUITES=( "lex|go-test-pass|go-test-count" "parse|go-parse-test-pass|go-parse-test-count" + "types|go-types-test-pass|go-types-test-count" ) cat > "$TMPFILE" <<'EPOCHS' @@ -38,8 +39,10 @@ cat > "$TMPFILE" <<'EPOCHS' (load "lib/guest/pratt.sx") (load "lib/go/lex.sx") (load "lib/go/parse.sx") +(load "lib/go/types.sx") (load "lib/go/tests/lex.sx") (load "lib/go/tests/parse.sx") +(load "lib/go/tests/types.sx") EPOCHS idx=0 @@ -104,7 +107,6 @@ cat > lib/go/scoreboard.json < lib/go/scoreboard.md <