cli: validate Copy content of source owning arrays
This commit is contained in:
1 parent
caf3b86e80
commit
cfbe01a16f
42 files changed
+608
-3
No files matched your search
@@ -319,4 +319,16 @@ Read-only P6-2 review reproduced `module nested fn f(p: ref<ref<u64>>) -> void e
|
||||
|
||||
Read-only review after Q-042 reproduced `module nested fn unused(p: own_array<own<u64>>) -> void effects [] { trap; } fn main() -> void effects [] {}`. It reaches the AIR verifier with E1001, `dynamic heap arrays require Copy content`. Spec 03 §25 requires Copy content for `own_array<T>`, and spec 15 §10 requires fully source-type-decided errors to be E7xxx. This is a content-property check, not a structural type position. Graph-content properties and Send/Share checks retain their separately specified verifier diagnostics.
|
||||
|
||||
Audit this source check, including nominal and substituted generic content, then add positive/rejected source tests and report E7005 before emitting invalid AIR. Preserve AIR's Copy predicate, type identity, allocation/cleanup rules and deterministic behavior. The extent beyond the reproduced signature is unverified.
|
||||
**Resolved (spec 15 §10):** annotation and repeated-allocation checks report E7005 at the non-Copy content/value, with `constraint: Copy` and `type_constructor: own_array`. The shared AST property query follows nominal fields and enum payloads in their declaring namespace, honors user types before built-in names, and keeps `iref` content phantom. Unused generic/static headers reject when linear content is already known; unknown parameter properties wait for substitution. Recursive generic paths are distinguished by the known-linear parameter vector, so parameter rotations cannot hide a known linear leaf. Pure by-value cycles retain E1003; a proven Copy-content violation may reject before a simultaneous layout error. Graph-root content checks retain E2111. AIR acceptance, codes, type identity, allocation/cleanup and interpreter behavior are unchanged; invalid source programs now stop earlier instead of producing invalid AIR. No new syntax, code, feature or verifier/runtime state is introduced.
|
||||
|
||||
## Q-044 — Nominal linearity query cost before layout rejection
|
||||
|
||||
Q-043 review identified a separate existing cost in `Lowerer.linearAt`: repeated fields and by-value cycles revisit nominal declarations until its depth bound, with no shared-result cache. `checkRequirements` asks this query before `checkFiniteLayouts` rejects E1003. The bound guarantees finite recursion but does not bound the number of branching revisits. Q-043's new annotation query has counted tests for shared acyclic/cyclic branches; the old classification query is unchanged. The precise cost and scope of other nominal property queries remain unverified.
|
||||
|
||||
Audit the existing classification/layout ordering and shared-query cost with counted tests, preserving structural ownership classes, graph/iref boundaries, source E1003 provenance, accepted-source canonical AIR and frozen AIR behavior. Avoid wall-clock timeout tests. This is an implementation audit, not a new recursion or memory rule.
|
||||
|
||||
## Q-045 — Source array literals with second-class elements
|
||||
|
||||
Q-043 review reproduced `fn unused(p: ref<u64>) -> void effects [] { let a = [p, p]; }`: the source array literal reaches AIR type checking with E1001 because borrows cannot be stored as array elements. Q-042 validates annotations; an inferred literal has none. Q-043 now rejects that array as a repeated `own.array` value, but constructing it without that operation remains a separate source validation gap.
|
||||
|
||||
Audit inferred list/repeat literals against existing member-position and Copy-duplication rules, including nested arrays and nominal values. Add source positives/rejections with E7005 at the offending source value while preserving explicit moves in fixed linear arrays, borrow provenance and frozen AIR semantics. Scope beyond this reproduced literal remains unverified.
|
||||
Reference in new issue
Block a user