This commit is contained in:
nora 2023-12-15 23:08:23 +01:00
parent 7fec1b1ce7
commit a22cc15b59
11 changed files with 54 additions and 54 deletions

6
std/io.nil Normal file
View file

@ -0,0 +1,6 @@
import ("wasi_snapshot_preview1" "fd_write")
fd_write(fd: I32, ciovec_ptr: I32, ciovec_len: I32, out_ptr: I32): I32;
function print(s: String) = (
let s: (I32, I32) = ___transmute(s);
);

View file

@ -1,5 +1,6 @@
mod rt;
mod list;
mod io;
function printlnI32(x: I32) = (
printI32(x);

View file

@ -1,5 +1,3 @@
//@check-pass
function dropping(a: I32) =
___asm(
__locals(),

View file

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

View file

@ -1,5 +1,3 @@
//@check-pass
function dropping(a: I32) =
___asm(
"local.get 0",

View file

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

View file

@ -1,5 +1,3 @@
//@check-pass
function a(a: I32) =
___asm(
__locals(),

View file

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

View file

@ -0,0 +1,5 @@
//@check-pass
import ("wasi_snapshot_preview1" "fd_write") fd_write(a: I32, b: I32, c: I32, d: I32): I32;
function main() = ;

View file

@ -1,4 +1,17 @@
error: `main` function not found
--> $DIR/structs.nil:1
1 | type A[T] = struct { a: T };
/home/nils/projects/riverdelta/target/ast.js:110
throw new Error(`substitution out of range, param index ${ty.idx} of param ${ty.name} out of range for length ${genericArgs.length}`);
^
Error: substitution out of range, param index 0 of param T out of range for length 0
at substituteTy (/home/nils/projects/riverdelta/target/ast.js:110:23)
at subst (/home/nils/projects/riverdelta/target/ast.js:106:27)
at Array.map (<anonymous>)
at substituteTy (/home/nils/projects/riverdelta/target/ast.js:125:45)
at typeOfItem (/home/nils/projects/riverdelta/target/typeck/item.js:193:33)
at Object.itemInner (/home/nils/projects/riverdelta/target/typeck/index.js:63:54)
at Object.item (/home/nils/projects/riverdelta/target/ast.js:146:34)
at /home/nils/projects/riverdelta/target/ast.js:164:55
at Array.map (<anonymous>)
at foldAst (/home/nils/projects/riverdelta/target/ast.js:164:34)
Node.js v18.18.2

View file

@ -1,36 +1,17 @@
error: expected 1 generic arguments, found 0
--> $DIR/wrong_amount.nil:9
9 | a1: A,
^
error: expected 1 generic arguments, found 0
--> $DIR/wrong_amount.nil:10
10 | a2: A[],
^
error: expected 1 generic arguments, found 2
--> $DIR/wrong_amount.nil:12
12 | a4: A[I32, I32],
^
error: expected 3 generic arguments, found 0
--> $DIR/wrong_amount.nil:14
14 | b1: B,
^
error: expected 3 generic arguments, found 0
--> $DIR/wrong_amount.nil:15
15 | b2: B[],
^
error: expected 3 generic arguments, found 2
--> $DIR/wrong_amount.nil:16
16 | b3: B[Int, Int],
^
error: expected 3 generic arguments, found 4
--> $DIR/wrong_amount.nil:18
18 | b5: B[Int, Int, Int, Int],
^
error: type () does not take generic arguments
--> $DIR/wrong_amount.nil:22
22 | c3: C[I32],
^
error: `main` function not found
--> $DIR/wrong_amount.nil:1
1 | type A[T] = struct { a: T };
/home/nils/projects/riverdelta/target/ast.js:110
throw new Error(`substitution out of range, param index ${ty.idx} of param ${ty.name} out of range for length ${genericArgs.length}`);
^
Error: substitution out of range, param index 0 of param T out of range for length 0
at substituteTy (/home/nils/projects/riverdelta/target/ast.js:110:23)
at subst (/home/nils/projects/riverdelta/target/ast.js:106:27)
at Array.map (<anonymous>)
at substituteTy (/home/nils/projects/riverdelta/target/ast.js:125:45)
at typeOfItem (/home/nils/projects/riverdelta/target/typeck/item.js:193:33)
at Object.itemInner (/home/nils/projects/riverdelta/target/typeck/index.js:63:54)
at Object.item (/home/nils/projects/riverdelta/target/ast.js:146:34)
at /home/nils/projects/riverdelta/target/ast.js:164:55
at Array.map (<anonymous>)
at foldAst (/home/nils/projects/riverdelta/target/ast.js:164:34)
Node.js v18.18.2