UI test error annotations!

This commit is contained in:
nora 2024-06-02 20:48:17 +02:00
parent 5e7e99982d
commit a0efca50e0
42 changed files with 437 additions and 694 deletions

View file

@ -2,6 +2,7 @@ function a(_a: I32) =
___asm(
__locals(),
0,
//~^ ERROR: inline assembly instruction must be string literal with instruction
);
function main() = ;

View file

@ -1,4 +1,4 @@
error: inline assembly instruction must be string literal with instruction
--> $DIR/instr_not_string.nil:4
--> ./ui-tests/asm/instr_not_string.nil:4
4 | 0,
^

View file

@ -2,6 +2,7 @@ function dropping(_a: I32) =
___asm(
__locals(),
"meow meow",
//~^ ERROR: unknown instruction: meow
);
function main() = ;

View file

@ -1,4 +1,4 @@
error: unknown instruction: meow
--> $DIR/invalid_instr.nil:4
--> ./ui-tests/asm/invalid_instr.nil:4
4 | "meow meow",
^^^^^^^^^^^

View file

@ -1,5 +1,6 @@
function dropping(_a: I32) =
___asm(
//~^ ERROR: inline assembly must have __locals() as first argument
"local.get 0",
"drop",
);

View file

@ -1,4 +1,4 @@
error: inline assembly must have __locals() as first argument
--> $DIR/missing_locals.nil:2
--> ./ui-tests/asm/missing_locals.nil:2
2 | ___asm(
^

View file

@ -1,6 +1,8 @@
function dropping(_a: I32) = (
1;
___asm(__locals(), "drop");
//~^ ERROR: `___asm` cannot be used as a value
//~| ERROR: `__locals` cannot be used as a value
);
function main() = ;

View file

@ -1,8 +1,8 @@
error: `___asm` cannot be used as a value
--> $DIR/not_toplevel.nil:3
--> ./ui-tests/asm/not_toplevel.nil:3
3 | ___asm(__locals(), "drop");
^^^^^^
error: `__locals` cannot be used as a value
--> $DIR/not_toplevel.nil:3
--> ./ui-tests/asm/not_toplevel.nil:3
3 | ___asm(__locals(), "drop");
^^^^^^^^

View file

@ -2,6 +2,7 @@ function a(_a: I32) =
___asm(
__locals(),
"local.get 0 0",
//~^ ERROR: mismatched immediate lengths, expected 1, got 2
"drop",
);
@ -9,6 +10,7 @@ function b(_a: I32) =
___asm(
__locals(),
"local.get",
//~^ ERROR: mismatched immediate lengths, expected 1, got 0
"drop",
);

View file

@ -1,8 +1,8 @@
error: mismatched immediate lengths, expected 1, got 2
--> $DIR/wrong_imm.nil:4
--> ./ui-tests/asm/wrong_imm.nil:4
4 | "local.get 0 0",
^^^^^^^^^^^^^^^
error: mismatched immediate lengths, expected 1, got 0
--> $DIR/wrong_imm.nil:11
11 | "local.get",
--> ./ui-tests/asm/wrong_imm.nil:12
12 | "local.get",
^^^^^^^^^^^

View file

@ -1,5 +1,10 @@
function main() = (
let a: Int = "";
//~^ ERROR: cannot assign String to Int
//~| WARN: unused variable: `a`
let b: Int = "";
//~^ ERROR: cannot assign String to Int
//~| WARN: unused variable: `b`
c;
//~^ ERROR: cannot find c
);

View file

@ -1,20 +1,20 @@
error: cannot find c
--> $DIR/basic_recovery.nil:4
4 | c;
--> ./ui-tests/basic_recovery.nil:8
8 | c;
^
error: cannot assign String to Int
--> $DIR/basic_recovery.nil:2
--> ./ui-tests/basic_recovery.nil:2
2 | let a: Int = "";
^
error: cannot assign String to Int
--> $DIR/basic_recovery.nil:3
3 | let b: Int = "";
--> ./ui-tests/basic_recovery.nil:5
5 | let b: Int = "";
^
warning: unused variable: `a`
--> $DIR/basic_recovery.nil:2
--> ./ui-tests/basic_recovery.nil:2
2 | let a: Int = "";
^
warning: unused variable: `b`
--> $DIR/basic_recovery.nil:3
3 | let b: Int = "";
--> ./ui-tests/basic_recovery.nil:5
5 | let b: Int = "";
^

View file

@ -1 +0,0 @@
function main() = (

View file

@ -1,8 +0,0 @@
error: unexpected end of file
--> $DIR/body_mismatched_parens.nil:2
2 |
^
error: `main` function not found
--> $DIR/body_mismatched_parens.nil:1
1 | function main() = (
^

View file

@ -1,5 +1,6 @@
function main() = (
x();
//~^ ERROR: missing argument of type Int
);
function x(_a: Int) = ;

View file

@ -1,4 +1,4 @@
error: missing argument of type Int
--> $DIR/missing_args.nil:2
--> ./ui-tests/functions/missing_args.nil:2
2 | x();
^

View file

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

View file

@ -1,3 +1,4 @@
mod b;
//~^ ERROR: .nil files cannot have submodules. use .mod.nil in a subdirectory
function main() = ;

View file

@ -1,4 +1,4 @@
error: .nil files cannot have submodules. use .mod.nil in a subdirectory
--> $DIR/nil_submodules.nil:1
--> ./ui-tests/modules/nil_submodules.nil:1
1 | mod b;
^

View file

@ -1,3 +1,4 @@
function main() = (
let _false, l = list.new();
let _l = list.new();
//~^ ERROR: cannot find list
);

View file

@ -1,8 +1,4 @@
error: expected `=`, found `,`
--> $DIR/module_not_found.nil:2
2 | let _false, l = list.new();
^
error: `main` function not found
--> $DIR/module_not_found.nil:1
1 | function main() = (
^
error: cannot find list
--> ./ui-tests/resolve/module_not_found.nil:2
2 | let _l = list.new();
^^^^

View file

@ -1,3 +1,4 @@
function main() = (
let a: I32[I32] = 0;
let _a: I32[I32] = 0;
//~^ ERROR: type I32 does not take any generic arguments but 1 were passed
);

View file

@ -1,8 +1,4 @@
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;
^
--> ./ui-tests/type/generics/generics_on_primitive.nil:2
2 | let _a: I32[I32] = 0;
^^^

View file

@ -1,12 +1,12 @@
warning: unused function parameter: `a`
--> $DIR/generics_structs_in_args.nil:11
--> ./ui-tests/type/generics/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
--> ./ui-tests/type/generics/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
--> ./ui-tests/type/generics/generics_structs_in_args.nil:11
11 | function test(a: A[I32], b: B[I32, Int, I32], c: C) = ;
^

View file

@ -1,12 +1,12 @@
warning: unused function parameter: `a`
--> $DIR/structs.nil:9
--> ./ui-tests/type/generics/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
--> ./ui-tests/type/generics/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
--> ./ui-tests/type/generics/structs.nil:9
9 | function test(a: A[I32], b: B[I32, Int, I32], c: C) = ;
^

View file

@ -6,20 +6,26 @@ type B[T, U, V] = struct {
type C = ();
function test(
a1: A,
a2: A[],
a3: A[I32],
a4: A[I32, I32],
_a1: A,
//~^ ERROR: missing generics for type A, expected 1, but only 0 were passed
_a2: A[],
//~^ ERROR: missing generics for type A, expected 1, but only 0 were passed
_a3: A[I32],
_a4: A[I32, I32],
b1: B,
b2: B[],
b3: B[Int, Int],
b4: B[Int, I32, Int],
b5: B[Int, Int, Int, Int],
_b1: B,
//~^ ERROR: missing generics for type B, expected 3, but only 0 were passed
_b2: B[],
//~^ ERROR: missing generics for type B, expected 3, but only 0 were passed
_b3: B[Int, Int],
//~^ ERROR: issing generics for type B, expected 3, but only 2 were passed
_b4: B[Int, I32, Int],
_b5: B[Int, Int, Int, Int],
c1: C,
c2: C[],
c3: C[I32],
_c1: C,
_c2: C[],
_c3: C[I32],
//~^ ERROR: type () does not take any generic arguments but 1 were passed
) = ;
function main() = ;

View file

@ -1,72 +1,24 @@
error: missing generics for type A, expected 1, but only 0 were passed
--> $DIR/wrong_amount.nil:9
9 | a1: A,
^
--> ./ui-tests/type/generics/wrong_amount.nil:9
9 | _a1: A,
^
error: missing generics for type A, expected 1, but only 0 were passed
--> $DIR/wrong_amount.nil:10
10 | a2: A[],
^
--> ./ui-tests/type/generics/wrong_amount.nil:11
11 | _a2: A[],
^
error: missing generics for type B, expected 3, but only 0 were passed
--> $DIR/wrong_amount.nil:14
14 | b1: B,
^
--> ./ui-tests/type/generics/wrong_amount.nil:16
16 | _b1: B,
^
error: missing generics for type B, expected 3, but only 0 were passed
--> $DIR/wrong_amount.nil:15
15 | b2: B[],
^
--> ./ui-tests/type/generics/wrong_amount.nil:18
18 | _b2: B[],
^
error: missing generics for type B, expected 3, but only 2 were passed
--> $DIR/wrong_amount.nil:16
16 | b3: B[Int, Int],
^
--> ./ui-tests/type/generics/wrong_amount.nil:20
20 | _b3: B[Int, Int],
^
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],
^^
--> ./ui-tests/type/generics/wrong_amount.nil:27
27 | _c3: C[I32],
^

View file

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

View file

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