Browse Source

Disallow attributes on alias declarations

gingerBill 6 years ago
parent
commit
716373836c
1 changed files with 12 additions and 2 deletions
  1. 12 2
      src/check_decl.cpp

+ 12 - 2
src/check_decl.cpp

@@ -391,8 +391,18 @@ void check_const_decl(CheckerContext *ctx, Entity *e, Ast *type_expr, Ast *init,
 			case Entity_Procedure:
 			case Entity_LibraryName:
 			case Entity_ImportName:
-				override_entity_in_scope(e, entity);
-				return;
+				{
+					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");
+						}
+					}
+
+					return;
+				}
 			}
 		}
 	}