Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Incorrect error diagnostic message when return result is not defined for a worker that expects a return value #42746

Open
Thushara-Piyasekara opened this issue May 14, 2024 · 0 comments
Labels
Area/Diagnostics Issues related Diagnostics reported by the Compiler. #Compiler good first issue Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Bug userCategory/Compilation

Comments

@Thushara-Piyasekara
Copy link
Contributor

Thushara-Piyasekara commented May 14, 2024

Description

When a worker with a return type is defined, and nothing is being returned, the compiler gives the following error message,

ERROR [main.bal:(24:5,24:6)] this function must return a result

It is incorrect because the structure in question is a worker and not a function. The error should be refactored into something similar to,

ERROR [main.bal:(24:5,24:6)] this worker must return a result

Steps to Reproduce

Compile the following code,

public function main() returns error? {
    worker A returns int {

    }
}

Affected Version(s)

Ballerina 2201.8.6 (Swan Lake Update 8)

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

@ballerina-bot ballerina-bot added needTriage The issue has to be inspected and labeled manually userCategory/Compilation labels May 14, 2024
@Thushara-Piyasekara Thushara-Piyasekara changed the title [Bug]: Incorrect error diagnostic message when return result is not given for a worker that expects a return value [Bug]: Incorrect error diagnostic message when return result is not defined for a worker that expects a return value May 14, 2024
@gayaldassanayake gayaldassanayake added Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Area/Diagnostics Issues related Diagnostics reported by the Compiler. #Compiler and removed needTriage The issue has to be inspected and labeled manually labels May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/Diagnostics Issues related Diagnostics reported by the Compiler. #Compiler good first issue Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Bug userCategory/Compilation
Projects
None yet
Development

No branches or pull requests

4 participants