cli: parse dereferenced places in inline borrow arguments
This commit is contained in:
1 parent
65e7a0a97c
commit
5f76e92ff3
17 files changed
+185
-2
No files matched your search
@@ -308,3 +308,9 @@ Independent E7006 review found that `module scope_move fn main()->u64 effects []
|
||||
Clarify whether `let`/`move` aliases and rebinding of a scope name are permitted, how their availability relates to the originating block, and which existing diagnostic applies to rejected forms. Keep AIR scope identity, live-child/loan checks, deterministic completion and the no-escape invariant intact; add source acceptance/rejection tests for the chosen contract before changing lowering. This is separate from DD-017's reason field and RFC 0038's proposed repairs; neither adopts a new scope rule.
|
||||
|
||||
**Resolved (DD-020, spec 15 §7):** a source scope name is a lexical identifier usable only as the named first operand of `task.spawn`. Ordinary `s`/`move s` value uses reject E7006 `invalid_expression`, with `name` and `type: scope`; borrowing remains E7006 `invalid_place`. Ordinary shadowing remains legal and never replaces the originating block's saved completion identity. Source/AIR tests retain existing live-child and loan rules, deterministic completion and function-local AIR scope flow. Previously accepted aliases and scope-valued expressions now reject; no new syntax, reason, code or verifier/runtime state is added. This resolves one P6-2 question, not the phase.
|
||||
|
||||
## Q-042 — Source type-position validation before AIR verification
|
||||
|
||||
Read-only P6-2 review reproduced `module nested fn f(p: ref<ref<u64>>) -> void effects [] {} fn main() -> void effects [] {}` on the preceding compiler. It reaches the verifier and reports E1001 (`position: borrowed`, `found: ref<u64>`) at the source function. Spec 15 §10 requires errors fully decided by source types to be reported as E7xxx, and the AIR type-position rule already rejects this referent. This is an existing frontend validation gap, independent of dereferenced argument parsing; no new borrow semantics is proposed.
|
||||
|
||||
Audit source type-position checks against the existing verifier rules, including unused generic signatures where a restriction is already known. Add valid/rejected source fixtures and report E7005 at the offending type annotation before generating invalid AIR; preserve the AIR rules and determine compatibility for existing source diagnostic consumers. The extent beyond this reproduced nested-borrow case is unverified.
|
||||
@@ -227,3 +227,13 @@ Validation: unit tests, formatting checks and full conformance pass, 1,225/1,225
|
||||
Q-023 is resolved in spec 15 §5 / DD-021. Explicit temporary arguments preserve the array for a known ref/mut array parameter, including specialized and imported calls; other arguments and borrow bindings retain slice behavior. Shared reborrows and child-first temporary cleanup use existing AIR primitives. Exact types/lengths/modes, aliasing, bounds, named retained origins and task loans remain authoritative. Local whole-array bindings cannot serve as array-borrow origins or task loans; forwarding an existing array-borrow parameter can. No syntax, instruction, code, feature, verifier/runtime state or frozen evaluation input changes. Source bundle growth is recorded in docs/agent/README.md; AIR is unchanged. P6-5 remains open.
|
||||
|
||||
Validation: 32 new conformance cases pass with per-instruction collection and 200 scheduler seeds; full conformance is 1,257/1,257 and unit tests pass. CLI integration passes 85 checks, including deterministic/hosted and package provenance. Formatter checks 971 public files (963 parsed, eight existing syntax errors, 624 identical AIR outputs); source coverage is 121/121. Old/new CLI comparison over the 940 preceding public sources retains all diagnostic outputs and 606 successful canonical lowerings. Independent read-only Claude review passes.
|
||||
|
||||
## P6-2 dereferenced argument places (2026-10-07)
|
||||
|
||||
The existing grammar (`place = … | "*" unary`) and spec 15 §5 permit `ref *p` / `mut *p` as call arguments. The parser formerly rejected the leading `*`, although `ref (*p)` worked. Inline borrow parsing now admits that existing dereference production, preserving postfix binding and stopping before outer binary/cast operations. Other invalid prefix operands remain syntax errors. No normative rule, syntax form, diagnostic code, bundle, feature, verifier/runtime state or evaluation input changes; P6-2 remains open.
|
||||
|
||||
The invariant is unchanged borrow mode, aliasing, provenance and child-first temporary cleanup through existing AIR verification. Runtime and deterministic interpreter semantics are unchanged. Positive source examples forward shared/mutable scalar, array and generic parameters; rejected examples retain E7005 for invalid referents/modes, E2101 for aliasing, and E7006 for misplaced/unchecked borrows. Former syntax errors for these grammatical places now reach those semantic checks; previously accepted source retains canonical AIR. Two parser regression groups failed before the fix and cover precedence, complete ranges, comments and CRLF. Formatter checks compare bare and parenthesized spellings and preserve canonical AIR.
|
||||
|
||||
Read-only review also found a missing formatter space in grouped `ref (*p)` / `mut (*p)` arguments. The grouped-form regression failed before correcting the keyword spacing; both spellings now preserve tokens and canonical AIR. The separate existing source type-position gap is recorded as Q-042 without changing its semantics here.
|
||||
|
||||
Validation: 12 new conformance tests pass with per-instruction collection; full conformance is 1,269/1,269 and unit tests 126/126. Formatter passes 4,357 checks over 983 public files (975 parsed, eight existing syntax errors, 631 identical AIR outputs); source coverage stays 121/121. Old/new CLI comparison over the 971 preceding public sources preserves all diagnostics and 624 successful canonical lowerings. Final independent Claude review passes.
|
||||
Reference in new issue
Block a user