diff options
| author | gingerBill <bill@gingerbill.org> | 2021-05-31 21:03:50 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-05-31 21:03:50 +0100 |
| commit | d90adb7a8eb388ef8552bf963b344e9123830461 (patch) | |
| tree | ca641c5183a26c9d91147e09b27c4dcd7877dd99 /src | |
| parent | 2573da12fc3e299be3f983474347628ddd3076dc (diff) | |
Fix #998
Diffstat (limited to 'src')
| -rw-r--r-- | src/check_expr.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 2d77fe40a..e31343e29 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -7970,6 +7970,16 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type ExprKind check_expr_base(CheckerContext *c, Operand *o, Ast *node, Type *type_hint) { ExprKind kind = check_expr_base_internal(c, o, node, type_hint); + if (o->type != nullptr && core_type(o->type) == nullptr) { + o->type = t_invalid; + gbString xs = expr_to_string(o->expr); + if (o->mode == Addressing_Type) { + error(o->expr, "Invalid type usage '%s'", xs); + } else { + error(o->expr, "Invalid expression '%s'", xs); + } + gb_string_free(xs); + } if (o->type != nullptr && is_type_untyped(o->type)) { add_untyped(&c->checker->info, node, false, o->mode, o->type, o->value); } |