V3010 invalid_operation_row
An effect operation's row may contain only Fail<…> in v0 (design §5.5).
An error from the effect phase. sakura explain V3010 prints this explanation offline.
An effect operation's row may contain only Fail<…> in v0 (design §5.5). An operation states
how it can fail; which other effects run is the handler's business, and the handler's own row
carries them.
Wrong:
effect Store { fn save(key: String) -> Unit ! {Console} }Fixed:
error Full
effect Store { fn save(key: String) -> Unit ! {Fail<Full>} }Wrong program
compiler/tests/ui/V3010_invalid_operation_row.sakura, which the compiler's ui suite runs through sakura check:
effect Store {
fn save(key: String) -> Unit ! {Console}
}sakura check --json reports this record (pretty-printed; $DIR is the fixture's directory):
{
"schema_version": "1.0",
"kind": "diagnostic",
"id": "d:a4b7790be692f83a",
"code": "V3010",
"severity": "error",
"phase": "effect",
"message": "operation `save` may only declare `Fail<…>` in its row (design §5.5)",
"snapshot": "sha256:$SNAPSHOT",
"symbol_id": "main::V3010_invalid_operation_row::Store.save",
"spans": [
{
"uri": "file://$DIR/V3010_invalid_operation_row.sakura",
"content_hash": "sha256:57175066baa343e9c90ba3522cbcca1eb9714fb6cb102fe0f1e930bd25c7f191",
"start_byte": 82,
"end_byte": 91,
"role": "primary"
}
],
"related_ids": [],
"expected": null,
"actual": null,
"obligation": null,
"counterexample": null,
"explanation_uri": "sakura://explain/V3010",
"fixes": []
}Fixed program
compiler/tests/ui/V3010_invalid_operation_row.fixed.sakura, which sakura check accepts with no diagnostics:
error Full
effect Store {
fn save(key: String) -> Unit ! {Fail<Full>}
}