aboutsummaryrefslogtreecommitdiff
path: root/src/check_decl.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-05-22 12:53:29 +0100
committergingerBill <bill@gingerbill.org>2023-05-22 12:53:29 +0100
commit8bf32ac697ea21ff3b37e5b31fe0fc10e700c9a4 (patch)
tree77e96ea43b5faf78d81ca1d8158db59fe3e24add /src/check_decl.cpp
parent540f724b1f57d0d5a40b65a59f6ee82e070c6ee5 (diff)
Minor change to handling of propagation of errors with `---` as a value
Diffstat (limited to 'src/check_decl.cpp')
-rw-r--r--src/check_decl.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/check_decl.cpp b/src/check_decl.cpp
index b16215571..84b0d39d8 100644
--- a/src/check_decl.cpp
+++ b/src/check_decl.cpp
@@ -70,13 +70,12 @@ gb_internal Type *check_init_variable(CheckerContext *ctx, Entity *e, Operand *o
// NOTE(bill): Use the type of the operand
Type *t = operand->type;
if (is_type_untyped(t)) {
- if (t == t_invalid || is_type_untyped_nil(t)) {
- error(e->token, "Invalid use of untyped nil in %.*s", LIT(context_name));
+ if (is_type_untyped_uninit(t)) {
+ error(e->token, "Invalid use of --- in %.*s", LIT(context_name));
e->type = t_invalid;
return nullptr;
- }
- if (t == t_invalid || is_type_untyped_undef(t)) {
- error(e->token, "Invalid use of --- in %.*s", LIT(context_name));
+ } else if (t == t_invalid || is_type_untyped_nil(t)) {
+ error(e->token, "Invalid use of untyped nil in %.*s", LIT(context_name));
e->type = t_invalid;
return nullptr;
}