diff options
| author | Karl Zylinski <karl@zylinski.se> | 2024-07-03 22:21:32 +0200 |
|---|---|---|
| committer | Karl Zylinski <karl@zylinski.se> | 2024-07-03 22:21:32 +0200 |
| commit | 782286357b2bc6a2f789b18744921b5b5b7b65c4 (patch) | |
| tree | 7272eabc91a6ddd68f36c4f1877fb78f57351d55 /src/check_builtin.cpp | |
| parent | a276722da52e10570da20096c8a50ee3886ec93b (diff) | |
error on type_of(value of untyped type)
Diffstat (limited to 'src/check_builtin.cpp')
| -rw-r--r-- | src/check_builtin.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/check_builtin.cpp b/src/check_builtin.cpp index 7a1a8b9ee..5a8d9b782 100644 --- a/src/check_builtin.cpp +++ b/src/check_builtin.cpp @@ -2290,6 +2290,14 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As error(o.expr, "Invalid argument to 'type_of'"); return false; } + + if (is_type_untyped(o.type)) { + gbString t = type_to_string(o.type); + error(o.expr, "'type_of' of %s cannot be determined", t); + gb_string_free(t); + return false; + } + // NOTE(bill): Prevent type cycles for procedure declarations if (c->curr_proc_sig == o.type) { gbString s = expr_to_string(o.expr); |