diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-02-20 13:06:03 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-02-20 13:06:03 -0500 |
| commit | f9cc44f145dd0c165010765791054666f973eff3 (patch) | |
| tree | 5a5664797f9bee63a1c3287b3d05d4c20880df97 /typecheck.c | |
| parent | d2aeee16e6ad84bfb2d77221e424d1441a2ceea2 (diff) | |
Fixing up enums
Diffstat (limited to 'typecheck.c')
| -rw-r--r-- | typecheck.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/typecheck.c b/typecheck.c index 6f86f891..ee4d024e 100644 --- a/typecheck.c +++ b/typecheck.c @@ -287,7 +287,7 @@ type_t *get_type(env_t *env, ast_t *ast) type_t *fielded_t = get_type(env, access->fielded); type_t *field_t = get_field_type(fielded_t, access->field); if (!field_t) - code_err(ast, "I can't find anything called %s on the type %T", access->field, fielded_t); + code_err(ast, "%T objects don't have a field called '%s'", fielded_t, access->field); return field_t; } case Index: { @@ -329,6 +329,10 @@ type_t *get_type(env_t *env, ast_t *ast) if (call->extern_return_type) return parse_type_ast(env, call->extern_return_type); type_t *fn_type_t = get_type(env, call->fn); + if (!fn_type_t) + code_err(call->fn, "I couldn't find this function"); + if (fn_type_t->tag != FunctionType) + code_err(call->fn, "This isn't a function, it's a %T", fn_type_t); auto fn_type = Match(fn_type_t, FunctionType); return fn_type->ret; } |
