You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
proc main() {
var a = (1, 2, 3);
var (x,y,z):int= a;
}
This gives the error:
baz.chpl:1: In function 'main':
baz.chpl:3: error: illegal tuple variable declaration with non-tuple initializer
Personally, I find this error message to be rather unhelpful as it suggests something about the initialization expression is wrong, rather than the type expression. I initially wrote this with multi-decl rules in mind, and thought I was specifying the element type of each tuple component. So when I first saw this error, I thought it might be a compiler bug with normalization or something rather than doing the wrong thing myself.
Changing int to 3*int gets things working, and it would be nice if the error message could suggest something along these lines.
The text was updated successfully, but these errors were encountered:
benharsh
changed the title
Better error for tuple variable declarations interact with non-tuple type expression
Better error for tuple variable declarations with non-tuple type expression
Mar 7, 2025
Consider the following program:
This gives the error:
Personally, I find this error message to be rather unhelpful as it suggests something about the initialization expression is wrong, rather than the type expression. I initially wrote this with multi-decl rules in mind, and thought I was specifying the element type of each tuple component. So when I first saw this error, I thought it might be a compiler bug with normalization or something rather than doing the wrong thing myself.
Changing
int
to3*int
gets things working, and it would be nice if the error message could suggest something along these lines.The text was updated successfully, but these errors were encountered: