-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Currently, balloon naively treats all functions' types as equal. However, when checking function calls, since it traces the actual call, it points out incorrect number of arguments (which must match exactly, unlike JS or PHP).
So, in
fn call(g, x) {
g(x);
}
call(fn () {}, 1);
you get
in test.bl, line 5, col 1:
issue in function call:
5 | call(fn () {}, 1);
^^^^^^^^^^^^^^^^^
in function in test.bl, line 2, col 5:
arguments mismatch: function `g` called with incorrect number of arguments
2 | g(x);
^^^^
We need to figure out if accepting less or more arguments is part of subtyping. This could matter in cases like callbacks.
After this, we should make function types account for arity as well as return types.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels