harec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 90c852910de354f8ab814c26dde313bff5140e6a
parent d8fb82a155425dd41f129af6d570b262ac4df763
Author: Nixon Enraght-Moony <nixon.emoony@gmail.com>
Date:   Fri, 29 Apr 2022 23:44:46 +0100

Improve error for invalid `len` call.

On code
    fn huh(x: bool) size = len(x);
Old:
    Error d.ha:1:29: len argument must be of an array, slice, or str type
New:
    Error d.ha:1:29: len argument must be of an array, slice, or str type, but got bool

Signed-off-by: Nixon Enraght-Moony <nixon.emoony@gmail.com>

Diffstat:
Msrc/check.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/check.c b/src/check.c @@ -1905,7 +1905,8 @@ check_expr_measure(struct context *ctx, || vstor == STORAGE_STRING; if (!valid) { error(ctx, aexpr->measure.value->loc, expr, - "len argument must be of an array, slice, or str type"); + "len argument must be of an array, slice, or str type, but got %s", + gen_typename(atype)); return; } if (atype->size == SIZE_UNDEFINED) {