V1002 unresolved_name
No value with this name is in scope.
An error from the resolve phase. sakura explain V1002 prints this explanation offline.
No value with this name is in scope. Check the spelling, add an import, or define it.
Wrong:
fn main() -> Unit ! {Console} { Console.print(greting) }Fixed:
fn main() -> Unit ! {Console} { let greeting = "hi"; Console.print(greeting) }Wrong program
compiler/tests/ui/V1002_unresolved_name.sakura, which the compiler's ui suite runs through sakura check:
fn total() -> Int { subtotal + 1 }sakura check --json reports this record (pretty-printed; $DIR is the fixture's directory):
{
"schema_version": "1.0",
"kind": "diagnostic",
"id": "d:d37ae75eb7ba43ab",
"code": "V1002",
"severity": "error",
"phase": "resolve",
"message": "cannot find `subtotal` in this scope",
"snapshot": "sha256:$SNAPSHOT",
"symbol_id": "main::V1002_unresolved_name::total",
"spans": [
{
"uri": "file://$DIR/V1002_unresolved_name.sakura",
"content_hash": "sha256:a05007960f2dfb9768cc5b843ff90f123b87583f10bdfecfe5abb50d9e2dbc5e",
"start_byte": 54,
"end_byte": 62,
"role": "primary"
}
],
"related_ids": [],
"expected": null,
"actual": null,
"obligation": null,
"counterexample": null,
"explanation_uri": "sakura://explain/V1002",
"fixes": []
}Fixed program
compiler/tests/ui/V1002_unresolved_name.fixed.sakura, which sakura check accepts with no diagnostics:
fn total(subtotal: Int) -> Int { subtotal + 1 }