harec

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

commit 99d77e15fc16eaa2eb0781893034d5aefa8b7241
parent 90c852910de354f8ab814c26dde313bff5140e6a
Author: Nixon Enraght-Moony <nixon.emoony@gmail.com>
Date:   Fri, 29 Apr 2022 23:50:53 +0100

Improve error for invalid assignment.

On code
    fn huh() void = {
        let i = 0;
        let s = "";
        i = s;
    };
Old:
    Error d.ha:4:10: rvalue type is not assignable to lvalue
New:
    Error d.ha:4:10: rvalue type is not assignable to lvalue

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 @@ -665,7 +665,8 @@ check_expr_assign(struct context *ctx, } if (!type_is_assignable(object->result, value->result)) { error(ctx, aexpr->loc, expr, - "rvalue type is not assignable to lvalue"); + "rvalue type (%s) is not assignable to lvalue (%s)", + gen_typename(value->result), gen_typename(object->result)); return; } value = lower_implicit_cast(object->result, value);