tests: extend rejection twins across public semantic features
This commit is contained in:
1 parent
272aebfd32
commit
06d8a1a76a
32 files changed
+396
-22
No files matched your search
@@ -318,8 +318,8 @@ Pairs compare operation/site, resource family, identity roles and stable rule fa
|
|||||||
|
|
||||||
Validation: unit tests and Zig formatting pass; full conformance is 1,655/1,655. All 13 new source fixtures pass collection before every instruction. The pair checker verifies 27/199 and reports incomplete coverage; its completion gate rejects that inventory. Existing borrow-return, related-position and source-coverage checks pass (133, 355 and 121/121 respectively). Claude independently audited Phase 0–1 cases and reviewed the checker; its false-pair findings are covered by regression probes.
|
Validation: unit tests and Zig formatting pass; full conformance is 1,655/1,655. All 13 new source fixtures pass collection before every instruction. The pair checker verifies 27/199 and reports incomplete coverage; its completion gate rejects that inventory. Existing borrow-return, related-position and source-coverage checks pass (133, 355 and 121/121 respectively). Claude independently audited Phase 0–1 cases and reviewed the checker; its false-pair findings are covered by regression probes.
|
||||||
|
|
||||||
## P6-7 Phase 1–3 rejection-twin audit (2026-10-08)
|
## P6-7 public rejection-twin audit (2026-10-08)
|
||||||
|
|
||||||
Thirteen further audited pairs bring verified same-code coverage to 40/199. Twelve link existing source tests for owner/file/receiver leaks, use after transfer, missing allocation effects, unchecked access, live children/task loans and waiting under a mutex guard. One new source fixture checks local.store with a live shared borrow, including its related conflict position. Seven additional generated-only cases are documented: explicit borrow ends, unmatched lexical cleanup, reserved borrow-join parameters and a missing feature dependency. The legacy reserved_feature fixture's comment now describes its actual missing_dependency rejection; its body and permanent name are unchanged. The inventory retains 133 pending, four E7xxx analogues and 22 AIR-only cases, all still unmet under Q-053. P6-7 remains doing.
|
Verified same-code coverage is 65/199. Audited pairs cover owner/file/receiver leaks, use after transfer, authority/effects, unsafe calls, 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 early-declaration positions. A new island-destroy fixture retains a child object borrow and its subsequent load; witnesses also preserve discarded-unpack and returned-buffer-failure contexts. The producer lookup now recognizes the specified island.borrow result as a borrow, with renamed-binding and missing-child regression probes. The legacy reserved_feature fixture's comment describes its actual missing_dependency rejection; its body and permanent name are unchanged. The inventory retains 103 pending, seven E7xxx analogues and 24 AIR-only cases, all still unmet under Q-053. P6-7 remains doing.
|
||||||
|
|
||||||
Validation: full conformance is 1,656/1,656; unit tests, Zig formatting, all 21 checker regressions and the 40-pair source/AIR position check pass. The new fixture passes collection before every instruction; the completion gate still rejects partial coverage. Claude independently audited the pairs, checked the receiver's success/return path and reviewed generated-only classifications. No compiler, verifier, runtime, normative rule, diagnostic code or reference bundle changes.
|
Validation: full conformance is 1,666/1,666; unit tests, Zig formatting, all 23 checker regressions and the 65-pair source/AIR position check pass. All 24 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 pairs and reviewed generated-only classifications, failure paths, static contracts, markers and witnesses. No compiler, verifier, runtime, normative rule, diagnostic code or reference bundle changes.
|
||||||
@@ -1,6 +1,50 @@
|
|||||||
{
|
{
|
||||||
"version": 1,
|
"version": 1,
|
||||||
"cases": {
|
"cases": {
|
||||||
|
"buffers/empty_free_leak.air": {
|
||||||
|
"kind": "same_code",
|
||||||
|
"site": "instruction",
|
||||||
|
"spec": "docs/spec/03-memory-model.md \u00a726",
|
||||||
|
"rule": "The buffer returned on buffer.free failure is left live at return, regardless of runtime reachability of that outcome.",
|
||||||
|
"required_ops": {
|
||||||
|
"buffer.free": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"buffers/view_mutation.air": {
|
||||||
|
"kind": "same_code",
|
||||||
|
"site": "instruction",
|
||||||
|
"spec": "docs/spec/03-memory-model.md \u00a726",
|
||||||
|
"rule": "buffer.reserve mutates a buffer with a live buffer.view child; the view is used afterwards."
|
||||||
|
},
|
||||||
|
"generics/recursive_array.air": {
|
||||||
|
"kind": "same_code",
|
||||||
|
"site": "declaration",
|
||||||
|
"spec": "docs/spec/15-source-language.md \u00a715",
|
||||||
|
"rule": "The non-generic Node recursively contains an array of itself by value, retaining E1003 before source lowering.",
|
||||||
|
"lowering": "rejected"
|
||||||
|
},
|
||||||
|
"linear/field.air": {
|
||||||
|
"kind": "same_code",
|
||||||
|
"site": "instruction",
|
||||||
|
"spec": "docs/spec/03-memory-model.md \u00a725",
|
||||||
|
"rule": "struct.get projects a linear owning field instead of whole unpacking or borrowed exchange."
|
||||||
|
},
|
||||||
|
"linear/leak.air": {
|
||||||
|
"kind": "same_code",
|
||||||
|
"site": "instruction",
|
||||||
|
"spec": "docs/spec/03-memory-model.md \u00a725",
|
||||||
|
"rule": "Whole struct.unpack discards an owning field that remains live at return.",
|
||||||
|
"required_ops": {
|
||||||
|
"struct.unpack": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nominal_queries/cycle.air": {
|
||||||
|
"kind": "same_code",
|
||||||
|
"site": "declaration",
|
||||||
|
"spec": "docs/spec/15-source-language.md \u00a71",
|
||||||
|
"rule": "The N0 through N40 by-value cycle is rejected as E1003 at N0 before source lowering. Pure by-value cycles retain E1003 (Q-043/Q-044; AIR type rules in spec 07).",
|
||||||
|
"lowering": "rejected"
|
||||||
|
},
|
||||||
"phase0/reject/block_argument_type.air": {
|
"phase0/reject/block_argument_type.air": {
|
||||||
"kind": "air_only",
|
"kind": "air_only",
|
||||||
"spec": "docs/spec/15-source-language.md \u00a71",
|
"spec": "docs/spec/15-source-language.md \u00a71",
|
||||||
@@ -230,6 +274,12 @@
|
|||||||
"spec": "docs/spec/05-effects-and-capabilities.md",
|
"spec": "docs/spec/05-effects-and-capabilities.md",
|
||||||
"rule": "own.new lacks mem.alloc; the missing effect and complete suggested list agree."
|
"rule": "own.new lacks mem.alloc; the missing effect and complete suggested list agree."
|
||||||
},
|
},
|
||||||
|
"phase2/reject/intrinsic_effect.air": {
|
||||||
|
"kind": "same_code",
|
||||||
|
"site": "instruction",
|
||||||
|
"spec": "docs/spec/05-effects-and-capabilities.md \u00a79.3",
|
||||||
|
"rule": "fs.open_read lacks the explicit fs.read effect; intrinsic, effect and complete suggested_effects agree."
|
||||||
|
},
|
||||||
"phase2/reject/own_free_while_borrowed.air": {
|
"phase2/reject/own_free_while_borrowed.air": {
|
||||||
"kind": "same_code",
|
"kind": "same_code",
|
||||||
"site": "instruction",
|
"site": "instruction",
|
||||||
@@ -302,12 +352,24 @@
|
|||||||
"spec": "docs/spec/06-resources-and-errors.md",
|
"spec": "docs/spec/06-resources-and-errors.md",
|
||||||
"rule": "A closed/freed resource is borrowed again."
|
"rule": "A closed/freed resource is borrowed again."
|
||||||
},
|
},
|
||||||
|
"phase2/reject/unsafe_call_from_safe.air": {
|
||||||
|
"kind": "same_code",
|
||||||
|
"site": "instruction",
|
||||||
|
"spec": "docs/spec/13-contracts-and-unsafe.md \u00a76",
|
||||||
|
"rule": "A safe function calls an effects [unsafe] function without an unsafe or trusted boundary."
|
||||||
|
},
|
||||||
"phase2/reject/unsafe_outside_boundary.air": {
|
"phase2/reject/unsafe_outside_boundary.air": {
|
||||||
"kind": "same_code",
|
"kind": "same_code",
|
||||||
"site": "instruction",
|
"site": "instruction",
|
||||||
"spec": "docs/spec/13-contracts-and-unsafe.md \u00a76",
|
"spec": "docs/spec/13-contracts-and-unsafe.md \u00a76",
|
||||||
"rule": "borrow.index.unchecked occurs outside an unsafe or trusted function."
|
"rule": "borrow.index.unchecked occurs outside an unsafe or trusted function."
|
||||||
},
|
},
|
||||||
|
"phase2/reject/wrong_capability_kind.air": {
|
||||||
|
"kind": "same_code",
|
||||||
|
"site": "instruction",
|
||||||
|
"spec": "docs/spec/05-effects-and-capabilities.md \u00a710.5",
|
||||||
|
"rule": "fs.create receives cap<fs.read> instead of required cap<fs.write>; expected/found authority facts agree."
|
||||||
|
},
|
||||||
"phase3/reject/cancel_join_keeps_loans.air": {
|
"phase3/reject/cancel_join_keeps_loans.air": {
|
||||||
"kind": "same_code",
|
"kind": "same_code",
|
||||||
"site": "instruction",
|
"site": "instruction",
|
||||||
@@ -332,6 +394,12 @@
|
|||||||
"spec": "docs/spec/06-resources-and-errors.md \u00a76.3",
|
"spec": "docs/spec/06-resources-and-errors.md \u00a76.3",
|
||||||
"rule": "A channel receiver remains unclosed at return after its sender is closed. The source success arm passes through a single-predecessor match join; the allocation failure arm traps."
|
"rule": "A channel receiver remains unclosed at return after its sender is closed. The source success arm passes through a single-predecessor match join; the allocation failure arm traps."
|
||||||
},
|
},
|
||||||
|
"phase3/reject/channels_recv_without_effect.air": {
|
||||||
|
"kind": "same_code",
|
||||||
|
"site": "instruction",
|
||||||
|
"spec": "docs/spec/04-concurrency-and-atomics.md \u00a737.4/\u00a738",
|
||||||
|
"rule": "channel.recv lacks task.wait on a borrowed receiver parameter; no allocation adds another missing effect."
|
||||||
|
},
|
||||||
"phase3/reject/sync_call_waiting_function.air": {
|
"phase3/reject/sync_call_waiting_function.air": {
|
||||||
"kind": "same_code",
|
"kind": "same_code",
|
||||||
"site": "instruction",
|
"site": "instruction",
|
||||||
@@ -344,6 +412,12 @@
|
|||||||
"spec": "docs/spec/04-concurrency-and-atomics.md \u00a741",
|
"spec": "docs/spec/04-concurrency-and-atomics.md \u00a741",
|
||||||
"rule": "A second mutex.lock may wait while the first guard is held."
|
"rule": "A second mutex.lock may wait while the first guard is held."
|
||||||
},
|
},
|
||||||
|
"phase3/reject/sync_take_while_borrowed.air": {
|
||||||
|
"kind": "same_code",
|
||||||
|
"site": "instruction",
|
||||||
|
"spec": "docs/spec/04-concurrency-and-atomics.md \u00a740",
|
||||||
|
"rule": "mutex.take consumes a mutex with a live shared borrow, retaining that borrow as the related conflict."
|
||||||
|
},
|
||||||
"phase3/reject/sync_wait_while_locked.air": {
|
"phase3/reject/sync_wait_while_locked.air": {
|
||||||
"kind": "same_code",
|
"kind": "same_code",
|
||||||
"site": "instruction",
|
"site": "instruction",
|
||||||
@@ -374,42 +448,152 @@
|
|||||||
"spec": "docs/spec/04-concurrency-and-atomics.md \u00a733",
|
"spec": "docs/spec/04-concurrency-and-atomics.md \u00a733",
|
||||||
"rule": "A task scope ends while a child task remains unjoined."
|
"rule": "A task scope ends while a child task remains unjoined."
|
||||||
},
|
},
|
||||||
|
"phase3/reject/tasks_spawn_without_effect.air": {
|
||||||
|
"kind": "same_code",
|
||||||
|
"site": "instruction",
|
||||||
|
"spec": "docs/spec/04-concurrency-and-atomics.md \u00a733",
|
||||||
|
"rule": "task.spawn lacks the explicit task.spawn effect; the selected missing effect and complete suggested list agree."
|
||||||
|
},
|
||||||
|
"phase4/reject/arc_content_mutex.air": {
|
||||||
|
"kind": "same_code",
|
||||||
|
"site": "block",
|
||||||
|
"spec": "docs/spec/03-memory-model.md \u00a724",
|
||||||
|
"rule": "An arc result contains mutex<u64>, which is Share but not ArcSafe."
|
||||||
|
},
|
||||||
"phase4/reject/arc_release_twice.air": {
|
"phase4/reject/arc_release_twice.air": {
|
||||||
"kind": "same_code",
|
"kind": "same_code",
|
||||||
"site": "instruction",
|
"site": "instruction",
|
||||||
"spec": "docs/spec/03-memory-model.md",
|
"spec": "docs/spec/03-memory-model.md",
|
||||||
"rule": "The same resource is consumed twice."
|
"rule": "The same resource is consumed twice."
|
||||||
},
|
},
|
||||||
|
"phase4/reject/frozen_borrow_mut.air": {
|
||||||
|
"kind": "source_error",
|
||||||
|
"spec": "docs/spec/15-source-language.md \u00a78",
|
||||||
|
"rule": "A frozen graph provides immutable access only; source rejects mut frozen.at with E7005 before a store is generated.",
|
||||||
|
"analogues": [
|
||||||
|
{
|
||||||
|
"source": "source/layer9/reject/frozen_mut.aji",
|
||||||
|
"codes": [
|
||||||
|
"E7005"
|
||||||
|
],
|
||||||
|
"fields": {}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"phase4/reject/frozen_leak.air": {
|
"phase4/reject/frozen_leak.air": {
|
||||||
"kind": "same_code",
|
"kind": "same_code",
|
||||||
"site": "instruction",
|
"site": "instruction",
|
||||||
"spec": "docs/spec/03-memory-model.md \u00a723",
|
"spec": "docs/spec/03-memory-model.md \u00a723",
|
||||||
"rule": "An owned frozen graph reaches return without frozen.release."
|
"rule": "An owned frozen graph reaches return without frozen.release."
|
||||||
},
|
},
|
||||||
|
"phase4/reject/island_content_owner.air": {
|
||||||
|
"kind": "same_code",
|
||||||
|
"site": "block",
|
||||||
|
"spec": "docs/spec/03-memory-model.md \u00a722",
|
||||||
|
"rule": "An island result contains own<u64>, a foreign mutable edge forbidden by IslandSafe."
|
||||||
|
},
|
||||||
|
"phase4/reject/island_destroy_while_borrowed.air": {
|
||||||
|
"kind": "same_code",
|
||||||
|
"site": "instruction",
|
||||||
|
"spec": "docs/spec/03-memory-model.md \u00a722",
|
||||||
|
"rule": "island.destroy invalidates a live container borrow and its child object borrow; the child is used afterwards.",
|
||||||
|
"required_ops": {
|
||||||
|
"island.borrow": 1,
|
||||||
|
"load": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"phase4/reject/island_two_mut.air": {
|
||||||
|
"kind": "same_code",
|
||||||
|
"site": "instruction",
|
||||||
|
"spec": "docs/spec/03-memory-model.md \u00a722",
|
||||||
|
"rule": "A second mutable object borrow is created through the same island, using a different iref."
|
||||||
|
},
|
||||||
"phase4/reject/island_use_after_freeze.air": {
|
"phase4/reject/island_use_after_freeze.air": {
|
||||||
"kind": "same_code",
|
"kind": "same_code",
|
||||||
"site": "instruction",
|
"site": "instruction",
|
||||||
"spec": "docs/spec/03-memory-model.md",
|
"spec": "docs/spec/03-memory-model.md",
|
||||||
"rule": "An island is borrowed after freezing transferred its ownership."
|
"rule": "An island is borrowed after freezing transferred its ownership."
|
||||||
},
|
},
|
||||||
|
"phase4/reject/island_use_after_send.air": {
|
||||||
|
"kind": "same_code",
|
||||||
|
"site": "instruction",
|
||||||
|
"spec": "docs/spec/03-memory-model.md \u00a722",
|
||||||
|
"rule": "An island is borrowed after successful channel.send transferred its ownership."
|
||||||
|
},
|
||||||
|
"phase4/reject/islands_not_declared.air": {
|
||||||
|
"kind": "air_only",
|
||||||
|
"spec": "docs/spec/15-source-language.md \u00a79",
|
||||||
|
"rule": "The missing AIR feature header cannot be authored in source, whose lowering generates the full dependency closure."
|
||||||
|
},
|
||||||
"phase5/reject/cmpxchg_failure_release.air": {
|
"phase5/reject/cmpxchg_failure_release.air": {
|
||||||
"kind": "same_code",
|
"kind": "same_code",
|
||||||
"site": "instruction",
|
"site": "instruction",
|
||||||
"spec": "docs/spec/04-concurrency-and-atomics.md",
|
"spec": "docs/spec/04-concurrency-and-atomics.md",
|
||||||
"rule": "The same atomic operation rejects the same ordering and allowed set."
|
"rule": "The same atomic operation rejects the same ordering and allowed set."
|
||||||
},
|
},
|
||||||
|
"phase5/reject/cmpxchg_failure_stronger.air": {
|
||||||
|
"kind": "same_code",
|
||||||
|
"site": "instruction",
|
||||||
|
"spec": "docs/spec/04-concurrency-and-atomics.md \u00a724.1",
|
||||||
|
"rule": "atomic.cmpxchg.relaxed.acquire uses failure ordering acquire, stronger than the success ordering relaxed."
|
||||||
|
},
|
||||||
"phase5/reject/fence_relaxed.air": {
|
"phase5/reject/fence_relaxed.air": {
|
||||||
"kind": "same_code",
|
"kind": "same_code",
|
||||||
"site": "instruction",
|
"site": "instruction",
|
||||||
"spec": "docs/spec/04-concurrency-and-atomics.md",
|
"spec": "docs/spec/04-concurrency-and-atomics.md",
|
||||||
"rule": "The same atomic operation rejects the same ordering and allowed set."
|
"rule": "The same atomic operation rejects the same ordering and allowed set."
|
||||||
},
|
},
|
||||||
|
"phase5/reject/island_content.air": {
|
||||||
|
"kind": "same_code",
|
||||||
|
"site": "block",
|
||||||
|
"spec": "docs/spec/03-memory-model.md \u00a722",
|
||||||
|
"rule": "An island result contains atomic<u64>, a foreign mutable edge forbidden by IslandSafe."
|
||||||
|
},
|
||||||
|
"phase5/reject/leak.air": {
|
||||||
|
"kind": "same_code",
|
||||||
|
"site": "instruction",
|
||||||
|
"spec": "docs/spec/04-concurrency-and-atomics.md \u00a723",
|
||||||
|
"rule": "An atomic cell reaches return without being taken, moved or returned."
|
||||||
|
},
|
||||||
"phase5/reject/load_release.air": {
|
"phase5/reject/load_release.air": {
|
||||||
"kind": "same_code",
|
"kind": "same_code",
|
||||||
"site": "instruction",
|
"site": "instruction",
|
||||||
"spec": "docs/spec/04-concurrency-and-atomics.md",
|
"spec": "docs/spec/04-concurrency-and-atomics.md",
|
||||||
"rule": "The same atomic operation rejects the same ordering and allowed set."
|
"rule": "The same atomic operation rejects the same ordering and allowed set."
|
||||||
},
|
},
|
||||||
|
"phase5/reject/missing_atomic_effect.air": {
|
||||||
|
"kind": "same_code",
|
||||||
|
"site": "instruction",
|
||||||
|
"spec": "docs/spec/05-effects-and-capabilities.md \u00a713",
|
||||||
|
"rule": "atomic.load.seq_cst lacks atomic; atomic.new and atomic.take require no effect."
|
||||||
|
},
|
||||||
|
"phase5/reject/missing_weak_effect.air": {
|
||||||
|
"kind": "same_code",
|
||||||
|
"site": "instruction",
|
||||||
|
"spec": "docs/spec/05-effects-and-capabilities.md \u00a713",
|
||||||
|
"rule": "atomic.load.acquire lacks atomic.weak; the complete suggested effects are [atomic, atomic.weak]."
|
||||||
|
},
|
||||||
|
"phase5/reject/mut_operand.air": {
|
||||||
|
"kind": "source_error",
|
||||||
|
"spec": "docs/spec/15-source-language.md \u00a712",
|
||||||
|
"rule": "Atomic cells require shared ref access; spelling a mutable cell borrow is E7005 in source.",
|
||||||
|
"analogues": [
|
||||||
|
{
|
||||||
|
"source": "source/layer10/reject/mut_borrow.aji",
|
||||||
|
"codes": [
|
||||||
|
"E7005"
|
||||||
|
],
|
||||||
|
"fields": {
|
||||||
|
"name": "c"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"phase5/reject/not_declared.air": {
|
||||||
|
"kind": "air_only",
|
||||||
|
"spec": "docs/spec/15-source-language.md \u00a79",
|
||||||
|
"rule": "The missing AIR feature header cannot be authored in source, whose lowering generates the full dependency closure."
|
||||||
|
},
|
||||||
"phase5/reject/store_acquire.air": {
|
"phase5/reject/store_acquire.air": {
|
||||||
"kind": "same_code",
|
"kind": "same_code",
|
||||||
"site": "instruction",
|
"site": "instruction",
|
||||||
@@ -421,6 +605,40 @@
|
|||||||
"site": "instruction",
|
"site": "instruction",
|
||||||
"spec": "docs/spec/04-concurrency-and-atomics.md",
|
"spec": "docs/spec/04-concurrency-and-atomics.md",
|
||||||
"rule": "The same owning-resource consumption or whole-place borrow conflicts with a live borrow."
|
"rule": "The same owning-resource consumption or whole-place borrow conflicts with a live borrow."
|
||||||
|
},
|
||||||
|
"phase5/reject/take_while_lent.air": {
|
||||||
|
"kind": "same_code",
|
||||||
|
"site": "instruction",
|
||||||
|
"spec": "docs/spec/04-concurrency-and-atomics.md \u00a728",
|
||||||
|
"rule": "atomic.take consumes a cell while a borrow of it is lent to a live task."
|
||||||
|
},
|
||||||
|
"phase5/reject/u128_cell.air": {
|
||||||
|
"kind": "source_error",
|
||||||
|
"spec": "docs/spec/15-source-language.md \u00a710",
|
||||||
|
"rule": "A 128-bit integer cannot be atomic cell content; this source-decided type error uses E7005.",
|
||||||
|
"analogues": [
|
||||||
|
{
|
||||||
|
"source": "source/layer10/reject/wide_cell.aji",
|
||||||
|
"codes": [
|
||||||
|
"E7005"
|
||||||
|
],
|
||||||
|
"fields": {
|
||||||
|
"found": "u128"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"static_functions/missing_effect.air": {
|
||||||
|
"kind": "same_code",
|
||||||
|
"site": "instruction",
|
||||||
|
"spec": "docs/spec/05-effects-and-capabilities.md \u00a79.3",
|
||||||
|
"rule": "A call to selected lacks io.write; source supplies that same function through an explicit static parameter with its declared contract."
|
||||||
|
},
|
||||||
|
"static_functions/owner_leak.air": {
|
||||||
|
"kind": "same_code",
|
||||||
|
"site": "instruction",
|
||||||
|
"spec": "docs/spec/06-resources-and-errors.md \u00a76.3",
|
||||||
|
"rule": "selected returns without consuming its owning parameter; source also invokes it through explicit specialization."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,13 +3,14 @@
|
|||||||
// phase: 6
|
// phase: 6
|
||||||
// spec: docs/spec/03-memory-model.md §26; docs/spec/15-source-language.md §17
|
// spec: docs/spec/03-memory-model.md §26; docs/spec/15-source-language.md §17
|
||||||
module test.buffers
|
module test.buffers
|
||||||
|
// AIR twin: buffers/view_mutation.air
|
||||||
fn main(heap: cap<mem.alloc>) -> u64 effects [mem.alloc] {
|
fn main(heap: cap<mem.alloc>) -> u64 effects [mem.alloc] {
|
||||||
let data = buffer.new<u64>(1, heap) or trap;
|
let data = buffer.new<u64>(1, heap) or trap;
|
||||||
{
|
{
|
||||||
mut b = data;
|
mut b = data;
|
||||||
buffer.push(b, 42u64) or trap;
|
buffer.push(b, 42u64) or trap;
|
||||||
mut values = buffer.view(b);
|
mut values = buffer.view(b);
|
||||||
buffer.reserve(b, 1, heap) or trap;
|
buffer.reserve(b, 1, heap) or trap; // diagnostic here
|
||||||
assert(values[0] == 42);
|
assert(values[0] == 42);
|
||||||
}
|
}
|
||||||
{ mut b = data; let ignored = buffer.pop(b) or trap; }
|
{ mut b = data; let ignored = buffer.pop(b) or trap; }
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
// phase: 6
|
// phase: 6
|
||||||
// spec: docs/spec/03-memory-model.md §26; docs/spec/15-source-language.md §17
|
// spec: docs/spec/03-memory-model.md §26; docs/spec/15-source-language.md §17
|
||||||
module test.buffers
|
module test.buffers
|
||||||
|
// AIR twin: buffers/empty_free_leak.air
|
||||||
fn main(heap: cap<mem.alloc>) -> u64 effects [mem.alloc] {
|
fn main(heap: cap<mem.alloc>) -> u64 effects [mem.alloc] {
|
||||||
let data = buffer.new<own<u64>>(0, heap) or trap;
|
let data = buffer.new<own<u64>>(0, heap) or trap;
|
||||||
match buffer.free(move data) { ok() => { return 42; } err(value) => { return 42; } }
|
match buffer.free(move data) { ok() => { return 42; } err(value) => { return 42; } } // diagnostic here: return 42; } }
|
||||||
}
|
}
|
||||||
@@ -2,5 +2,6 @@
|
|||||||
// phase: 6
|
// phase: 6
|
||||||
// spec: docs/spec/15-source-language.md §15
|
// spec: docs/spec/15-source-language.md §15
|
||||||
module demo.generic
|
module demo.generic
|
||||||
struct Node { child: [Node; 1] }
|
// AIR twin: generics/recursive_array.air
|
||||||
|
struct Node { child: [Node; 1] } // diagnostic here
|
||||||
fn main() -> u64 effects [] { return 42; }
|
fn main() -> u64 effects [] { return 42; }
|
||||||
@@ -3,12 +3,13 @@
|
|||||||
// phase: 6
|
// phase: 6
|
||||||
// spec: docs/spec/15-source-language.md
|
// spec: docs/spec/15-source-language.md
|
||||||
module demo.exchange_failure_order
|
module demo.exchange_failure_order
|
||||||
|
// AIR twin: phase5/reject/cmpxchg_failure_stronger.air
|
||||||
|
|
||||||
fn main() -> u64
|
fn main() -> u64
|
||||||
effects [atomic, atomic.weak]
|
effects [atomic, atomic.weak]
|
||||||
{
|
{
|
||||||
let c = atomic.new(1u64);
|
let c = atomic.new(1u64);
|
||||||
let (old, exchanged) = atomic.compare_exchange(ref c, 1u64, 2u64, relaxed, acquire);
|
let (old, exchanged) = atomic.compare_exchange(ref c, 1u64, 2u64, relaxed, acquire); // diagnostic here
|
||||||
let v = atomic.take(move c);
|
let v = atomic.take(move c);
|
||||||
old + v
|
old + v
|
||||||
}
|
}
|
||||||
@@ -3,10 +3,11 @@
|
|||||||
// phase: 6
|
// phase: 6
|
||||||
// spec: docs/spec/15-source-language.md
|
// spec: docs/spec/15-source-language.md
|
||||||
module demo.leak
|
module demo.leak
|
||||||
|
// AIR twin: phase5/reject/leak.air
|
||||||
|
|
||||||
fn main() -> u64
|
fn main() -> u64
|
||||||
effects [atomic]
|
effects [atomic]
|
||||||
{
|
{
|
||||||
let c = atomic.new(1u64);
|
let c = atomic.new(1u64);
|
||||||
atomic.load(ref c, seq_cst)
|
atomic.load(ref c, seq_cst) // diagnostic here
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,7 @@ effects [atomic]
|
|||||||
{
|
{
|
||||||
let c = atomic.new(1u64);
|
let c = atomic.new(1u64);
|
||||||
{
|
{
|
||||||
mut m = c;
|
mut m = c; // diagnostic here: c
|
||||||
}
|
}
|
||||||
atomic.take(move c)
|
atomic.take(move c)
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
// phase: 6
|
// phase: 6
|
||||||
// spec: docs/spec/15-source-language.md
|
// spec: docs/spec/15-source-language.md
|
||||||
module demo.take_while_lent
|
module demo.take_while_lent
|
||||||
|
// AIR twin: phase5/reject/take_while_lent.air
|
||||||
|
|
||||||
fn read(c: ref<atomic<u64>>) -> u64
|
fn read(c: ref<atomic<u64>>) -> u64
|
||||||
effects [atomic]
|
effects [atomic]
|
||||||
@@ -19,7 +20,7 @@ effects [atomic, task.spawn, task.wait]
|
|||||||
ref r = c;
|
ref r = c;
|
||||||
scope s {
|
scope s {
|
||||||
let t = task.spawn(s, read, r);
|
let t = task.spawn(s, read, r);
|
||||||
v = atomic.take(move c);
|
v = atomic.take(move c); // diagnostic here: atomic.take
|
||||||
let x = task.join(move t);
|
let x = task.join(move t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ module demo.wide_cell
|
|||||||
fn main() -> u64
|
fn main() -> u64
|
||||||
effects [atomic]
|
effects [atomic]
|
||||||
{
|
{
|
||||||
let c = atomic.new(1u128);
|
let c = atomic.new(1u128); // diagnostic here: 1u128
|
||||||
let t = atomic.take(move c);
|
let t = atomic.take(move c);
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
@@ -3,11 +3,12 @@
|
|||||||
// phase: 6
|
// phase: 6
|
||||||
// spec: docs/spec/03-memory-model.md
|
// spec: docs/spec/03-memory-model.md
|
||||||
module demo.arc_mutex
|
module demo.arc_mutex
|
||||||
|
// AIR twin: phase4/reject/arc_content_mutex.air
|
||||||
|
|
||||||
fn main(heap: cap<mem.alloc>) -> u64
|
fn main(heap: cap<mem.alloc>) -> u64
|
||||||
effects [mem.alloc]
|
effects [mem.alloc]
|
||||||
{
|
{
|
||||||
let a = arc.new(mutex.make(0u64), heap) or trap;
|
let a = arc.new(mutex.make(0u64), heap) or trap; // diagnostic here: arc.new
|
||||||
arc.release(move a);
|
arc.release(move a);
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
@@ -3,12 +3,13 @@
|
|||||||
// phase: 6
|
// phase: 6
|
||||||
// spec: docs/spec/03-memory-model.md
|
// spec: docs/spec/03-memory-model.md
|
||||||
module demo.content_owner
|
module demo.content_owner
|
||||||
|
// AIR twin: phase4/reject/island_content_owner.air
|
||||||
|
|
||||||
fn main(heap: cap<mem.alloc>) -> u64
|
fn main(heap: cap<mem.alloc>) -> u64
|
||||||
effects [mem.alloc]
|
effects [mem.alloc]
|
||||||
{
|
{
|
||||||
let o = own.new(1u64, heap) or trap;
|
let o = own.new(1u64, heap) or trap;
|
||||||
let isl = island.create(move o, heap) or trap;
|
let isl = island.create(move o, heap) or trap; // diagnostic here: island.create
|
||||||
island.destroy(move isl);
|
island.destroy(move isl);
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
@@ -11,7 +11,7 @@ effects [mem.alloc]
|
|||||||
{
|
{
|
||||||
ref g = f;
|
ref g = f;
|
||||||
let r = frozen.root(g);
|
let r = frozen.root(g);
|
||||||
mut x = frozen.at(g, r);
|
mut x = frozen.at(g, r); // diagnostic here
|
||||||
*x = 2;
|
*x = 2;
|
||||||
}
|
}
|
||||||
frozen.release(move f);
|
frozen.release(move f);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
// phase: 6
|
// phase: 6
|
||||||
// spec: docs/spec/03-memory-model.md
|
// spec: docs/spec/03-memory-model.md
|
||||||
module demo.two_mut_access
|
module demo.two_mut_access
|
||||||
|
// AIR twin: phase4/reject/island_two_mut.air
|
||||||
|
|
||||||
fn main(heap: cap<mem.alloc>) -> u64
|
fn main(heap: cap<mem.alloc>) -> u64
|
||||||
effects [mem.alloc]
|
effects [mem.alloc]
|
||||||
@@ -13,7 +14,7 @@ effects [mem.alloc]
|
|||||||
let a = island.root(g);
|
let a = island.root(g);
|
||||||
let b = island.alloc(g, 2u64) or trap;
|
let b = island.alloc(g, 2u64) or trap;
|
||||||
mut x = island.at(g, a);
|
mut x = island.at(g, a);
|
||||||
mut y = island.at(g, b);
|
mut y = island.at(g, b); // diagnostic here
|
||||||
}
|
}
|
||||||
island.destroy(move isl);
|
island.destroy(move isl);
|
||||||
0
|
0
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
// phase: 6
|
// phase: 6
|
||||||
// spec: docs/spec/03-memory-model.md
|
// spec: docs/spec/03-memory-model.md
|
||||||
module demo.use_after_send
|
module demo.use_after_send
|
||||||
|
// AIR twin: phase4/reject/island_use_after_send.air
|
||||||
|
|
||||||
fn main(heap: cap<mem.alloc>) -> u64
|
fn main(heap: cap<mem.alloc>) -> u64
|
||||||
effects [mem.alloc, task.wait]
|
effects [mem.alloc, task.wait]
|
||||||
@@ -12,7 +13,7 @@ effects [mem.alloc, task.wait]
|
|||||||
let isl = island.create(1u64, heap) or trap;
|
let isl = island.create(1u64, heap) or trap;
|
||||||
channel.send(tx, move isl) or trap;
|
channel.send(tx, move isl) or trap;
|
||||||
{
|
{
|
||||||
ref g = isl;
|
ref g = isl; // diagnostic here
|
||||||
let r = island.root(g);
|
let r = island.root(g);
|
||||||
}
|
}
|
||||||
channel.close_sender(move tx);
|
channel.close_sender(move tx);
|
||||||
|
|||||||
@@ -3,11 +3,12 @@
|
|||||||
// phase: 6
|
// phase: 6
|
||||||
// spec: docs/spec/03-memory-model.md §25; docs/spec/15-source-language.md §16
|
// spec: docs/spec/03-memory-model.md §25; docs/spec/15-source-language.md §16
|
||||||
module test.linear
|
module test.linear
|
||||||
|
// AIR twin: linear/leak.air
|
||||||
struct Pair { value: own<u64>, tag: u64 }
|
struct Pair { value: own<u64>, tag: u64 }
|
||||||
fn main(heap: cap<mem.alloc>) -> u64 effects [mem.alloc] {
|
fn main(heap: cap<mem.alloc>) -> u64 effects [mem.alloc] {
|
||||||
let owner = own.new(42u64, heap) or trap;
|
let owner = own.new(42u64, heap) or trap;
|
||||||
let record = Pair { value: move owner, tag: 1u64 };
|
let record = Pair { value: move owner, tag: 1u64 };
|
||||||
let (_, tag) = struct.unpack(move record);
|
let (_, tag) = struct.unpack(move record);
|
||||||
assert(tag == 1);
|
assert(tag == 1);
|
||||||
return 42;
|
return 42; // diagnostic here
|
||||||
}
|
}
|
||||||
@@ -3,11 +3,12 @@
|
|||||||
// phase: 6
|
// phase: 6
|
||||||
// spec: docs/spec/03-memory-model.md §25; docs/spec/15-source-language.md §16
|
// spec: docs/spec/03-memory-model.md §25; docs/spec/15-source-language.md §16
|
||||||
module test.linear
|
module test.linear
|
||||||
|
// AIR twin: linear/field.air
|
||||||
struct Pair { value: own<u64>, tag: u64 }
|
struct Pair { value: own<u64>, tag: u64 }
|
||||||
fn main(heap: cap<mem.alloc>) -> u64 effects [mem.alloc] {
|
fn main(heap: cap<mem.alloc>) -> u64 effects [mem.alloc] {
|
||||||
let owner = own.new(42u64, heap) or trap;
|
let owner = own.new(42u64, heap) or trap;
|
||||||
let record = Pair { value: move owner, tag: 1u64 };
|
let record = Pair { value: move owner, tag: 1u64 };
|
||||||
let bad = record.value;
|
let bad = record.value; // diagnostic here: record.value
|
||||||
let (part, tag) = struct.unpack(move record);
|
let (part, tag) = struct.unpack(move record);
|
||||||
assert(tag == 1);
|
assert(tag == 1);
|
||||||
return own.take(move part);
|
return own.take(move part);
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
// phase: 6
|
// phase: 6
|
||||||
// spec: docs/spec/03-memory-model.md §22/§25
|
// spec: docs/spec/03-memory-model.md §22/§25
|
||||||
module test.nominal_queries
|
module test.nominal_queries
|
||||||
struct N0 { a: N1, b: N1 }
|
// AIR twin: nominal_queries/cycle.air
|
||||||
|
struct N0 { a: N1, b: N1 } // diagnostic here
|
||||||
struct N1 { a: N2, b: N2 }
|
struct N1 { a: N2, b: N2 }
|
||||||
struct N2 { a: N3, b: N3 }
|
struct N2 { a: N3, b: N3 }
|
||||||
struct N3 { a: N4, b: N4 }
|
struct N3 { a: N4, b: N4 }
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
// fs.open_read lacks the explicit fs.read effect; intrinsic, effect and complete suggested_effects agree.
|
||||||
|
// expect: reject E3101
|
||||||
|
// phase: 6
|
||||||
|
// spec: docs/spec/05-effects-and-capabilities.md §9.3
|
||||||
|
// AIR twin: phase2/reject/intrinsic_effect.air
|
||||||
|
module test.source_intrinsic_effect
|
||||||
|
fn f(c: cap<fs.read>, p: slice<u8>) -> void effects [] {
|
||||||
|
let file = fs.open_read(c, p) or trap; // diagnostic here: fs.open_read
|
||||||
|
fs.close(move file) or trap;
|
||||||
|
}
|
||||||
|
fn main() -> u64 effects [] { return 0u64; }
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// An island result contains atomic<u64>, a foreign mutable edge forbidden by IslandSafe.
|
||||||
|
// expect: reject E2111
|
||||||
|
// phase: 6
|
||||||
|
// spec: docs/spec/03-memory-model.md §22
|
||||||
|
// AIR twin: phase5/reject/island_content.air
|
||||||
|
module test.source_island_content
|
||||||
|
fn main(heap: cap<mem.alloc>) -> u64
|
||||||
|
effects [mem.alloc]
|
||||||
|
{
|
||||||
|
let c = atomic.new(0u64);
|
||||||
|
let isl = island.create(move c, heap) or trap; // diagnostic here: island.create
|
||||||
|
island.destroy(move isl);
|
||||||
|
0
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
// Destroying an island while a borrow of its root object is live.
|
||||||
|
// expect: reject E2101
|
||||||
|
// phase: 6
|
||||||
|
// spec: docs/spec/03-memory-model.md §22
|
||||||
|
// AIR twin: phase4/reject/island_destroy_while_borrowed.air
|
||||||
|
module test.source_island_destroy_with_live_child
|
||||||
|
|
||||||
|
fn main(heap: cap<mem.alloc>) -> u64 effects [mem.alloc] {
|
||||||
|
let isl = island.create(1u64, heap) or trap;
|
||||||
|
ref graph = isl;
|
||||||
|
let root = island.root(graph);
|
||||||
|
ref value = island.at(graph, root);
|
||||||
|
island.destroy(move isl); // diagnostic here
|
||||||
|
return *value;
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// atomic.load.seq_cst lacks atomic; atomic.new and atomic.take require no effect.
|
||||||
|
// expect: reject E3101
|
||||||
|
// phase: 6
|
||||||
|
// spec: docs/spec/05-effects-and-capabilities.md §13
|
||||||
|
// AIR twin: phase5/reject/missing_atomic_effect.air
|
||||||
|
module test.source_missing_atomic_effect
|
||||||
|
fn main() -> u64
|
||||||
|
effects []
|
||||||
|
{
|
||||||
|
let c = atomic.new(0u64);
|
||||||
|
let x = atomic.load(ref c, seq_cst); // diagnostic here: atomic.load
|
||||||
|
let v = atomic.take(move c);
|
||||||
|
0
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// atomic.load.acquire lacks atomic.weak; the complete suggested effects are [atomic, atomic.weak].
|
||||||
|
// expect: reject E3101
|
||||||
|
// phase: 6
|
||||||
|
// spec: docs/spec/05-effects-and-capabilities.md §13
|
||||||
|
// AIR twin: phase5/reject/missing_weak_effect.air
|
||||||
|
module test.source_missing_weak_effect
|
||||||
|
fn main() -> u64
|
||||||
|
effects [atomic]
|
||||||
|
{
|
||||||
|
let c = atomic.new(0u64);
|
||||||
|
let x = atomic.load(ref c, acquire); // diagnostic here: atomic.load
|
||||||
|
let v = atomic.take(move c);
|
||||||
|
0
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
// channel.recv lacks task.wait on a borrowed receiver parameter; no allocation adds another missing effect.
|
||||||
|
// expect: reject E3101
|
||||||
|
// phase: 6
|
||||||
|
// spec: docs/spec/04-concurrency-and-atomics.md
|
||||||
|
// AIR twin: phase3/reject/channels_recv_without_effect.air
|
||||||
|
module test.source_recv_without_effect
|
||||||
|
fn f(rx: mut<receiver<u64>>) -> u64 effects [] {
|
||||||
|
channel.recv(rx) or trap // diagnostic here: channel.recv
|
||||||
|
}
|
||||||
|
fn main() -> u64 effects [] { return 0u64; }
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// task.spawn lacks the explicit task.spawn effect; the selected missing effect and complete suggested list agree.
|
||||||
|
// expect: reject E3101
|
||||||
|
// phase: 6
|
||||||
|
// spec: docs/spec/04-concurrency-and-atomics.md §33
|
||||||
|
// AIR twin: phase3/reject/tasks_spawn_without_effect.air
|
||||||
|
module test.source_spawn_without_effect
|
||||||
|
fn noop() -> void effects [] {}
|
||||||
|
fn main() -> u64 effects [] {
|
||||||
|
scope sc {
|
||||||
|
let t = task.spawn(sc, noop); // diagnostic here: task.spawn
|
||||||
|
task.join(move t);
|
||||||
|
}
|
||||||
|
0
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
// mutex.take consumes a mutex with a live shared borrow, retaining that borrow as the related conflict.
|
||||||
|
// expect: reject E2101
|
||||||
|
// phase: 6
|
||||||
|
// spec: docs/spec/04-concurrency-and-atomics.md §40
|
||||||
|
// AIR twin: phase3/reject/sync_take_while_borrowed.air
|
||||||
|
module test.source_sync_take_while_borrowed
|
||||||
|
fn main() -> u64 effects [] {
|
||||||
|
let m = mutex.make(0u64);
|
||||||
|
ref mr = m;
|
||||||
|
mutex.take(move m) // diagnostic here: mutex.take
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
// A safe function calls an effects [unsafe] function without an unsafe or trusted boundary.
|
||||||
|
// expect: reject E6001
|
||||||
|
// phase: 6
|
||||||
|
// spec: docs/spec/13-contracts-and-unsafe.md §6
|
||||||
|
// AIR twin: phase2/reject/unsafe_call_from_safe.air
|
||||||
|
module test.source_unsafe_call_from_safe
|
||||||
|
fn raw() -> void effects [unsafe] {}
|
||||||
|
fn f() -> void effects [] { raw(); } // diagnostic here: raw();
|
||||||
|
fn main() -> u64 effects [] { return 0u64; }
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
// fs.create receives cap<fs.read> instead of required cap<fs.write>; expected/found authority facts agree.
|
||||||
|
// expect: reject E3201
|
||||||
|
// phase: 6
|
||||||
|
// spec: docs/spec/05-effects-and-capabilities.md §10.5
|
||||||
|
// AIR twin: phase2/reject/wrong_capability_kind.air
|
||||||
|
module test.source_wrong_capability_kind
|
||||||
|
fn f(c: cap<fs.read>, p: slice<u8>) -> void effects [fs.write] {
|
||||||
|
let file = fs.create(c, p) or trap; // diagnostic here: fs.create
|
||||||
|
fs.close(move file) or trap;
|
||||||
|
}
|
||||||
|
fn main() -> u64 effects [] { return 0u64; }
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
// phase: 6
|
// phase: 6
|
||||||
// spec: docs/spec/15-source-language.md §18
|
// spec: docs/spec/15-source-language.md §18
|
||||||
module test.static_functions
|
module test.static_functions
|
||||||
|
// AIR twin: static_functions/missing_effect.air
|
||||||
fn selected(out: cap<io.write>) -> u64 effects [io.write] { return 42; }
|
fn selected(out: cap<io.write>) -> u64 effects [io.write] { return 42; }
|
||||||
fn run<F: fn(cap<io.write>) -> u64 effects [io.write]>(out: cap<io.write>) -> u64 effects [] { return F(out); }
|
fn run<F: fn(cap<io.write>) -> u64 effects [io.write]>(out: cap<io.write>) -> u64 effects [] { return F(out); } // diagnostic here: F(out)
|
||||||
fn main(out: cap<io.write>) -> u64 effects [] { return run::<fn selected>(out); }
|
fn main(out: cap<io.write>) -> u64 effects [] { return run::<fn selected>(out); }
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
// phase: 6
|
// phase: 6
|
||||||
// spec: docs/spec/15-source-language.md §18
|
// spec: docs/spec/15-source-language.md §18
|
||||||
module test.static_functions
|
module test.static_functions
|
||||||
fn selected(value: own<u64>) -> u64 effects [] { return 42; }
|
// AIR twin: static_functions/owner_leak.air
|
||||||
|
fn selected(value: own<u64>) -> u64 effects [] { return 42; } // diagnostic here: return
|
||||||
fn run<F: fn(own<u64>) -> u64 effects []>(value: own<u64>) -> u64 effects [] { return F(move value); }
|
fn run<F: fn(own<u64>) -> u64 effects []>(value: own<u64>) -> u64 effects [] { return F(move value); }
|
||||||
fn main(heap: cap<mem.alloc>) -> u64 effects [mem.alloc] { let value = own.new(42u64, heap) or trap; return run::<fn selected>(move value); }
|
fn main(heap: cap<mem.alloc>) -> u64 effects [mem.alloc] { let value = own.new(42u64, heap) or trap; return run::<fn selected>(move value); }
|
||||||
@@ -45,6 +45,23 @@ class CoverageFailures(unittest.TestCase):
|
|||||||
def test_valid_pair_survives_changed_file_and_ssa_identity(self):
|
def test_valid_pair_survives_changed_file_and_ssa_identity(self):
|
||||||
self.verify_fake(self.fake_pair())
|
self.verify_fake(self.fake_pair())
|
||||||
|
|
||||||
|
def test_graph_borrow_pair_survives_renamed_bindings(self):
|
||||||
|
row = self.fake_pair(source_path='source/layer9/reject/two_mut_access.aji',
|
||||||
|
air_path='phase4/reject/island_two_mut.air')
|
||||||
|
p = self.corpus / 's.aji'
|
||||||
|
p.write_text(p.read_text().replace('mut x =', 'mut first =').replace('mut y =', 'mut second ='))
|
||||||
|
self.verify_fake(row)
|
||||||
|
|
||||||
|
def test_container_only_conflict_cannot_replace_live_child_regression(self):
|
||||||
|
row = self.fake_pair(source_path='source/layer9/reject/destroy_while_borrowed.aji',
|
||||||
|
air_path='phase4/reject/island_destroy_while_borrowed.air')
|
||||||
|
row['required_ops'] = {'island.borrow': 1, 'load': 1}
|
||||||
|
p = self.corpus / 's.aji'
|
||||||
|
p.write_text(p.read_text().replace('island.destroy(move isl);',
|
||||||
|
'island.destroy(move isl); // diagnostic here'))
|
||||||
|
with self.assertRaisesRegex(ValueError, 'missing required operation witness'):
|
||||||
|
self.verify_fake(row)
|
||||||
|
|
||||||
def test_same_code_different_atomic_operation_is_not_a_twin(self):
|
def test_same_code_different_atomic_operation_is_not_a_twin(self):
|
||||||
row = self.fake_pair(air_name='load_release')
|
row = self.fake_pair(air_name='load_release')
|
||||||
with self.assertRaisesRegex(ValueError, 'different offending operation/rule facts'):
|
with self.assertRaisesRegex(ValueError, 'different offending operation/rule facts'):
|
||||||
|
|||||||
@@ -204,7 +204,8 @@ def identity_class(air, d, value):
|
|||||||
definition = re.match(r'\s*(%[^=]+?)\s*=\s*([\w.]+)', line)
|
definition = re.match(r'\s*(%[^=]+?)\s*=\s*([\w.]+)', line)
|
||||||
if definition and value in [x.strip() for x in definition[1].split(',')]:
|
if definition and value in [x.strip() for x in definition[1].split(',')]:
|
||||||
op = definition[2]
|
op = definition[2]
|
||||||
if op.startswith('borrow.') or op in {'slice.make', 'slice.sub', 'slice.split', 'buffer.view'}:
|
if op.startswith('borrow.') or op in {'slice.make', 'slice.sub', 'slice.split',
|
||||||
|
'buffer.view', 'island.borrow'}:
|
||||||
return 'borrow'
|
return 'borrow'
|
||||||
if op in producers:
|
if op in producers:
|
||||||
return producers[op]
|
return producers[op]
|
||||||
|
|||||||
Reference in new issue
Block a user