aboutsummaryrefslogtreecommitdiff
path: root/src/compile/headers.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-09-21 15:14:37 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-09-21 15:14:37 -0400
commitf5612e38183dc20d18f207f8ab055574a4d93ad0 (patch)
treec2caf5a0311b6d9fd0fbd4c08493dac5981088be /src/compile/headers.c
parent7f6683269ce689a83b9c6e1fae15e0cc60351095 (diff)
Bugfixes for anonymous enums, code cleanup to remove type_to_string(),
and changed it so anonymous enums show up in doctests with their full type instead of `enum$20`
Diffstat (limited to 'src/compile/headers.c')
-rw-r--r--src/compile/headers.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/compile/headers.c b/src/compile/headers.c
index 77040445..f6313cd6 100644
--- a/src/compile/headers.c
+++ b/src/compile/headers.c
@@ -79,7 +79,7 @@ Text_t compile_statement_namespace_header(env_t *env, Path_t header_path, ast_t
if (t->tag == FunctionType) t = Type(ClosureType, t);
assert(t->tag != ModuleType);
if (t->tag == AbortType || t->tag == VoidType || t->tag == ReturnType)
- code_err(ast, "You can't declare a variable with a ", type_to_str(t), " value");
+ code_err(ast, "You can't declare a variable with a ", type_to_text(t), " value");
return Texts(decl->value ? compile_statement_type_header(env, header_path, decl->value) : EMPTY_TEXT, "extern ",
compile_declaration(t, namespace_name(env, env->namespace, Text$from_str(decl_name))), ";\n");
@@ -151,6 +151,8 @@ static void add_type_headers(type_ast_t *type_ast, void *userdata) {
if (type_ast->tag == EnumTypeAST) {
compile_typedef_info_t *info = (compile_typedef_info_t *)userdata;
+ // Force the type to get defined:
+ (void)parse_type_ast(info->env, type_ast);
DeclareMatch(enum_, type_ast, EnumTypeAST);
bool has_any_tags_with_fields = false;
for (tag_ast_t *tag = enum_->tags; tag; tag = tag->next) {