aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2019-12-27 17:53:05 +0000
committergingerBill <bill@gingerbill.org>2019-12-27 17:53:05 +0000
commit7f9626e5c7508c98f8be7f6f76387704bfedd93b (patch)
tree84cbcdec33995d00e780716145d61cc7974c7b33 /src/check_expr.cpp
parent7140c95c55e59a79039b30bfee6a3204ed62a02b (diff)
Improve 'cannot slice' error message
Diffstat (limited to 'src/check_expr.cpp')
-rw-r--r--src/check_expr.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index 8bb771af1..8ba504ed3 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -8748,7 +8748,9 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type
if (!valid) {
gbString str = expr_to_string(o->expr);
- error(o->expr, "Cannot slice '%s'", str);
+ gbString type_str = type_to_string(o->type);
+ error(o->expr, "Cannot slice '%s' of type '%s'", str, type_str);
+ gb_string_free(type_str);
gb_string_free(str);
o->mode = Addressing_Invalid;
o->expr = node;