mirror of
https://github.com/Noratrieb/riverdelta.git
synced 2026-01-14 16:35:03 +01:00
fix some bugs
This commit is contained in:
parent
01d4238269
commit
537c924a68
7 changed files with 47 additions and 11 deletions
|
|
@ -1328,6 +1328,7 @@ function checkCall(
|
|||
expr.span,
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
fcx.infcx.assign(param, args[i].ty, args[i].span);
|
||||
|
|
|
|||
21
std/list.nil
Normal file
21
std/list.nil
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
type List[T] = struct {
|
||||
ptr: Int,
|
||||
len: Int,
|
||||
cap: Int,
|
||||
};
|
||||
|
||||
function new(): List[Int] = (
|
||||
List { ptr: 0, len: 0, cap: 0 }
|
||||
);
|
||||
|
||||
function push(list: List[Int], elem: Int) = (
|
||||
growIfNeeded(list, 1);
|
||||
);
|
||||
|
||||
// PRIVATE:
|
||||
|
||||
function growIfNeeded(list: List[Int], elems: Int) = (
|
||||
if (list.len + elems) < list.cap then (
|
||||
let newMemory = std.rt.alloc.allocateItem(0_I32, 0_I32);
|
||||
);
|
||||
);
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
mod rt;
|
||||
mod list;
|
||||
|
||||
function printlnI32(x: I32) = (
|
||||
printI32(x);
|
||||
|
|
|
|||
15
test.nil
15
test.nil
|
|
@ -1,11 +1,4 @@
|
|||
//@check-pass
|
||||
type A[T] = struct { a: T };
|
||||
type B[T, U, V] = struct {
|
||||
b: T,
|
||||
d: V,
|
||||
};
|
||||
type C = ();
|
||||
|
||||
function main() = ;
|
||||
|
||||
function test(a: A[I32], b: B[I32, Int, I32], c: C) = ;
|
||||
function main() = (
|
||||
let list = std.list.new();
|
||||
std.list.push(list, 0);
|
||||
);
|
||||
5
ui-tests/functions/missing_args.nil
Normal file
5
ui-tests/functions/missing_args.nil
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
function main() = (
|
||||
x();
|
||||
);
|
||||
|
||||
function x(a: Int) = ;
|
||||
4
ui-tests/functions/missing_args.stderr
Normal file
4
ui-tests/functions/missing_args.stderr
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
error: missing argument of type Int
|
||||
--> $DIR/missing_args.nil:2
|
||||
2 | x();
|
||||
^
|
||||
11
ui-tests/type/generics/codegen.nil
Normal file
11
ui-tests/type/generics/codegen.nil
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
//@check-pass
|
||||
type A[T] = struct { a: T };
|
||||
type B[T, U, V] = struct {
|
||||
b: T,
|
||||
d: V,
|
||||
};
|
||||
type C = ();
|
||||
|
||||
function main() = ;
|
||||
|
||||
function test(a: A[I32], b: B[I32, Int, I32], c: C) = ;
|
||||
Loading…
Add table
Add a link
Reference in a new issue