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
When accessing a field of a nilable class, the postfix-! operator should not be required when the use of the field is limited to compile-time operations. This is for convenience.
For example, none of the !s in this code should be required, as there should be no runtime nil checks. It is more convenient to omit them.
class C1 {
var x:int;
var y; // a generic field
}
class C2 {
param p;
type t;
}
var c:owned C1(owned C2(5,int)?)?;
// the type of a fieldwriteln(c!.x.type:string, c!.y.type:string);
// type, param queries on the class pointed to by a fieldwriteln(c!.y.p:string, c!.y.t:string);
Example test:
# see proc getSuperType()
test/classes/diten/nearestMutualParentClass.chpl
The text was updated successfully, but these errors were encountered:
This is a more complex pattern than #13617.
When accessing a field of a nilable class, the postfix-
!
operator should not be required when the use of the field is limited to compile-time operations. This is for convenience.For example, none of the
!
s in this code should be required, as there should be no runtime nil checks. It is more convenient to omit them.Example test:
The text was updated successfully, but these errors were encountered: