From 9da05dd4cbab364d1fc8260abdc0c980497389b8 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Wed, 28 Feb 2018 11:44:41 +0000 Subject: Update core library with `cstring` --- src/check_expr.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/check_expr.cpp') 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); -- cgit v1.2.3