Sakura Lang

V0009 expected_terminator

Two statements are on one line without ;, or junk follows a complete statement (design §2.4).

An error from the parse phase. sakura explain V0009 prints this explanation offline.

Two statements are on one line without ;, or junk follows a complete statement (design §2.4).

Wrong:

let a = 1 let b = 2

Fixed:

let a = 1; let b = 2

Wrong program

compiler/tests/ui/V0009_expected_terminator.sakura, which the compiler's ui suite runs through sakura check:

fn sum() -> Int {
  let a = 1 let b = 2
  a + b
}

sakura check --json reports this record (pretty-printed; $DIR is the fixture's directory):

{
  "schema_version": "1.0",
  "kind": "diagnostic",
  "id": "d:2dc1af46fa9baad6",
  "code": "V0009",
  "severity": "error",
  "phase": "parse",
  "message": "expected a newline or `;` after the statement",
  "snapshot": "sha256:$SNAPSHOT",
  "symbol_id": "main::V0009_expected_terminator::sum",
  "spans": [
    {
      "uri": "file://$DIR/V0009_expected_terminator.sakura",
      "content_hash": "sha256:3aeebd0c946288e40b85f153c9b9cfe41f60dcb9e6fa7baa7a8355353749a219",
      "start_byte": 64,
      "end_byte": 67,
      "role": "primary"
    }
  ],
  "related_ids": [],
  "expected": null,
  "actual": null,
  "obligation": null,
  "counterexample": null,
  "explanation_uri": "sakura://explain/V0009",
  "fixes": []
}

Fixed program

compiler/tests/ui/V0009_expected_terminator.fixed.sakura, which sakura check accepts with no diagnostics:

fn sum() -> Int {
  let a = 1
  let b = 2
  a + b
}
Edit on GitHub

On this page