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
Description:
jBallerina currently disallows the following since the name of the parameter is different.
typeConfigobject {
function get(stringk) returnsanydata;
};
classConfigImpl {
*Config;
function get(stringkey) returnsanydata { // `key` instead of `k` as parameter name
}
}
But I'm not sure if the spec requires this? (These may be due to checks left over from an older implementation).
A type-reference to a class is treated as a reference to the class's type; only the types of the methods and fields are copied from the referenced type. An object-field-descriptor or method-decl in a object-type-descriptor can override respectively an object-field-descriptor or method-decl of the same name in an included object-type-descriptor, provided the type declared for the field or method in the overriding descriptor is a subtype of the type declared in the overridden descriptor. An object-field-descriptor cannot override a method-decl, nor can a method-decl override an object-field-descriptor. It is an error if an object-type-descriptor has two or more object-type-inclusions that include an object-field-descriptor with the same name, unless those object-field-descriptors are overridden by an object-field-descriptor in the including object-type-descriptor. It is an error if an object-type-descriptor has two or more object-type-inclusions that include method-decls with the same name but different function-signatures, unless those method-decls are overridden by a method-decl in the including object-type-descriptor.
In general, of course we do not consider the names of parameters for typing, and this particular case is disallowed via an additional check for object type inclusion.
The following are allowed (as expected).
typeConfigrecord {
function (stringk) returnsanydataget;
};
typeConfigImplrecord {
*Config;
// overrding like this is allowed since it is a subtype of `get` from `Config`function (stringkey) returnsanydataget;
};
function get(stringkey) returnsanydata {
}
function (stringk) returnsanydatagetFunc= get;
Description:
jBallerina currently disallows the following since the name of the parameter is different.
But I'm not sure if the spec requires this? (These may be due to checks left over from an older implementation).
The spec only says
In general, of course we do not consider the names of parameters for typing, and this particular case is disallowed via an additional check for object type inclusion.
The following are allowed (as expected).
Related issues:
The text was updated successfully, but these errors were encountered: