Browse Source

Merge pull request #5411 from laytan/fix-load-type-panic

fix load type panic because front-end allows a deref of a type
Laytan 1 tháng trước cách đây
mục cha
commit
5822b00c39
1 tập tin đã thay đổi với 7 bổ sung0 xóa
  1. 7 0
      src/check_expr.cpp

+ 7 - 0
src/check_expr.cpp

@@ -11323,6 +11323,13 @@ gb_internal ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast
 		node->viral_state_flags |= de->expr->viral_state_flags;
 
 		if (o->mode == Addressing_Invalid) {
+			o->mode = Addressing_Invalid;
+			o->expr = node;
+			return kind;
+		} else if (o->mode == Addressing_Type) {
+ 			gbString str = expr_to_string(o->expr);
+			error(o->expr, "Cannot dereference '%s' because it is a type", str);
+
 			o->mode = Addressing_Invalid;
 			o->expr = node;
 			return kind;