Sakura Lang

V0011 call_site_type_arguments

Expressions cannot take type arguments in v0 (design §3.2).

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

Expressions cannot take type arguments in v0 (design §3.2). Annotate the binding instead.

Wrong:

let xs = List<Int>.empty()

Fixed:

let xs: List<Int> = List.empty()

Wrong program

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

fn none() -> List<Int> { List<Int>.empty() }

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

{
  "schema_version": "1.0",
  "kind": "diagnostic",
  "id": "d:4a3ecb10c71e5d71",
  "code": "V0011",
  "severity": "error",
  "phase": "parse",
  "message": "type arguments are not allowed on a type path; annotate the binding instead, e.g. `let xs: List<Int> = List.empty()`",
  "snapshot": "sha256:$SNAPSHOT",
  "symbol_id": "main::V0011_call_site_type_arguments::none",
  "spans": [
    {
      "uri": "file://$DIR/V0011_call_site_type_arguments.sakura",
      "content_hash": "sha256:b53d8923eac9064225dfe966b725c0f580bb879b266dab596f3e78257c992777",
      "start_byte": 63,
      "end_byte": 64,
      "role": "primary"
    }
  ],
  "related_ids": [],
  "expected": null,
  "actual": null,
  "obligation": null,
  "counterexample": null,
  "explanation_uri": "sakura://explain/V0011",
  "fixes": []
}

More fixtures for this code: compiler/tests/ui/V0011_type_arguments_at_call.sakura.

Fixed program

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

fn none() -> List<Int> { List.empty() }
Edit on GitHub

On this page