Browse Source

Fix race condition with procedure aliases checking for declarations on constant aliases

gingerBill 4 years ago
parent
commit
a38586420c
2 changed files with 3 additions and 2 deletions
  1. 2 2
      src/check_decl.cpp
  2. 1 0
      src/checker.cpp

+ 2 - 2
src/check_decl.cpp

@@ -460,14 +460,14 @@ void check_const_decl(CheckerContext *ctx, Entity *e, Ast *type_expr, Ast *init,
 			case Entity_LibraryName:
 			case Entity_ImportName:
 				{
-					override_entity_in_scope(e, entity);
-
 					DeclInfo *decl = decl_info_of_entity(e);
 					if (decl != nullptr) {
 						if (decl->attributes.count > 0) {
 							error(decl->attributes[0], "Constant alias declarations cannot have attributes");
 						}
 					}
+
+					override_entity_in_scope(e, entity);
 					return;
 				}
 			}

+ 1 - 0
src/checker.cpp

@@ -3260,6 +3260,7 @@ void check_collect_value_decl(CheckerContext *c, Ast *decl) {
 			d->type_expr = vd->type;
 			d->init_expr = init;
 
+
 			if (is_ast_type(init)) {
 				e = alloc_entity_type_name(d->scope, token, nullptr);
 				// if (vd->type != nullptr) {