DEVELOPMENT EDITION · 769442725406
Diagnostics Reference
On this page

B0706: indexing written with parentheses

Catalog status: active. Default severity: error. Stable name: parentheses-for-index. Family: Syntax and source text.

In Varc brackets index an array and parentheses call a subprogram or convert a value. This name is an array (or a function result that is one), so it is indexed with brackets.

Example (Varc)

fn main() {
    let squares: [1..=3]Integer = [1, 4, 9];
    let x: Integer = squares(2);
}

What to do

Write brackets: squares[2].

Regression source and further reading

Complete regression example: source, command arguments and expected results. The fixture deliberately reproduces this diagnostic.

See syntax and source text, the code index, and diagnostic interpretation for modes, replay, fix-its and JSON.