V0008 nesting_limit_exceeded
Expressions, types, patterns or blocks nest deeper than the parser's limit (128).
An error from the parse phase. sakura explain V0008 prints this explanation offline.
Expressions, types, patterns or blocks nest deeper than the parser's limit (128). The limit
keeps the compiler's stack bounded on malformed or adversarial input. Split the expression with
let bindings.
Wrong program
compiler/tests/ui/V0008_nesting_limit.sakura, which the compiler's ui suite runs through sakura check:
The program is 10022 bytes, too long to show here; open the file to read it.
sakura check --json reports this record (pretty-printed; $DIR is the fixture's directory):
{
"schema_version": "1.0",
"kind": "diagnostic",
"id": "d:53e1660d0c45dbbd",
"code": "V0008",
"severity": "error",
"phase": "parse",
"message": "nesting exceeds the limit of 128",
"snapshot": "sha256:$SNAPSHOT",
"symbol_id": "main::V0008_nesting_limit::deep",
"spans": [
{
"uri": "file://$DIR/V0008_nesting_limit.sakura",
"content_hash": "sha256:b0535cfc22662ebf15361d5ab0c56fe7b5f50a4fd0acf3139b95343829f66f54",
"start_byte": 240,
"end_byte": 241,
"role": "primary"
}
],
"related_ids": [],
"expected": null,
"actual": null,
"obligation": null,
"counterexample": null,
"explanation_uri": "sakura://explain/V0008",
"fixes": []
}Fixed program
compiler/tests/ui/V0008_nesting_limit.fixed.sakura, which sakura check accepts with no diagnostics:
fn deep() -> Int {
let inner = ((1))
((inner))
}