Files
aji/docs/design/contract-property-vectors.json
T

68 lines
3.2 KiB
JSON

{
"purpose": "Non-normative current-language baselines for the checked-type candidate; no checked feature is implemented.",
"compiler": "4cda448",
"header": [
"module contract.properties",
"air 0",
"lang 0.1",
"features [arc, arrays, atomics, cancellation, capabilities, channels, effects, error_values, heap, islands, linear_aggregates, linear_buffers, ownership, regions, resources, sync, tasks, unsafe]"
],
"cases": [
{
"case": "region_identity", "command": "check", "exit": 0, "codes": [],
"body": ["fn @w(%value: region) -> region", "effects []", "entry:", " ret %value"]
},
{
"case": "sender_identity", "command": "check", "exit": 0, "codes": [],
"body": ["fn @w(%value: sender<u64>) -> sender<u64>", "effects []", "entry:", " ret %value"]
},
{
"case": "wrapped_channel_endpoint", "command": "check", "exit": 1, "codes": ["E0006"],
"body": [
"type @Box = struct { endpoint: sender<u64> }",
"fn @f(%heap: cap<mem.alloc>) -> void", "effects [mem.alloc]", "entry:",
" %n = const.usize 1",
" channel.make @Box, %n, %heap, ok -> @made, err -> @oom",
"made(%tx: sender<@Box>, %rx: receiver<@Box>):", " trap",
"oom(%e: alloc_error):", " trap"
]
},
{
"case": "wrapped_mutex_endpoint", "command": "check", "exit": 1, "codes": ["E0006"],
"body": [
"type @Box = struct { endpoint: sender<u64> }",
"fn @f(%value: @Box) -> void", "effects []", "entry:", " %m = mutex.make %value", " trap"
]
},
{
"case": "copy_cap_zero", "command": "check", "exit": 1, "codes": ["E1001"],
"body": ["fn @f() -> void", "effects []", "entry:", " %cell = local.alloc cap<mem.alloc>", " local.zero %cell", " ret"]
},
{
"case": "nominal_atomic", "command": "check", "exit": 1, "codes": ["E1001", "E1001"],
"body": ["type @Box = struct { value: u64 }", "fn @w(%value: atomic<@Box>) -> atomic<@Box>", "effects []", "entry:", " ret %value"]
},
{
"case": "checked_identity", "command": "check", "exit": 1, "codes": ["E0004"],
"body": [
"fn @w(%value: checked<u64,@always>) -> checked<u64,@always>", "effects []", "entry:", " ret %value",
"fn @always(%value: ref<u64>) -> bool", "effects []", "entry:", " %yes = const.bool true", " ret %yes"
]
},
{
"case": "range_predicate", "command": "run", "fuel": 10000, "exit": 0, "status": "returned", "value": true,
"body": [
"type @Rep = struct { lo: u64, hi: u64 }",
"fn @within(%r: ref<@Rep>) -> bool", "effects []", "entry:",
" %lo = borrow.field @Rep.lo, %r", " %hi = borrow.field @Rep.hi, %r",
" %a = load %lo", " %b = load %hi", " borrow.end %lo", " borrow.end %hi",
" %ok = le.u64 %a, %b", " ret %ok",
"fn @main() -> bool", "effects []", "entry:",
" %a = const.u64 0", " %b = const.u64 5", " %v = struct.make @Rep(%a, %b)",
" %cell = local.alloc @Rep", " local.store %cell, %v", " %r = borrow.ref %cell",
" %ok = call @within(%r)", " borrow.end %r", " ret %ok"
]
}
]
}