From 414b0c7472c87c5a013029aefef49e2dbc41e700 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 23 Aug 2025 18:59:00 -0400 Subject: Better error message --- src/compile.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') 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), "){", -- cgit v1.2.3