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

When calling associated functions and operators, errors shown only on the first parameter #5660

Open
ironcev opened this issue Feb 26, 2024 · 0 comments · May be fixed by #5909
Open

When calling associated functions and operators, errors shown only on the first parameter #5660

ironcev opened this issue Feb 26, 2024 · 0 comments · May be fixed by #5909
Assignees
Labels
bug Something isn't working compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen compiler General compiler. Should eventually become more specific as the issue is triaged

Comments

@ironcev
Copy link
Member

ironcev commented Feb 26, 2024

In case of the associated function and the operator core::ops::add, the Variable "..." does not exist in this scope. error is shown only for the first parameter instead for all of them.

script;

struct S {}

impl S {
    fn associated(a: u64, b: u64, c: u64) -> u64 {
        a + b + c
    }
}

fn function(a: u64, b: u64, c: u64) -> u64 {
    a + b + c
}

fn main() {
    let _ = S::associated(x, y, z); // BUG: Error shown only for "x".

    let _ = function(x, y, z); // OK: Error shown for "x", "y", and "z".

    let _ = x + y + z; // BUG: Error shown only for "x".
}

On beta-5 unknown variable errors are shown on all variables in all three cases.

@ironcev ironcev added bug Something isn't working compiler General compiler. Should eventually become more specific as the issue is triaged compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen labels Feb 26, 2024
@esdrubal esdrubal self-assigned this Feb 26, 2024
esdrubal added a commit that referenced this issue Apr 23, 2024
type_check_method_application does the parsing of arguments in 2 passes,
but when the resolved_method_name failed the argument error would not be displayed.

We now store the arg_handlers and append their errors in case resolve_method_name fails.

Fixes #5660
@esdrubal esdrubal linked a pull request Apr 23, 2024 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen compiler General compiler. Should eventually become more specific as the issue is triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants