ballerina-spec icon indicating copy to clipboard operation
ballerina-spec copied to clipboard

Intersection types in included record parameters and record type inclusion

Open MaryamZi opened this issue 1 year ago • 1 comments

Description:

The spec says

for included record parameters

The type-reference in an included-record-param must refer to a type defined by a record-type-descriptor.

for record type inclusion

The type-reference must reference a type described by a record-type-descriptor.

Therefore, the following are not allowed (in jBallerina) at the moment, but can't we allow these?

type Record readonly & record {|
    int i;
    string j;
|};

function fn(*Record t) { // compilation error at the moment

}

type Record2 record {| 
    *Record; // compilation error at the moment
    byte i;
|};

MaryamZi avatar Mar 07 '23 10:03 MaryamZi

We should allow this.

jclark avatar Mar 13 '23 03:03 jclark