aboutsummaryrefslogtreecommitdiff
path: root/src/compile/whens.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/whens.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/whens.c')
-rw-r--r--src/compile/whens.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/compile/whens.c b/src/compile/whens.c
index d9bef9e1..4f6a2a40 100644
--- a/src/compile/whens.c
+++ b/src/compile/whens.c
@@ -61,7 +61,7 @@ Text_t compile_when_statement(env_t *env, ast_t *ast) {
}
if (clause->pattern->tag != FunctionCall || Match(clause->pattern, FunctionCall)->fn->tag != Var)
- code_err(clause->pattern, "This is not a valid pattern for a ", type_to_str(subject_t), " enum type");
+ code_err(clause->pattern, "This is not a valid pattern for a ", type_to_text(subject_t), " enum type");
const char *clause_tag_name = Match(Match(clause->pattern, FunctionCall)->fn, Var)->name;
code = Texts(code, "case ", namespace_name(enum_t->env, enum_t->env->namespace, Texts("tag$", clause_tag_name)),
@@ -93,9 +93,9 @@ Text_t compile_when_statement(env_t *env, ast_t *ast) {
arg_t *field = tag_struct->fields;
for (arg_ast_t *arg = args; arg || field; arg = arg->next) {
if (!arg)
- code_err(ast, "The field ", type_to_str(subject_t), ".", clause_tag_name, ".", field->name,
+ code_err(ast, "The field ", type_to_text(subject_t), ".", clause_tag_name, ".", field->name,
" wasn't accounted for");
- if (!field) code_err(arg->value, "This is one more field than ", type_to_str(subject_t), " has");
+ if (!field) code_err(arg->value, "This is one more field than ", type_to_text(subject_t), " has");
if (arg->name) code_err(arg->value, "Named arguments are not currently supported");
const char *var_name = Match(arg->value, Var)->name;