V1011 missing_body
A function has no body.
An error from the resolve phase. sakura explain V1011 prints this explanation offline.
A function has no body. Only @external and @llm declarations may omit it (design §11.1,
§13.6). Write the body, or leave a typed hole ({ ?todo }) that sakura check accepts and
reports with its expected type.
Wrong:
fn answer() -> IntFixed:
fn answer() -> Int { 42 }Wrong program
compiler/tests/ui/V1011_missing_body.sakura, which the compiler's ui suite runs through sakura check:
fn answer() -> Intsakura check --json reports this record (pretty-printed; $DIR is the fixture's directory):
{
"schema_version": "1.0",
"kind": "diagnostic",
"id": "d:113646a45572cba8",
"code": "V1011",
"severity": "error",
"phase": "resolve",
"message": "function `answer` has no body; only `@external` and `@llm` declarations may omit it",
"snapshot": "sha256:$SNAPSHOT",
"symbol_id": "main::V1011_missing_body::answer",
"spans": [
{
"uri": "file://$DIR/V1011_missing_body.sakura",
"content_hash": "sha256:a0934d9e9c56abf72c8033a6645bf7dbffd399f7656e88d39811aa065ea0cffd",
"start_byte": 63,
"end_byte": 69,
"role": "primary"
}
],
"related_ids": [],
"expected": null,
"actual": null,
"obligation": null,
"counterexample": null,
"explanation_uri": "sakura://explain/V1011",
"fixes": []
}Fixed program
compiler/tests/ui/V1011_missing_body.fixed.sakura, which sakura check accepts with no diagnostics:
fn answer() -> Int { 42 }V1010 unknown_attribute
Only these attributes exist in v0: @tool, @llm, @external, @total, @contract_test, @deprecated, @server, @test_only on items, and @trust("reason") as an expression (design §2.5).
V1012 mixed_union_alternatives
type X = A | B must be either all existing error tags (an error-union alias) or all new variants.