aboutsummaryrefslogtreecommitdiff
path: root/src/check_decl.cpp
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-06-26 11:57:26 +0100
committerGinger Bill <bill@gingerbill.org>2017-06-26 11:57:26 +0100
commitc642e326cecd3dc33ca5a9efb6330e757c378dd9 (patch)
treec8bd1554fa2fc9e9d31012d4e98261755a7ced3a /src/check_decl.cpp
parent362a11878283eea69cf5a18b7f05c964643a7a64 (diff)
Undef value `---` (for setting a value to be uninitialized/undefined)
Diffstat (limited to 'src/check_decl.cpp')
-rw-r--r--src/check_decl.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/check_decl.cpp b/src/check_decl.cpp
index 602e09a0a..d3f82b1d3 100644
--- a/src/check_decl.cpp
+++ b/src/check_decl.cpp
@@ -34,7 +34,12 @@ Type *check_init_variable(Checker *c, Entity *e, Operand *operand, String contex
Type *t = operand->type;
if (is_type_untyped(t)) {
if (t == t_invalid || is_type_untyped_nil(t)) {
- error(e->token, "Use of untyped nil in %.*s", LIT(context_name));
+ error(e->token, "Invalid use of untyped nil in %.*s", LIT(context_name));
+ e->type = t_invalid;
+ return NULL;
+ }
+ if (t == t_invalid || is_type_untyped_undef(t)) {
+ error(e->token, "Invalid use of --- in %.*s", LIT(context_name));
e->type = t_invalid;
return NULL;
}