Lyricdev
GitHub

LYR-PAR0010

a tuple of fewer than two elements, or a label given twice

error ยท spec 03-types

A tuple literal or tuple type is written with one element and a comma, (1,), or a tuple type gives the same label to two elements.

Explanation

A tuple has at least two elements; one value in parentheses is a grouping, and there is no one-element tuple. The labels of a tuple type name its elements, so each stands once.

Write the value without the comma, add the second element, or give each label once.

Wrong

fn main(): void {
    let t = (1,);
}
fn main(): void {
    let t = (1, 2);
    let _ = t;
}