From c642e326cecd3dc33ca5a9efb6330e757c378dd9 Mon Sep 17 00:00:00 2001 From: Ginger Bill Date: Mon, 26 Jun 2017 11:57:26 +0100 Subject: Undef value `---` (for setting a value to be uninitialized/undefined) --- src/check_decl.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/check_decl.cpp') 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; } -- cgit v1.2.3