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

410 lines
9.8 KiB
JSON

{
"purpose": "Executed current-language rejection baselines, not implemented-contract conformance or proof of format-0 compatibility. File labels removed; all other emitted diagnostic fields retained.",
"compiler": "c633f23",
"command": "aji check FILE.air",
"cases": [
{
"case": "pre_unknown",
"source": [
"module contract.compatibility",
"air 0",
"lang 0.1",
"features [effects]",
"fn @f(%x: u64) -> u64",
"effects []",
"entry:",
" contract.pre @p(%x)",
" ret %x",
"fn @p(%v: u64) -> bool",
"effects []",
"entry:",
" %b = const.bool true",
" ret %b"
],
"exit": 1,
"diagnostics": [
{
"code": "E0004",
"kind": "parse.unknown_name",
"severity": "error",
"line": 8,
"col": 2,
"name": "contract.pre",
"message": "unknown opcode"
}
]
},
{
"case": "old_post_unknown",
"source": [
"module contract.compatibility",
"air 0",
"lang 0.1",
"features [effects]",
"fn @f(%x: u64) -> u64",
"effects []",
"entry:",
" %old = contract.old @snapshot(%x)",
" contract.post @post(%old, result)",
" ret %x",
"fn @p(%v: u64) -> bool",
"effects []",
"entry:",
" %b = const.bool true",
" ret %b",
"fn @snapshot(%v: u64) -> u64",
"effects []",
"entry:",
" ret %v",
"fn @post(%before: u64, %after: u64) -> bool",
"effects []",
"entry:",
" %b = const.bool true",
" ret %b"
],
"exit": 1,
"diagnostics": [
{
"code": "E0004",
"kind": "parse.unknown_name",
"severity": "error",
"line": 8,
"col": 9,
"name": "contract.old",
"message": "unknown opcode"
},
{
"code": "E0004",
"kind": "parse.unknown_name",
"severity": "error",
"line": 9,
"col": 2,
"name": "contract.post",
"message": "unknown opcode"
}
]
},
{
"case": "old_body_escape",
"source": [
"module contract.compatibility",
"air 0",
"lang 0.1",
"features [effects]",
"fn @f(%x: u64) -> u64",
"effects []",
"entry:",
" %old = contract.old @snapshot(%x)",
" %v = add.checked.u64 %old, %x",
" ret %v",
"fn @p(%v: u64) -> bool",
"effects []",
"entry:",
" %b = const.bool true",
" ret %b",
"fn @snapshot(%v: u64) -> u64",
"effects []",
"entry:",
" ret %v"
],
"exit": 1,
"diagnostics": [
{
"code": "E0004",
"kind": "parse.unknown_name",
"severity": "error",
"line": 8,
"col": 9,
"name": "contract.old",
"message": "unknown opcode"
},
{
"code": "E5001",
"kind": "air.invalid_ssa",
"severity": "error",
"line": 9,
"col": 23,
"function": "f",
"value": "%old",
"message": "value used but never defined"
}
]
},
{
"case": "pre_unrelated_undefined",
"source": [
"module contract.compatibility",
"air 0",
"lang 0.1",
"features [effects]",
"fn @f(%x: u64) -> u64",
"effects []",
"entry:",
" contract.pre @p(%x)",
" %v = add.checked.u64 %missing, %x",
" ret %v",
"fn @p(%v: u64) -> bool",
"effects []",
"entry:",
" %b = const.bool true",
" ret %b"
],
"exit": 1,
"diagnostics": [
{
"code": "E0004",
"kind": "parse.unknown_name",
"severity": "error",
"line": 8,
"col": 2,
"name": "contract.pre",
"message": "unknown opcode"
},
{
"code": "E5001",
"kind": "air.invalid_ssa",
"severity": "error",
"line": 9,
"col": 23,
"function": "f",
"value": "%missing",
"message": "value used but never defined"
}
]
},
{
"case": "old_body_and_unrelated_undefined",
"source": [
"module contract.compatibility",
"air 0",
"lang 0.1",
"features [effects]",
"fn @f(%x: u64) -> u64",
"effects []",
"entry:",
" %old = contract.old @snapshot(%x)",
" %v = add.checked.u64 %old, %missing",
" ret %v",
"fn @p(%v: u64) -> bool",
"effects []",
"entry:",
" %b = const.bool true",
" ret %b",
"fn @snapshot(%v: u64) -> u64",
"effects []",
"entry:",
" ret %v"
],
"exit": 1,
"diagnostics": [
{
"code": "E0004",
"kind": "parse.unknown_name",
"severity": "error",
"line": 8,
"col": 9,
"name": "contract.old",
"message": "unknown opcode"
},
{
"code": "E5001",
"kind": "air.invalid_ssa",
"severity": "error",
"line": 9,
"col": 23,
"function": "f",
"value": "%old",
"message": "value used but never defined"
},
{
"code": "E5001",
"kind": "air.invalid_ssa",
"severity": "error",
"line": 9,
"col": 29,
"function": "f",
"value": "%missing",
"message": "value used but never defined"
}
]
},
{
"case": "checked_make_used",
"source": [
"module contract.compatibility",
"air 0",
"lang 0.1",
"features [effects, ownership]",
"fn @f(%x: u64) -> u64",
"effects []",
"entry:",
" %s = checked.make checked<u64,@p>, %x",
" %r = checked.take %s",
" ret %r",
"fn @p(%v: ref<u64>) -> bool",
"effects []",
"entry:",
" %b = const.bool true",
" ret %b"
],
"exit": 1,
"diagnostics": [
{
"code": "E0004",
"kind": "parse.unknown_name",
"severity": "error",
"line": 8,
"col": 7,
"name": "checked.make",
"message": "unknown opcode"
},
{
"code": "E0004",
"kind": "parse.unknown_name",
"severity": "error",
"line": 9,
"col": 7,
"name": "checked.take",
"message": "unknown opcode"
},
{
"code": "E5001",
"kind": "air.invalid_ssa",
"severity": "error",
"line": 10,
"col": 6,
"function": "f",
"value": "%r",
"message": "value used but never defined"
}
]
},
{
"case": "checked_type_signature",
"source": [
"module contract.compatibility",
"air 0",
"lang 0.1",
"features [effects, ownership]",
"fn @f(%x: checked<u64,@p>) -> checked<u64,@p>",
"effects []",
"entry:",
" ret %x",
"fn @p(%v: ref<u64>) -> bool",
"effects []",
"entry:",
" %b = const.bool true",
" ret %b"
],
"exit": 1,
"diagnostics": [
{
"code": "E0004",
"kind": "parse.unknown_name",
"severity": "error",
"line": 5,
"col": 11,
"name": "checked",
"message": "unknown type"
}
]
},
{
"case": "contract_header",
"source": [
"module contract.compatibility",
"air 0",
"lang 0.1",
"features [effects]",
"fn @f(%x: u64) -> u64",
"effects []",
"requires @p(%x)",
"entry:",
" ret %x",
"fn @p(%v: u64) -> bool",
"effects []",
"entry:",
" %b = const.bool true",
" ret %b"
],
"exit": 1,
"diagnostics": [
{
"code": "E0001",
"kind": "parse.unexpected_token",
"severity": "error",
"line": 7,
"col": 10,
"expected": "`:`",
"found": "p",
"message": "expected `:`"
}
]
},
{
"case": "ordinary_undefined",
"source": [
"module contract.compatibility",
"air 0",
"lang 0.1",
"features [effects]",
"fn @f(%x: u64) -> u64",
"effects []",
"entry:",
" %v = add.checked.u64 %missing, %x",
" ret %v",
"fn @p(%v: u64) -> bool",
"effects []",
"entry:",
" %b = const.bool true",
" ret %b"
],
"exit": 1,
"diagnostics": [
{
"code": "E5001",
"kind": "air.invalid_ssa",
"severity": "error",
"line": 8,
"col": 23,
"function": "f",
"value": "%missing",
"message": "value used but never defined"
}
]
},
{
"case": "unknown_feature",
"source": [
"module contract.compatibility",
"air 0",
"lang 0.1",
"features [contracts, effects]",
"fn @f(%x: u64) -> u64",
"effects []",
"entry:",
" contract.pre @p(%x)",
" ret %x",
"fn @p(%v: u64) -> bool",
"effects []",
"entry:",
" %b = const.bool true",
" ret %b"
],
"exit": 1,
"diagnostics": [
{
"code": "E0006",
"kind": "module.unsupported_feature",
"severity": "error",
"line": 4,
"col": 1,
"reason": "unknown_feature",
"feature": "contracts",
"message": "feature cannot be used"
}
]
}
]
}