Detect unused variables

This commit is contained in:
nora 2024-05-13 20:02:08 +02:00
parent f164aad631
commit 9270f52e6b
33 changed files with 340 additions and 63 deletions

View file

@ -0,0 +1,22 @@
//@check-pass
function main() = (
let x = 0;
let _ok = 0;
let used = 0;
used;
);
function x() = (
let x = 0;
(
let x = 0;
call(x);
);
let y = x;
);
function call(_a: Int) = ;
function param(p: Int) = ;

View file

@ -0,0 +1,12 @@
warning: unused variable: `x`
--> $DIR/unused_vars.nil:4
4 | let x = 0;
^
warning: unused variable: `y`
--> $DIR/unused_vars.nil:17
17 | let y = x;
^
warning: unused function parameter: `p`
--> $DIR/unused_vars.nil:22
22 | function param(p: Int) = ;
^