mirror of
https://github.com/Noratrieb/riverdelta.git
synced 2026-01-14 16:35:03 +01:00
tests
This commit is contained in:
parent
7fec1b1ce7
commit
a22cc15b59
11 changed files with 54 additions and 54 deletions
6
std/io.nil
Normal file
6
std/io.nil
Normal 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);
|
||||||
|
);
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
mod rt;
|
mod rt;
|
||||||
mod list;
|
mod list;
|
||||||
|
mod io;
|
||||||
|
|
||||||
function printlnI32(x: I32) = (
|
function printlnI32(x: I32) = (
|
||||||
printI32(x);
|
printI32(x);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
//@check-pass
|
|
||||||
|
|
||||||
function dropping(a: I32) =
|
function dropping(a: I32) =
|
||||||
___asm(
|
___asm(
|
||||||
__locals(),
|
__locals(),
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
error: unknown instruction: meow
|
error: unknown instruction: meow
|
||||||
--> $DIR/invalid_instr.nil:6
|
--> $DIR/invalid_instr.nil:4
|
||||||
6 | "meow meow",
|
4 | "meow meow",
|
||||||
^^^^^^^^^^^
|
^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
//@check-pass
|
|
||||||
|
|
||||||
function dropping(a: I32) =
|
function dropping(a: I32) =
|
||||||
___asm(
|
___asm(
|
||||||
"local.get 0",
|
"local.get 0",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
error: inline assembly must have __locals() as first argument
|
error: inline assembly must have __locals() as first argument
|
||||||
--> $DIR/missing_locals.nil:4
|
--> $DIR/missing_locals.nil:2
|
||||||
4 | ___asm(
|
2 | ___asm(
|
||||||
^
|
^
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
//@check-pass
|
|
||||||
|
|
||||||
function a(a: I32) =
|
function a(a: I32) =
|
||||||
___asm(
|
___asm(
|
||||||
__locals(),
|
__locals(),
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
error: mismatched immediate lengths, expected 1, got 2
|
error: mismatched immediate lengths, expected 1, got 2
|
||||||
--> $DIR/wrong_imm.nil:6
|
--> $DIR/wrong_imm.nil:4
|
||||||
6 | "local.get 0 0",
|
4 | "local.get 0 0",
|
||||||
^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^
|
||||||
error: mismatched immediate lengths, expected 1, got 0
|
error: mismatched immediate lengths, expected 1, got 0
|
||||||
--> $DIR/wrong_imm.nil:13
|
--> $DIR/wrong_imm.nil:11
|
||||||
13 | "local.get",
|
11 | "local.get",
|
||||||
^^^^^^^^^^^
|
^^^^^^^^^^^
|
||||||
|
|
|
||||||
5
ui-tests/imports/wasip1.nil
Normal file
5
ui-tests/imports/wasip1.nil
Normal 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() = ;
|
||||||
|
|
@ -1,4 +1,17 @@
|
||||||
error: `main` function not found
|
/home/nils/projects/riverdelta/target/ast.js:110
|
||||||
--> $DIR/structs.nil:1
|
throw new Error(`substitution out of range, param index ${ty.idx} of param ${ty.name} out of range for length ${genericArgs.length}`);
|
||||||
1 | type A[T] = struct { a: T };
|
^
|
||||||
^
|
|
||||||
|
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
|
||||||
|
|
|
||||||
|
|
@ -1,36 +1,17 @@
|
||||||
error: expected 1 generic arguments, found 0
|
/home/nils/projects/riverdelta/target/ast.js:110
|
||||||
--> $DIR/wrong_amount.nil:9
|
throw new Error(`substitution out of range, param index ${ty.idx} of param ${ty.name} out of range for length ${genericArgs.length}`);
|
||||||
9 | a1: A,
|
^
|
||||||
^
|
|
||||||
error: expected 1 generic arguments, found 0
|
Error: substitution out of range, param index 0 of param T out of range for length 0
|
||||||
--> $DIR/wrong_amount.nil:10
|
at substituteTy (/home/nils/projects/riverdelta/target/ast.js:110:23)
|
||||||
10 | a2: A[],
|
at subst (/home/nils/projects/riverdelta/target/ast.js:106:27)
|
||||||
^
|
at Array.map (<anonymous>)
|
||||||
error: expected 1 generic arguments, found 2
|
at substituteTy (/home/nils/projects/riverdelta/target/ast.js:125:45)
|
||||||
--> $DIR/wrong_amount.nil:12
|
at typeOfItem (/home/nils/projects/riverdelta/target/typeck/item.js:193:33)
|
||||||
12 | a4: A[I32, I32],
|
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)
|
||||||
error: expected 3 generic arguments, found 0
|
at /home/nils/projects/riverdelta/target/ast.js:164:55
|
||||||
--> $DIR/wrong_amount.nil:14
|
at Array.map (<anonymous>)
|
||||||
14 | b1: B,
|
at foldAst (/home/nils/projects/riverdelta/target/ast.js:164:34)
|
||||||
^
|
|
||||||
error: expected 3 generic arguments, found 0
|
Node.js v18.18.2
|
||||||
--> $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 };
|
|
||||||
^
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue