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

add compile error for variable modified but not read #2304

Open
andrewrk opened this issue Apr 18, 2019 · 0 comments
Open

add compile error for variable modified but not read #2304

andrewrk opened this issue Apr 18, 2019 · 0 comments
Milestone

Comments

@andrewrk
Copy link
Member

@andrewrk andrewrk commented Apr 18, 2019

test "aoeu" {
    var x: i32 = 1234;
    x += 1;
}

This should be error: variable 'x' modified but not read. In order to silence the error, one could use the underscore identifier:

test "aoeu" {
    var x: i32 = 1234;
    x += 1;
    _ = x;
}

This second test is expected to pass.

Thanks to @mattsta for identifying this missing compile error in #2303.

@andrewrk andrewrk added this to the 0.6.0 milestone Apr 18, 2019
@andrewrk andrewrk removed this from the 0.6.0 milestone Feb 10, 2020
@andrewrk andrewrk added this to the 0.7.0 milestone Feb 10, 2020
@andrewrk andrewrk removed this from the 0.7.0 milestone Oct 14, 2020
@andrewrk andrewrk added this to the 0.8.0 milestone Oct 14, 2020
@andrewrk andrewrk removed this from the 0.8.0 milestone Nov 6, 2020
@andrewrk andrewrk added this to the 0.9.0 milestone Nov 6, 2020
@andrewrk andrewrk removed this from the 0.9.0 milestone May 19, 2021
@andrewrk andrewrk added this to the 0.10.0 milestone May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant