You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Summary
Closes the parse half of **G6**, "the single highest-leverage v2
toolchain item" (`docs/v2-grammar-and-codegen-gaps-2026-06-16.adoc`).
Phase I (#43) already made an imported module's public items visible
**unqualified** (the cross-module test passes). This adds the qualified
**`M.member` syntax**, which previously errored at the parser with
*"Named field access not yet supported"*.
## The change (parser → surface AST → desugar)
- **Grammar** (`ephapax.pest`): `member_op` accepts a `constructor_name`
after `.`, so both `M.fn` (lower-case) and `M.Ctor` (upper-case) lex.
- **Surface AST**: new `SurfaceExprKind::FieldAccess { base, field }`.
- **Parser** (`surface.rs`): a named member access builds `FieldAccess`
instead of erroring.
- **Desugar** (`ephapax-desugar`): `FieldAccess` resolves against the
importer's imports — `M` is the **last path segment** of an `import`
(`import lib/math` → `math`) — to the unqualified member, reusing phase
I's shared scope:
- upper-case `member` → constructor (`Construct`),
- otherwise → function/value (`Var`).
- Unknown qualifier → clean `QualifiedAccessUnknownModule` error; member
access on a non-module base → rejected (record field access stays a
follow-up).
## Verified
- New fixture `tests/v2-grammar/fixtures/qualified-import/` + test
`src/ephapax-cli/tests/v2_grammar_phase_k_qualified.rs` (2 tests):
`lib.inc(...)` (qualified function), `lib.On` (qualified constructor),
and unqualified `inc` (phase I) all compile **end-to-end to wasm**; an
unknown qualifier is a clean error.
- Full **parser / desugar / surface / cli** suites pass — **no
regressions** (parser 62, etc.).
- `TEST-NEEDS.md` count bumped 486 → 488.
## Mapped to the doc
The G6 doc's first snippet (`Coproc.available(Coproc.Tensor)` not
parsing) is exactly this: `available`=function→`Var`, `Tensor`=nullary
constructor→`Construct`. Resolution note added to the gaps doc.
## Follow-ups (documented, out of scope here)
- `M.Ctor(args)` — qualified constructor *with arguments* currently
lowers to `App(Ctor, args)`, not `Construct{Ctor,[args]}`.
- Record field access on values (`value.field`) — still unsupported.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01AGFqWzByua4dKbA7W7oVsL
---
_Generated by [Claude
Code](https://claude.ai/code/session_01AGFqWzByua4dKbA7W7oVsL)_
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments