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

@ -2,3 +2,7 @@ error: type I32 does not take any generic arguments but 1 were passed
--> $DIR/generics_on_primitive.nil:2
2 | let a: I32[I32] = 0;
^^^
warning: unused variable: `a`
--> $DIR/generics_on_primitive.nil:2
2 | let a: I32[I32] = 0;
^

View file

@ -0,0 +1,12 @@
warning: unused function parameter: `a`
--> $DIR/generics_structs_in_args.nil:11
11 | function test(a: A[I32], b: B[I32, Int, I32], c: C) = ;
^
warning: unused function parameter: `b`
--> $DIR/generics_structs_in_args.nil:11
11 | function test(a: A[I32], b: B[I32, Int, I32], c: C) = ;
^
warning: unused function parameter: `c`
--> $DIR/generics_structs_in_args.nil:11
11 | function test(a: A[I32], b: B[I32, Int, I32], c: C) = ;
^

View file

@ -0,0 +1,12 @@
warning: unused function parameter: `a`
--> $DIR/structs.nil:9
9 | function test(a: A[I32], b: B[I32, Int, I32], c: C) = ;
^
warning: unused function parameter: `b`
--> $DIR/structs.nil:9
9 | function test(a: A[I32], b: B[I32, Int, I32], c: C) = ;
^
warning: unused function parameter: `c`
--> $DIR/structs.nil:9
9 | function test(a: A[I32], b: B[I32, Int, I32], c: C) = ;
^

View file

@ -22,3 +22,51 @@ error: type () does not take any generic arguments but 1 were passed
--> $DIR/wrong_amount.nil:22
22 | c3: C[I32],
^
warning: unused function parameter: `a1`
--> $DIR/wrong_amount.nil:9
9 | a1: A,
^^
warning: unused function parameter: `a2`
--> $DIR/wrong_amount.nil:10
10 | a2: A[],
^^
warning: unused function parameter: `a3`
--> $DIR/wrong_amount.nil:11
11 | a3: A[I32],
^^
warning: unused function parameter: `a4`
--> $DIR/wrong_amount.nil:12
12 | a4: A[I32, I32],
^^
warning: unused function parameter: `b1`
--> $DIR/wrong_amount.nil:14
14 | b1: B,
^^
warning: unused function parameter: `b2`
--> $DIR/wrong_amount.nil:15
15 | b2: B[],
^^
warning: unused function parameter: `b3`
--> $DIR/wrong_amount.nil:16
16 | b3: B[Int, Int],
^^
warning: unused function parameter: `b4`
--> $DIR/wrong_amount.nil:17
17 | b4: B[Int, I32, Int],
^^
warning: unused function parameter: `b5`
--> $DIR/wrong_amount.nil:18
18 | b5: B[Int, Int, Int, Int],
^^
warning: unused function parameter: `c1`
--> $DIR/wrong_amount.nil:20
20 | c1: C,
^^
warning: unused function parameter: `c2`
--> $DIR/wrong_amount.nil:21
21 | c2: C[],
^^
warning: unused function parameter: `c3`
--> $DIR/wrong_amount.nil:22
22 | c3: C[I32],
^^

View file

@ -0,0 +1,4 @@
warning: unused variable: `a`
--> $DIR/type_alias.nil:6
6 | let a: A = (0, 0);
^

View file

@ -0,0 +1,24 @@
warning: unused variable: `a1`
--> $DIR/type_assignments.nil:15
15 | let a1: Int = a;
^^
warning: unused variable: `b1`
--> $DIR/type_assignments.nil:16
16 | let b1: I32 = b;
^^
warning: unused variable: `c1`
--> $DIR/type_assignments.nil:17
17 | let c1: String = c;
^^
warning: unused variable: `d1`
--> $DIR/type_assignments.nil:18
18 | let d1: Bool = d;
^^
warning: unused variable: `e1`
--> $DIR/type_assignments.nil:19
19 | let e1: CustomType = e;
^^
warning: unused variable: `f1`
--> $DIR/type_assignments.nil:20
20 | let f1: (Int, I32) = f;
^^