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
In a recent SO question, a user expressed confusion over getting a "use before init" error for a case like this:
record R {
var x:[1..3]int;
procinit() {
for i in1..3do x[i]= i; // error: field "x" used before it is initialized
}
}
var myR: R;
which is understandable since it appears as though the line in question is initializing the array rather than using it, logically speaking. Using --detailed-errors didn't seem to improve the message as of Chapel 2.4.
Here, I'm wondering whether we could specialize this error message for the initializer context to add some additional detail like "Within an initializer, each field must be initialized using an assignment of the form [this.]field = expr; before it is referenced." We could potentially add "Or use an init this; statement before referencing the field to opt into default field initialization."
The text was updated successfully, but these errors were encountered:
In a recent SO question, a user expressed confusion over getting a "use before init" error for a case like this:
which is understandable since it appears as though the line in question is initializing the array rather than using it, logically speaking. Using
--detailed-errors
didn't seem to improve the message as of Chapel 2.4.Here, I'm wondering whether we could specialize this error message for the initializer context to add some additional detail like "Within an initializer, each field must be initialized using an assignment of the form
[this.]field = expr;
before it is referenced." We could potentially add "Or use aninit this;
statement before referencing the field to opt into default field initialization."The text was updated successfully, but these errors were encountered: