Phase 1 / Etch / Cross-file import (resolver pass-1)#35
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
M1.0.7 — Cross-file
import(resolver pass-1)Brief :
briefs/M1.0.7-cross-file-import.md(Status: CLOSED).Implements cross-file
importin Etch end-to-end: graduatesimportparser-up (lexer → AST → parser), builds the module dependency graph + topological order + cycle detection (E0108), a per-module byte-keyed exports index + import binding (E0103/E0104/E0107), and cross-arena component resolution that unblocks the E1793 false positive for.prefab.etch.Execution (E1→E6, one commit per slice)
feat(etch): graduate import to kw_import token—kw_importout ofnon_s3_keywords.feat(etch): add ImportDecl AST node + arena slabs—ImportDecl/ImportItem+ slabs +addImportDecl.feat(etch): parse import directive, 4 forms + recovery—parseImportDecl/parseImportItem, dispatch, sync-set.feat(etch): import module graph, topo order + E0108 cycle—deriveModulePath, graph, iterative DFS.feat(etch): per-module exports index + import binding—ProjectContextexports,bindImports(E0103/E0104/E0107).feat(etch): cross-file import resolution + E1793 unblock— importedTYPE_IDENTresolution +checkComponentInstancecross-arena.docs(claude-md): update for M1.0.7,docs: reframe foreign-field-type note as moot (not debt),docs(brief): close M1.0.7.Closing notes
importwas the last reserved top-level keyword innon_s3_keywords; the table-driven lexer made E1 trivial. The M0.9 byte-keyedProjectContextextended naturally to a per-module exports index; keying cross-file resolution on string BYTES (not per-arena StringIds) is the load-bearing idea and held end-to-end. The iterative DFS gives both the deps-first topological order and the E0108 back-edge in one pass. The cross-arena check localized tocheckComponentInstance+ onecheckInstanceFieldForeignhelper (every other validate pass already skips unknown item kinds;pass1Collectendselse => {}).test "selective import resolves a cross-file const"dropped (constis M1.0.8, not parseable here); cross-file resolution proven by the imported-component type test + the prefab unblock. FROZEN Acceptance edit logged under Accepted deviations (commit6d4f344).validateFieldsInDecl(.component_like)admits only builtin-POD field types, so the named-type branch is unreachable (forward-compat headroom, not a gap). (2)deriveModulePathstrips optionalsrc/+.etch/typed-compound ext,/→.; handles bare fixture names and realsrc/paths. (3) D-F (m.Type) and D-G (E0107) are wired-but-dormant, recorded so M1.0.8+ is additive.O(files+imports+exports), off any hot path).validateProjectcost did not move materially vs M1.0.6.m.Type(D-F),E0107activation (D-G, M1.0.8), cross-fileconstimport + test (M1.0.8).Validation (Étape 4)
importis the only graduated keyword;const/private/test/overrideuntouched)import_parse_test,import_resolve_test,crossfile_prefab_import_test).prefab.etchimporting its components validates clean — asserted by the tests)zig build,zig build test,zig fmt --check,zig build lintgreenStatus: CLOSED, close date setcommit-msg+ pre-push hooks green on every commit🤖 Generated with Claude Code