go: Phase 8 first slice — stdlib strings/strconv, 41 tests, +40 cleared [shapes-static-types-bidirectional]
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 31s

New :go-package NAME ENTRIES value type with field lookup via
extended go-eval-select. New :go-builtin-fn callable for closure-
based stdlib functions. lib/go/std/strings.sx ships 12 functions
(Contains, HasPrefix, HasSuffix, Index, Count, Repeat, Join,
ToUpper, ToLower, TrimSpace, Split, Replace) + lib/go/std/strconv.sx
ships Itoa/Atoi.

Pre-existing bug fixed: parser was emitting (:literal V) for both
`42` and `"42"`, relying on first-char heuristic in eval/types.
Now emits :literal-string for string/rune literals so Atoi("42")
correctly receives the string. 3 parse tests + 2 in-composite-key
tests updated to new shape.

Total 597/597. Stdlib 41/41 — +40 acceptance bar cleared. Sister
diary documents the 11 value-type kinds (struct/slice/map/chan/
fn/method/builtin/builtin-fn/package/panic/defer) all sharing the
"(:KIND PAYLOAD...)" shape, alongside AST nodes and sentinel signals
as the kit's three orthogonal first-class-tag axes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-28 02:14:55 +00:00
parent a7902df365
commit 8c91b34264
12 changed files with 802 additions and 38 deletions

View File

@@ -22,10 +22,10 @@
(go-parse-test "leading-dot float" (go-parse ".5") (ast-literal ".5"))
(go-parse-test "exponent float" (go-parse "1e10") (ast-literal "1e10"))
(go-parse-test "imag literal" (go-parse "2i") (ast-literal "2i"))
(go-parse-test "string literal" (go-parse "\"hi\"") (ast-literal "hi"))
(go-parse-test "empty string" (go-parse "\"\"") (ast-literal ""))
(go-parse-test "raw string" (go-parse "`a\nb`") (ast-literal "a\nb"))
(go-parse-test "rune literal" (go-parse "'a'") (ast-literal "a"))
(go-parse-test "string literal" (go-parse "\"hi\"") (list :literal-string "hi"))
(go-parse-test "empty string" (go-parse "\"\"") (list :literal-string ""))
(go-parse-test "raw string" (go-parse "`a\nb`") (list :literal-string "a\nb"))
(go-parse-test "rune literal" (go-parse "'a'") (list :literal-string "a"))
;; ── primary: identifiers ──────────────────────────────────────────
(go-parse-test "ident: simple" (go-parse "x") (ast-var "x"))
@@ -262,7 +262,7 @@
(go-parse-test
"index: m[\"key\"] (string index)"
(go-parse "m[\"key\"]")
(list :index (ast-var "m") (ast-literal "key")))
(list :index (ast-var "m") (list :literal-string "key")))
(go-parse-test
"index: a[0][1] (chained)"
@@ -691,8 +691,8 @@
(list
:composite (list :ty-map (list :ty-name "string") (list :ty-name "int"))
(list
(list :kv (ast-literal "a") (ast-literal "1"))
(list :kv (ast-literal "b") (ast-literal "2")))))
(list :kv (list :literal-string "a") (ast-literal "1"))
(list :kv (list :literal-string "b") (ast-literal "2")))))
(go-parse-test
"comp: pkg.Point{1, 2} (qualified type)"