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

Type of the array index not type-checked in reassignment LHS #5922

Closed
ironcev opened this issue Apr 25, 2024 · 0 comments · Fixed by #5923
Closed

Type of the array index not type-checked in reassignment LHS #5922

ironcev opened this issue Apr 25, 2024 · 0 comments · Fixed by #5923
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 Apr 25, 2024

The following script compiles without any errors. The array["test"] line will emit Internal compiler error: Attempt to load from non-copy type. but only if the poke(array) call is there. If that call is removed, even the array["test"] will not produce any error.

script;

fn main() {
    let mut array = [1, 2, 3];

    array[0] = 0;

    array[0u8] = 0;

    array[0u16] = 0;

    array[0u32] = 0;

    array[0u64] = 0;

    array[true] = 0;

    array[false] = 0;

    array[()] = 0;

    // array["test"] = 0;

    poke(array);
}

#[inline(never)]
fn poke<T>(_x: T) { }
@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 Apr 25, 2024
@ironcev ironcev self-assigned this Apr 25, 2024
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.

1 participant