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
Today, we don't permit references to fields within an init() rouitne before they're initialized, to avoid read-before-init errors. However, the current error-checking also prevents us from referring to the types of such fields (even when they have no runtime type information), which seems too strict. As an example (ATO):
record R {
var x:int;
procinit(y: x.type) {
writeln(x.type:string);
this.x = y;
}
}
var myR =new R(y=42);
writeln(myR);
The two references to x.type before x is initialized generate warnings:
code.chpl:4: In initializer:
code.chpl:5: error: field "x" used before it is initialized
code.chpl:4: error: invalid access of class member in initializer argument list
but it seems like they shouldn't.
The text was updated successfully, but these errors were encountered:
Today, we don't permit references to fields within an
init()
rouitne before they're initialized, to avoid read-before-init errors. However, the current error-checking also prevents us from referring to the types of such fields (even when they have no runtime type information), which seems too strict. As an example (ATO):The two references to
x.type
beforex
is initialized generate warnings:but it seems like they shouldn't.
The text was updated successfully, but these errors were encountered: