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

Generate a proper object constructor expr for the return value in create function code action

Open pubudu91 opened this issue 4 years ago • 0 comments
trafficstars

Consider the following:

public function main() {
    object {
        string name;
        int age;
    } person = foo();
}

When using the create function code action for foo(), it generates the following:

function foo() returns object {string name;int age;} {
    
    return object {};
}

Currently, for ease of implementation, we have simply made the return value object {}. Need to see if this can be improved to generate an object constructor expression which matches the return type of the function.

pubudu91 avatar May 07 '21 15:05 pubudu91