You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling a function with incorrect arguments the diagnostics we surface to users could be improved. The diagnostics we surface seem to come from different layers in the interpreter (lowest layers reported first), and sometimes the lower layers report rather obscure errors.
functionf(x: count) {}
I seem to see the "best" diagnostics when passing an integer instead of a count,
f(-1);
error in count and ./foo.zeek, line 4: over-promotion of arithmetic value (count and -1)
error in ./foo.zeek, line 4 and count: type mismatch (-1 and count)
error in ./foo.zeek, line 4: argument type mismatch in function call (f(-1))
The diagnostics get more obscure if I pass a string (note how the error message never mentions string),
f("abc");
error in count and ./foo.zeek, line 4: arithmetic mixed with non-arithmetic (count and abc)
error in ./foo.zeek, line 4 and count: type mismatch (abc and count)
error in ./foo.zeek, line 4: argument type mismatch in function call (f(abc))
If argument counts don't align the diagnostics are completely weird and unlikely to be useful to users,
f(1, 2);
error in ./foo.zeek, line 4: indexing mismatch (list of count and 1, 2)
error in ./foo.zeek, line 4: argument type mismatch in function call (f(1, 2))
Ideally we would show diagnostics which give users a clear action, e.g., when argument types do not match
type mismatch: expected type 'count' for argument 0 but found 'string'
or if the number of arguments does not match
function 'f` takes 1 argument but 2 arguments were supplied
The text was updated successfully, but these errors were encountered:
When calling a function with incorrect arguments the diagnostics we surface to users could be improved. The diagnostics we surface seem to come from different layers in the interpreter (lowest layers reported first), and sometimes the lower layers report rather obscure errors.
I seem to see the "best" diagnostics when passing an
integer
instead of acount
,The diagnostics get more obscure if I pass a
string
(note how the error message never mentionsstring
),If argument counts don't align the diagnostics are completely weird and unlikely to be useful to users,
Ideally we would show diagnostics which give users a clear action, e.g., when argument types do not match
or if the number of arguments does not match
The text was updated successfully, but these errors were encountered: