aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-08-23 18:59:00 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-08-23 18:59:00 -0400
commit414b0c7472c87c5a013029aefef49e2dbc41e700 (patch)
tree59d462ac24463e6ad9451fd126c1019110080a2a
parent3eca6cc27d295414e355d5ba08412f8eb385f7e2 (diff)
Better error message
-rw-r--r--src/compile.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/compile.c b/src/compile.c
index 8d5fe9b6..a747b870 100644
--- a/src/compile.c
+++ b/src/compile.c
@@ -3542,7 +3542,8 @@ Text_t compile(env_t *env, ast_t *ast)
if (env->current_type == NULL || !type_eq(env->current_type, t)) {
for (arg_t *field = struct_->fields; field; field = field->next) {
if (field->name[0] == '_')
- code_err(ast, "This struct can't be initialized directly because it has private fields (starting with underscore)");
+ code_err(ast, "This struct can't be initialized directly because it has private fields (starting with underscore).\n"
+ "Use a `convert` or `func` to instantiate the type instead.");
}
}
return Texts("((", compile_type(t), "){",