diff options
Diffstat (limited to 'typecheck.c')
| -rw-r--r-- | typecheck.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/typecheck.c b/typecheck.c index eb1f2427..ce3c9d08 100644 --- a/typecheck.c +++ b/typecheck.c @@ -146,8 +146,10 @@ void bind_statement(env_t *env, ast_t *statement) for (tag_t *tag = tags; tag; tag = tag->next) { const char *name = heap_strf("%s__%s", def->name, tag->name); type_t *constructor_t = Type(FunctionType, .args=Match(tag->type, StructType)->fields, .ret=type); - set_binding(env, name, new(binding_t, .type=constructor_t)); + Table_str_set(env->globals, name, new(binding_t, .type=constructor_t)); + Table_str_set(env->types, heap_strf("%s$%s", def->name, tag->name), tag->type); } + Table_str_set(env->types, def->name, type); break; } default: break; |
