diff options
| author | gingerBill <bill@gingerbill.org> | 2018-02-28 11:44:41 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2018-02-28 11:44:41 +0000 |
| commit | 9da05dd4cbab364d1fc8260abdc0c980497389b8 (patch) | |
| tree | b14d168b861036807610c3f9143cc5a31c7fc1a0 /src/check_expr.cpp | |
| parent | ae9da0abfb7f88d78544c3308fd7d4eb12cb8bf1 (diff) | |
Update core library with `cstring`
Diffstat (limited to 'src/check_expr.cpp')
| -rw-r--r-- | src/check_expr.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 7ad75ac48..7d4c759d9 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -1497,9 +1497,9 @@ void check_comparison(Checker *c, Operand *x, Operand *y, TokenKind op) { err_type = y->type; } gbString type_string = type_to_string(err_type); + defer (gb_string_free(type_string)); err_str = gb_string_make(c->tmp_allocator, gb_bprintf("operator '%.*s' not defined for type '%s'", LIT(token_strings[op]), type_string)); - gb_string_free(type_string); } } else { gbString xt, yt; @@ -2279,6 +2279,8 @@ void convert_to_typed(Checker *c, Operand *operand, Type *target_type) { case Basic_UntypedNil: if (is_type_any(target_type)) { target_type = t_untyped_nil; + } else if (is_type_cstring(target_type)) { + target_type = t_untyped_nil; } else if (!type_has_nil(target_type)) { operand->mode = Addressing_Invalid; convert_untyped_error(c, operand, target_type); |