ballerina-platform / ballerina-lang

The Ballerina Programming Language
https://ballerina.io/
Apache License 2.0
3.66k stars 751 forks source link

[Bug]: Compilation fails for some mapping constructors with query expression and lax access with check with union CETs #40510

Open MaryamZi opened 1 year ago

MaryamZi commented 1 year ago

Description

$title.

Steps to Reproduce

The following works.

public function main() returns error? {
    json[] books = [];
    map<json>|error a = {
        items: from json item in books
                    let int id = 1
                    select {
                        price: check float:fromString(check item.itemBook.price)
                    }
    };
}

but the following doesn't

public function main() returns error? {
    json[] books = [];
    map<json>|error a = {
        items: from json item in books
                    let int id = 1
                    select {
                        price: check float:fromString(check item.itemBook.price),
                        id: id
                    }
    };
}

Affected Version(s)

2201.5.0

OS, DB, other environment details and versions

No response

Related area

-> Compilation

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

MaryamZi commented 1 month ago

Seems to work on U10 (and maybe earlier versions).