-
Notifications
You must be signed in to change notification settings - Fork 800
Open
Labels
Type/BugneedTriageThe issue has to be inspected and labeled manuallyThe issue has to be inspected and labeled manuallyuserCategory/Compilation
Description
Description
When using a match expression on a JSON field inside a do { } on fail block, and each match case performs a return, the Ballerina compiler reports:
ERROR [main.bal:(134:1,134:2)] this function must return a result
This issue occurs even when a wildcard (_) case is included.
Steps to Reproduce
Reproducible Code:
public function doEval(json selectExpression) returns string|error {
do {
match selectExpression.key1 {
"column" =>
{
return "c";
}
"select" =>
{
return "s";
}
_ =>
{
return "d";
}
}
} on fail error err {
return err;
}
}
Affected Version(s)
Ballerina 2201.12.10 (Swan Lake Update 12)
OS, DB, other environment details and versions
Windows 10
Related area
-> Compilation
Related issue(s) (optional)
No response
Suggested label(s) (optional)
No response
Suggested assignee(s) (optional)
No response
Metadata
Metadata
Assignees
Labels
Type/BugneedTriageThe issue has to be inspected and labeled manuallyThe issue has to be inspected and labeled manuallyuserCategory/Compilation