diff --git a/docs/design/open-questions.md b/docs/design/open-questions.md index 88b893d..e30e02c 100644 --- a/docs/design/open-questions.md +++ b/docs/design/open-questions.md @@ -139,6 +139,8 @@ The SB litmus test requires the interpreter not to forbid `r1=0, r2=0` under rel `f32`/`f64` are listed in spec 02 §1 but reserved by spec 07 §8.4: AIR rejects their use with `E0006`, reason `reserved_type`, and `.aji` 0.1 exposes no floating-point types. They do not create a determinism gap in currently accepted programs. This question remains open for future activation: NaN payloads, fused operations, rounding mode and denormals need explicit rules before floating point can participate in deterministic replay. +Source naming also needs an activation decision: `.aji` currently accepts nominal declarations such as `struct f64 { value: u8 }`; their uses lower to `@f64`, not the reserved AIR primitive `f64`. An undeclared `f64` is an ordinary E7002 unknown name. Future primitive activation needs an explicit source-name and backward-compatibility policy for these existing nominal programs. + ## Q-017 — Replay file format Spec 11 §4 mentions `.ajr` files without a format or compatibility rule. diff --git a/docs/plan/phase-6-source-language.md b/docs/plan/phase-6-source-language.md index 2d19a86..de384f9 100644 --- a/docs/plan/phase-6-source-language.md +++ b/docs/plan/phase-6-source-language.md @@ -320,8 +320,8 @@ Validation: unit tests and Zig formatting pass; full conformance is 1,655/1,655. ## P6-7 public rejection-twin audit (2026-10-08) -Verified same-code coverage is 77/199. Audited pairs cover owner/file/receiver leaks, use after transfer, authority/effects, unsafe calls, Send/Share, live task loans, mutex guards, graph content/access, atomic orders/effects, linear unpack/projection, buffer views/failure, static calls and recursive layouts. Independent markers verify instruction, outcome-block and function/type declaration positions. An island-destroy fixture retains a child object borrow and its subsequent load; witnesses preserve discarded-unpack and returned-buffer-failure contexts. Failed-send closed/cancelled edges converge at one source error, matching AIR's merged failure path. E3101 callee identities resolve to their explicit flat effect sets. Send/Share argument comparisons preserve the complete rejected parameter type while normalizing worker/SSA names; source/raw identities and related values remain identical. The producer lookup recognizes island.borrow as a borrow. Three buffer pairs retain shared-view push exclusion, reserve effects and capability kind. Error-value and borrowed-element analogues keep their source-prescribed E7xxx codes; missing feature/dependency headers and reserved primitive floats are AIR-only. A user nominal f64 lowers to @f64 and does not exercise the reserved primitive rule. The legacy reserved_feature comment describes its actual missing_dependency rejection; its body and permanent name are unchanged. The inventory retains 68 pending, 23 E7xxx analogues and 31 AIR-only cases, all still unmet under Q-053. P6-7 remains doing. +Verified same-code coverage is 79/199. Audited pairs cover owner/file/receiver leaks, use after transfer, authority/effects, unsafe calls, Send/Share, live task loans, mutex guards, graph content/access, atomic orders/effects, linear unpack/projection, buffer views/failure, static calls and recursive layouts. Independent markers verify instruction, outcome-block and function/type declaration positions. An island-destroy fixture retains a child object borrow and its subsequent load; witnesses preserve discarded-unpack and returned-buffer-failure contexts. Failed-send closed/cancelled edges converge at one source error, matching AIR's merged failure path. E3101 callee identities resolve to their explicit flat effect sets. Send/Share argument comparisons preserve the complete rejected parameter type while normalizing worker/SSA names; source/raw identities and related values remain identical. The producer lookup recognizes island.borrow as a borrow. Three buffer pairs retain shared-view push exclusion, reserve effects and capability kind. Error-value and borrowed-element analogues keep their source-prescribed E7xxx codes; missing feature/dependency headers and reserved primitive floats are AIR-only. A user nominal f64 lowers to @f64 and does not exercise the reserved primitive rule. Module-level cancellation activated by a shield helper preserves the join-wait rule; a taken mutex preserves E3001 on its next borrow. Linear match/unpack, buffer operand/outcome and file-mode analogues keep their prescribed source diagnostics. Legacy nested-owner/resource signatures require the now-published linear_aggregates header, generated automatically in source. Q-016 records the nominal f64 naming decision needed before primitive activation. The legacy reserved_feature comment describes its actual missing_dependency rejection; its body and permanent name are unchanged. The inventory retains 42 pending, 34 E7xxx analogues and 44 AIR-only cases, all still unmet under Q-053. P6-7 remains doing. The diamond budget pair requires an identical named type-declaration table so equal-sized flat arrays cannot replace its shared nominal graph. Early cycle pairs, which produce no canonical AIR, pin both manually audited files with SHA-256; edits require a fresh context review while compiled diagnostics and positions remain checked. Exact opcode counts preserve the shared-view push function shape; an operand witness links the reported conflicting borrow to buffer.view, excluding ended decoys and views of other buffers. These are explicit fixture witnesses, not a second type/layout evaluator or proof of the manual audit. -Validation: full conformance is 1,680/1,680; unit tests, Zig formatting, all 41 checker regressions and the 77-pair source/AIR position check pass. All 38 source reject_twins fixtures pass collection before every instruction; source coverage remains 121/121. The completion gate still rejects partial coverage. Claude independently audited the new buffer pairs, six E7xxx analogues and five AIR-only cases. Its exclusive-view, ended-view and other-buffer decoy findings are covered by regressions and the opcode/operand witnesses. No compiler, verifier, runtime, normative rule, diagnostic code or reference bundle changes. +Validation: full conformance is 1,688/1,688; unit tests, Zig formatting, all 41 checker regressions and the 79-pair source/AIR position check pass. All 46 source reject_twins fixtures pass collection before every instruction; source coverage remains 121/121. The completion gate still rejects partial coverage. Claude independently audited the two new same-code pairs, eleven E7xxx analogues and thirteen AIR-only classifications, including exact structured fields, markers and governing rules. Earlier exclusive-view, ended-view and other-buffer decoys remain covered by regressions and the opcode/operand witnesses. No compiler, verifier, runtime, normative rule, diagnostic code or reference bundle changes. diff --git a/tests/conformance/buffers/new_return_type.air b/tests/conformance/buffers/new_return_type.air index 610914b..c9f231d 100644 --- a/tests/conformance/buffers/new_return_type.air +++ b/tests/conformance/buffers/new_return_type.air @@ -1,3 +1,4 @@ +; The outcome header first rejects own_array> because own_array content must be Copy. ; expect: reject E1001 ; phase: 6 ; spec: docs/spec/07a-air-instructions.md Dynamic buffers diff --git a/tests/conformance/phase2/reject/own_nested.air b/tests/conformance/phase2/reject/own_nested.air index 9d73155..58573bc 100644 --- a/tests/conformance/phase2/reject/own_nested.air +++ b/tests/conformance/phase2/reject/own_nested.air @@ -1,4 +1,4 @@ -; own> nests linear values. +; Nested owners require the published linear_aggregates feature, absent here. ; expect: reject E0006 ; phase: 2 ; spec: docs/spec/03-memory-model.md diff --git a/tests/conformance/phase2/reject/own_of_resource.air b/tests/conformance/phase2/reject/own_of_resource.air index 90920e8..0c22655 100644 --- a/tests/conformance/phase2/reject/own_of_resource.air +++ b/tests/conformance/phase2/reject/own_of_resource.air @@ -1,4 +1,4 @@ -; own> would let own.free drop an open file. +; Owning resource content requires linear_aggregates, absent here; own.free still cannot discard linear content. ; expect: reject E0006 ; phase: 2 ; spec: docs/spec/03-memory-model.md diff --git a/tests/conformance/phase2/reject/resource_in_struct.air b/tests/conformance/phase2/reject/resource_in_struct.air index cf11497..5b59f0e 100644 --- a/tests/conformance/phase2/reject/resource_in_struct.air +++ b/tests/conformance/phase2/reject/resource_in_struct.air @@ -1,4 +1,4 @@ -; Resources in aggregates need the reserved feature linear_aggregates. +; Resources in aggregates require the published linear_aggregates feature, absent here. ; expect: reject E0006 ; phase: 2 ; spec: docs/spec/06-resources-and-errors.md diff --git a/tests/conformance/reject-twins.json b/tests/conformance/reject-twins.json index b1f5b13..efcd6ff 100644 --- a/tests/conformance/reject-twins.json +++ b/tests/conformance/reject-twins.json @@ -1049,6 +1049,268 @@ "kind": "air_only", "spec": "docs/spec/15-source-language.md \u00a73", "rule": "Source has no built-in f32/f64 type (spec 07 \u00a78.4). An undeclared f64 spelling is an ordinary E7002 unknown name; a user nominal f64 lowers to @f64 and cannot produce the reserved AIR primitive f64. Neither tests the reserved_type rule. Spec 15 \u00a71 restricts source to published features." + }, + "phase3/reject/cancel_join_needs_wait.air": { + "kind": "same_code", + "site": "instruction", + "spec": "docs/spec/04-concurrency-and-atomics.md \u00a737.4", + "rule": "In a module declaring cancellation, task.join requires task.wait. Source declares cancellation via a shield helper in the same module, preserving main's task.spawn contract and its suggested effects.", + "required_ops": { + "task.spawn": 1, + "task.join": 1 + } + }, + "phase3/reject/sync_use_after_take.air": { + "kind": "same_code", + "site": "instruction", + "spec": "docs/spec/04-concurrency-and-atomics.md \u00a732", + "rule": "A mutex is borrowed again after mutex.take consumed it; the source lock begins with that same borrow.ref.", + "required_ops": { + "mutex.take": 1 + } + }, + "phase2/reject/own_nested.air": { + "kind": "air_only", + "spec": "docs/spec/15-source-language.md \u00a79", + "rule": "The existing AIR rejects a missing feature header, not the type itself. Source lowering automatically includes capabilities or the published linear_aggregates feature and its closure for these types." + }, + "phase2/reject/own_of_resource.air": { + "kind": "air_only", + "spec": "docs/spec/15-source-language.md \u00a79", + "rule": "The existing AIR rejects a missing feature header, not the type itself. Source lowering automatically includes capabilities or the published linear_aggregates feature and its closure for these types." + }, + "phase2/reject/resource_in_struct.air": { + "kind": "air_only", + "spec": "docs/spec/15-source-language.md \u00a79", + "rule": "The existing AIR rejects a missing feature header, not the type itself. Source lowering automatically includes capabilities or the published linear_aggregates feature and its closure for these types." + }, + "phase2/reject/cap_without_feature.air": { + "kind": "air_only", + "spec": "docs/spec/15-source-language.md \u00a79", + "rule": "The existing AIR rejects a missing feature header, not the type itself. Source lowering automatically includes capabilities or the published linear_aggregates feature and its closure for these types." + }, + "phase5/reject/struct_field.air": { + "kind": "air_only", + "spec": "docs/spec/15-source-language.md \u00a79", + "rule": "The existing AIR rejects a missing feature header, not the type itself. Source lowering automatically includes capabilities or the published linear_aggregates feature and its closure for these types." + }, + "phase2/reject/unsafe_trusted_without_feature.air": { + "kind": "air_only", + "spec": "docs/spec/15-source-language.md \u00a72", + "rule": "A source trusted clause always rejects E7006 as forbidden, independently of obligation or effects. The AIR trusted declaration rules for an empty obligation, an unsafe boundary contract or a missing feature therefore cannot be isolated in source." + }, + "phase2/reject/unsafe_trusted_declares_unsafe.air": { + "kind": "air_only", + "spec": "docs/spec/15-source-language.md \u00a72", + "rule": "A source trusted clause always rejects E7006 as forbidden, independently of obligation or effects. The AIR trusted declaration rules for an empty obligation, an unsafe boundary contract or a missing feature therefore cannot be isolated in source." + }, + "phase2/reject/unsafe_empty_obligation.air": { + "kind": "air_only", + "spec": "docs/spec/15-source-language.md \u00a72", + "rule": "A source trusted clause always rejects E7006 as forbidden, independently of obligation or effects. The AIR trusted declaration rules for an empty obligation, an unsafe boundary contract or a missing feature therefore cannot be isolated in source." + }, + "linear/enum_incomplete.air": { + "kind": "source_error", + "spec": "docs/spec/15-source-language.md \u00a716", + "rule": "A linear enum match move omits Maybe::none; source rejects the incomplete consuming match with E7004 before emitting enum.take.", + "analogues": [ + { + "source": "source/reject_twins/analogue_enum_incomplete.aji", + "codes": [ + "E7004" + ], + "fields": { + "missing": "Maybe::none" + } + } + ] + }, + "linear/unpack_count.air": { + "kind": "source_error", + "spec": "docs/spec/15-source-language.md \u00a716", + "rule": "array.unpack of a one-element linear array binds two components. Source rejects the authored extra binding before emitting an AIR continuation.", + "analogues": [ + { + "source": "source/reject_twins/analogue_unpack_count.aji", + "codes": [ + "E7005" + ], + "fields": {} + } + ] + }, + "buffers/metadata_owner.air": { + "kind": "source_error", + "spec": "docs/spec/15-source-language.md \u00a717", + "rule": "buffer.len receives an owner instead of the required named ref/mut buffer binding; source checks that operand form before AIR.", + "analogues": [ + { + "source": "source/reject_twins/analogue_metadata_owner.aji", + "codes": [ + "E7005" + ], + "fields": {} + } + ] + }, + "buffers/push_continuation_count.air": { + "kind": "source_error", + "spec": "docs/spec/15-source-language.md \u00a717", + "rule": "The authored buffer.push success arm binds an extra value although ok has zero bindings. This source outcome-arity error rejects before AIR.", + "analogues": [ + { + "source": "source/reject_twins/analogue_push_continuation_count.aji", + "codes": [ + "E7005" + ], + "fields": { + "outcome": "ok", + "expected": "0" + } + } + ] + }, + "buffers/new_count_type.air": { + "kind": "source_error", + "spec": "docs/spec/15-source-language.md \u00a710", + "rule": "buffer.new receives a u64 capacity instead of usize; the source operand type rule preserves both types in E7005.", + "analogues": [ + { + "source": "source/reject_twins/analogue_new_count_type.aji", + "codes": [ + "E7005" + ], + "fields": { + "expected": "usize", + "found": "u64" + } + } + ] + }, + "linear/enum_switch.air": { + "kind": "source_error", + "spec": "docs/spec/15-source-language.md \u00a716", + "rule": "An ordinary match on a named linear enum needs explicit move; source rejects E7003 before the invalid enum.switch.", + "analogues": [ + { + "source": "source/linear/plain_enum_match.aji", + "codes": [ + "E7003" + ], + "fields": { + "name": "old" + } + } + ] + }, + "buffers/new_return_type.air": { + "kind": "source_error", + "spec": "docs/spec/15-source-language.md \u00a710", + "rule": "Despite the AIR filename, the first rejection is the non-Copy content of own_array> on its outcome block parameter. Source checks that same content rule at the annotation.", + "analogues": [ + { + "source": "source/own_array_content/owner.aji", + "codes": [ + "E7005" + ], + "fields": { + "constraint": "Copy", + "type_constructor": "own_array" + } + } + ] + }, + "phase2/reject/wrong_file_mode.air": { + "kind": "source_error", + "spec": "docs/spec/15-source-language.md \u00a710", + "rule": "fs.write_all requires a writable file; source rejects file at its operand before emitting the invalid intrinsic.", + "analogues": [ + { + "source": "source/layer6/reject/wrong_mode.aji", + "codes": [ + "E7005" + ], + "fields": { + "expected": "file or file", + "found": "file" + } + } + ] + }, + "phase2/reject/unknown_capability_kind.air": { + "kind": "source_error", + "spec": "docs/spec/15-source-language.md \u00a710", + "rule": "An unregistered capability kind rejects E7002 in source. AIR uses root and the existing source analogue uses unknown; neither can be registered by a program.", + "analogues": [ + { + "source": "source/diagnostic_envelope/capability_kind_unknown.aji", + "codes": [ + "E7002" + ], + "fields": { + "capability_kind": "unknown" + } + } + ] + }, + "buffers/reserve_count_type.air": { + "kind": "source_error", + "spec": "docs/spec/15-source-language.md \u00a710", + "rule": "buffer.reserve receives a u64 capacity instead of usize; source reports E7005 for the same operand type mismatch.", + "analogues": [ + { + "source": "source/reject_twins/analogue_buffer_reserve_count_type.aji", + "codes": [ + "E7005" + ], + "fields": { + "expected": "usize", + "found": "u64" + } + } + ] + }, + "buffers/push_type.air": { + "kind": "source_error", + "spec": "docs/spec/15-source-language.md \u00a710", + "rule": "buffer.push into a buffer> receives a u64 value; source rejects the content type mismatch with E7005.", + "analogues": [ + { + "source": "source/reject_twins/analogue_buffer_push_type.aji", + "codes": [ + "E7005" + ], + "fields": { + "expected": "own", + "found": "u64" + } + } + ] + }, + "linear/array_count.air": { + "kind": "air_only", + "spec": "docs/spec/15-source-language.md \u00a71", + "rule": "A source list literal fixes its own array length and supplies every element. The AIR mismatch between declared array.make length and input count is generated mechanics; a source annotation mismatch is a different type rule." + }, + "buffers/pop_return_type.air": { + "kind": "air_only", + "spec": "docs/spec/15-source-language.md \u00a71", + "rule": "The pop success binding type is generated from buffer. Source outcome bindings cannot annotate an incompatible type; a later let annotation mismatch is a different rule." + }, + "buffers/free_return_type.air": { + "kind": "air_only", + "spec": "docs/spec/15-source-language.md \u00a71", + "rule": "The free error binding is generated as the returned buffer. Source cannot annotate that outcome binding as own; a later variable annotation mismatch is a different rule." + }, + "error_values/unknown_family.air": { + "kind": "air_only", + "spec": "docs/spec/15-source-language.md \u00a76", + "rule": "Only registered built-in error families lower to error.const. An undeclared family spelling in source is ordinary enum-name resolution (E7002); a user enum of that name lowers to enum.make @Name, never an unregistered error.const family." + }, + "error_values/frozen_enum_make.air": { + "kind": "air_only", + "spec": "docs/spec/15-source-language.md \u00a76", + "rule": "Built-in error expressions lower to error.const with error_values and its closure. Source cannot choose the frozen legacy enum.make spelling for a built-in error family; user nominal enums use a distinct @Name type." } } } diff --git a/tests/conformance/source/diagnostic_envelope/capability_kind_unknown.aji b/tests/conformance/source/diagnostic_envelope/capability_kind_unknown.aji index e597ad8..7afd62e 100644 --- a/tests/conformance/source/diagnostic_envelope/capability_kind_unknown.aji +++ b/tests/conformance/source/diagnostic_envelope/capability_kind_unknown.aji @@ -2,4 +2,4 @@ // phase: 6 // spec: docs/spec/10-diagnostics-and-agent-protocol.md §2 module diagnostic.unknown_capability -fn main(c: cap) -> void effects [] {} +fn main(c: cap) -> void effects [] {} // diagnostic here: cap diff --git a/tests/conformance/source/layer6/reject/wrong_mode.aji b/tests/conformance/source/layer6/reject/wrong_mode.aji index 170bc80..a1ac399 100644 --- a/tests/conformance/source/layer6/reject/wrong_mode.aji +++ b/tests/conformance/source/layer6/reject/wrong_mode.aji @@ -8,6 +8,6 @@ fn main(src: cap) -> void effects [fs.read, fs.write] { let f = fs.open_read(src, b"/in/a") or trap; - fs.write_all(f, b"x") or trap; + fs.write_all(f, b"x") or trap; // diagnostic here: f, b fs.close(move f) or trap; } diff --git a/tests/conformance/source/layer8/reject/use_after_take.aji b/tests/conformance/source/layer8/reject/use_after_take.aji index 87fe534..813f10c 100644 --- a/tests/conformance/source/layer8/reject/use_after_take.aji +++ b/tests/conformance/source/layer8/reject/use_after_take.aji @@ -2,6 +2,7 @@ // expect: reject E3001 // phase: 6 // spec: docs/spec/15-source-language.md +// AIR twin: phase3/reject/sync_use_after_take.air module demo.use_after_take fn main() -> u64 @@ -9,7 +10,7 @@ effects [task.wait] { let m = mutex.make(1u64); let v = mutex.take(move m); - lock ref m as c { + lock ref m as c { // diagnostic here: m as c *c = 2; } cancelled {} v diff --git a/tests/conformance/source/linear/plain_enum_match.aji b/tests/conformance/source/linear/plain_enum_match.aji index 0924978..2b0ca7e 100644 --- a/tests/conformance/source/linear/plain_enum_match.aji +++ b/tests/conformance/source/linear/plain_enum_match.aji @@ -12,5 +12,5 @@ fn main(heap: cap) -> u64 effects [mem.alloc] { var value: Maybe> = Maybe::>::some(move owner); let old = replace(mut value); match move value { Maybe::>::none => {}, Maybe::>::some(extra) => { own.free(move extra); } } - match old { Maybe::>::some(part) => { return own.take(move part); } Maybe::>::none => { return 0; } } + match old { Maybe::>::some(part) => { return own.take(move part); } Maybe::>::none => { return 0; } } // diagnostic here: old { } diff --git a/tests/conformance/source/own_array_content/owner.aji b/tests/conformance/source/own_array_content/owner.aji index 58cd206..f494149 100644 --- a/tests/conformance/source/own_array_content/owner.aji +++ b/tests/conformance/source/own_array_content/owner.aji @@ -2,5 +2,5 @@ // phase: 6 // spec: docs/spec/15-source-language.md §10; docs/spec/03-memory-model.md §25 module test.own_array_content -fn unused(p: own_array>) -> void effects [] { trap; } +fn unused(p: own_array>) -> void effects [] { trap; } // diagnostic here: own>) -> fn main() -> void effects [] {} diff --git a/tests/conformance/source/reject_twins/analogue_buffer_push_type.aji b/tests/conformance/source/reject_twins/analogue_buffer_push_type.aji new file mode 100644 index 0000000..0102b86 --- /dev/null +++ b/tests/conformance/source/reject_twins/analogue_buffer_push_type.aji @@ -0,0 +1,13 @@ +// expect: reject E7005 +// phase: 6 +// spec: docs/spec/15-source-language.md §10 +module test.buffers +fn main(heap: cap) -> u64 effects [mem.alloc] { + let data = buffer.new>(1, heap) or trap; + { + mut b = data; + buffer.push(b, 42u64) or trap; // diagnostic here: 42u64 + } + buffer.free(move data) or trap; + return 42; +} diff --git a/tests/conformance/source/reject_twins/analogue_buffer_reserve_count_type.aji b/tests/conformance/source/reject_twins/analogue_buffer_reserve_count_type.aji new file mode 100644 index 0000000..7212c65 --- /dev/null +++ b/tests/conformance/source/reject_twins/analogue_buffer_reserve_count_type.aji @@ -0,0 +1,10 @@ +// expect: reject E7005 +// phase: 6 +// spec: docs/spec/15-source-language.md §10 +module test.buffers +fn main(heap: cap) -> u64 effects [mem.alloc] { + let data = buffer.new(1, heap) or trap; + { mut b = data; buffer.reserve(b, 2u64, heap) or trap; } // diagnostic here: 2u64 + buffer.free(move data) or trap; + return 42; +} diff --git a/tests/conformance/source/reject_twins/analogue_enum_incomplete.aji b/tests/conformance/source/reject_twins/analogue_enum_incomplete.aji new file mode 100644 index 0000000..89e2846 --- /dev/null +++ b/tests/conformance/source/reject_twins/analogue_enum_incomplete.aji @@ -0,0 +1,11 @@ +// expect: reject E7004 +// phase: 6 +// spec: docs/spec/15-source-language.md §6, §16 +module test.linear +enum Maybe { some(own), none } +fn main(heap: cap) -> u64 effects [mem.alloc] { + let owner = own.new(42u64, heap) or trap; + let slot = Maybe::some(move owner); + match move slot { Maybe::some(extra) => { own.free(move extra); } } // diagnostic here + return 0; +} diff --git a/tests/conformance/source/reject_twins/analogue_metadata_owner.aji b/tests/conformance/source/reject_twins/analogue_metadata_owner.aji new file mode 100644 index 0000000..2e98391 --- /dev/null +++ b/tests/conformance/source/reject_twins/analogue_metadata_owner.aji @@ -0,0 +1,10 @@ +// expect: reject E7005 +// phase: 6 +// spec: docs/spec/15-source-language.md §17 +module test.buffers +fn main(heap: cap) -> u64 effects [mem.alloc] { + let data = buffer.new(1, heap) or trap; + let n = buffer.len(data); // diagnostic here: data); + buffer.free(move data) or trap; + return 42; +} diff --git a/tests/conformance/source/reject_twins/analogue_new_count_type.aji b/tests/conformance/source/reject_twins/analogue_new_count_type.aji new file mode 100644 index 0000000..2a1079e --- /dev/null +++ b/tests/conformance/source/reject_twins/analogue_new_count_type.aji @@ -0,0 +1,9 @@ +// expect: reject E7005 +// phase: 6 +// spec: docs/spec/15-source-language.md §10, §17 +module test.buffers +fn main(heap: cap) -> u64 effects [mem.alloc] { + let data = buffer.new(1u64, heap) or trap; // diagnostic here: 1u64 + buffer.free(move data) or trap; + return 42; +} diff --git a/tests/conformance/source/reject_twins/analogue_push_continuation_count.aji b/tests/conformance/source/reject_twins/analogue_push_continuation_count.aji new file mode 100644 index 0000000..c5eb2aa --- /dev/null +++ b/tests/conformance/source/reject_twins/analogue_push_continuation_count.aji @@ -0,0 +1,8 @@ +// expect: reject E7005 +// phase: 6 +// spec: docs/spec/15-source-language.md §2, §17 +module buffer.contract +fn bad(b: mut>) -> void effects [] { + match buffer.push(b, 42u64) { ok(extra) => { trap; }, err(original) => { trap; } } // diagnostic here: ok(extra) +} +fn main() -> u64 effects [] { return 42; } diff --git a/tests/conformance/source/reject_twins/analogue_unpack_count.aji b/tests/conformance/source/reject_twins/analogue_unpack_count.aji new file mode 100644 index 0000000..3f0c4a6 --- /dev/null +++ b/tests/conformance/source/reject_twins/analogue_unpack_count.aji @@ -0,0 +1,10 @@ +// expect: reject E7005 +// phase: 6 +// spec: docs/spec/15-source-language.md §16 +module test.linear +fn bad(owner: own) -> u64 effects [] { + let items = [move owner]; + let (part, other) = array.unpack(move items); // diagnostic here + return own.take(move part); +} +fn main() -> u64 effects [] { return 42; } diff --git a/tests/conformance/source/reject_twins/cancel_join_needs_wait.aji b/tests/conformance/source/reject_twins/cancel_join_needs_wait.aji new file mode 100644 index 0000000..f77a87d --- /dev/null +++ b/tests/conformance/source/reject_twins/cancel_join_needs_wait.aji @@ -0,0 +1,16 @@ +// A shield in another function declares cancellation for the whole module. +// task.join therefore requires task.wait even though main has no cancellation point. +// expect: reject E3101 +// phase: 6 +// spec: docs/spec/04-concurrency-and-atomics.md §37.4; docs/spec/15-source-language.md §7 +// AIR twin: phase3/reject/cancel_join_needs_wait.air +module test.cancel_join_needs_wait +fn main() -> u8 effects [task.spawn] { + scope sc { + let t = task.spawn(sc, w); + let r = task.join(move t); // diagnostic here: task.join + return r; + } +} +fn w() -> u8 effects [] { return 0u8; } +fn cancellation_probe() -> void effects [] { shield { return; } }