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

[Improvement]: Confusing error message when collect sum is used with non sequence reference #42035

Closed
manuranga opened this issue Jan 24, 2024 · 1 comment
Assignees
Labels
needTriage The issue has to be inspected and labeled manually Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Improvement userCategory/Compilation

Comments

@manuranga
Copy link
Contributor

manuranga commented Jan 24, 2024

Description

import ballerina/io;

public function main() {
    string s = "12manu245xyz";
    int numbersCount = from var m in s
        let int code = m.getCodePoint(0)
        where code >= 48 && code <= 57
        collect sum(1);
    io:println(numbersCount);
}

Above code gives undefined function 'sum' error.

Describe your problem(s)

This error is confusing, since sum function is available and works if I put code in sum.

Describe your solution(s)

It should give something like non-sequence reference not not supported in collect clause error.

@ballerina-bot ballerina-bot added needTriage The issue has to be inspected and labeled manually userCategory/Compilation labels Jan 24, 2024
@manuranga manuranga added the Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. label Jan 24, 2024
@manuranga
Copy link
Contributor Author

Moved to #42036

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needTriage The issue has to be inspected and labeled manually Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Improvement userCategory/Compilation
Projects
None yet
Development

No branches or pull requests

3 participants