Closed mindula closed 3 months ago
function getVal(string s) returns string|error {
return "";
}
function getVal2(function s = function () {
do {function k = function () {string aa = check getVal("");};} on fail {
}}) returns string|error {
return "";
}
The issue occurs when a check expression is used inside a lambda function. For the check expression in the above scenario, we should suggest the invalid usage of the 'check' expression operator
compilation error. In the BLangFunction visit method in CodeAnalyzer.java
, we check if the function is a lambda function and if it is, we return early. As a result of that, the body of the function in not being visited which is why we're not getting the compilation error for the check expression.
This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now.
- Reason/EngineeringMistake - The issue occurred due to a mistake made in the past.
- Reason/Regression - The issue has introduced a regression.
- Reason/MultipleComponentInteraction - Issue occured due to interactions in multiple components.
- Reason/Complex - Issue occurred due to complex scenario.
- Reason/Invalid - Issue is invalid.
- Reason/Other - None of the above cases.
Description
Getting a null pointer exception when executing the code below.
Steps to Reproduce
Affected Version(s)
No response
OS, DB, other environment details and versions
No response
Related area
-> Compilation
Related issue(s) (optional)
Suggested label(s) (optional)
No response
Suggested assignee(s) (optional)
No response