From 5534f78749d29f2a65e48314da02cc0718d677f6 Mon Sep 17 00:00:00 2001 From: vbot Date: Tue, 17 May 2022 10:38:10 +0000 Subject: [PATCH] [v:master] 9a0f49950 - ci: Added PKGBUILD & workflow for deploying Arch packages --- v.c | 186 +++++++++++++++++++++++++++++++++----------------------- v_win.c | 186 +++++++++++++++++++++++++++++++++----------------------- 2 files changed, 220 insertions(+), 152 deletions(-) diff --git a/v.c b/v.c index 38329e6..2a39926 100644 --- a/v.c +++ b/v.c @@ -1,11 +1,11 @@ -#define V_COMMIT_HASH "12ec3b9d5" +#define V_COMMIT_HASH "9a0f49950" #ifndef V_COMMIT_HASH - #define V_COMMIT_HASH "b10cf3e0f" + #define V_COMMIT_HASH "12ec3b9d5" #endif #ifndef V_CURRENT_COMMIT_HASH - #define V_CURRENT_COMMIT_HASH "12ec3b9" + #define V_CURRENT_COMMIT_HASH "9a0f499" #endif // V comptime_definitions: @@ -38182,7 +38182,7 @@ void v__pref__Preferences_fill_with_defaults(v__pref__Preferences* p) { } #endif } - string vhash = _SLIT("b10cf3e0f"); + string vhash = _SLIT("12ec3b9d5"); p->cache_manager = v__vcache__new_cache_manager(new_array_from_c_array(7, 7, sizeof(string), _MOV((string[7]){string_clone(vhash), str_intp(6, _MOV((StrIntpData[]){{_SLIT0, /*115 &v.pref.Backend*/0xfe10, {.d_s = v__pref__Backend_str(p->backend)}}, {_SLIT(" | "), /*115 &v.pref.OS*/0xfe10, {.d_s = v__pref__OS_str(p->os)}}, {_SLIT(" | "), /*115 &string*/0xfe10, {.d_s = p->ccompiler}}, {_SLIT(" | "), /*115 &bool*/0xfe10, {.d_s = p->is_prod ? _SLIT("true") : _SLIT("false")}}, {_SLIT(" | "), /*115 &bool*/0xfe10, {.d_s = p->sanitize ? _SLIT("true") : _SLIT("false")}}, {_SLIT0, 0, { .d_c = 0 }}})), string_clone(string_trim_space(p->cflags)), string_clone(string_trim_space(p->third_party_option)), string_clone(Array_string_str(p->compile_defines_all)), string_clone(Array_string_str(p->compile_defines)), string_clone(Array_string_str(p->lookup_path))}))); if (string__eq(os__user_os(), _SLIT("windows"))) { p->use_cache = false; @@ -40904,7 +40904,7 @@ string v__util__formatted_error(string kind, string omsg, string filepath, v__to path = string_replace_once(path, _const_v__util__normalised_workdir, _SLIT("")); } } - string position = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = path}}, {_SLIT(":"), /*100 &int*/0xfe07, {.d_i32 = pos.line_nr + 1}}, {_SLIT(":"), /*100 &int*/0xfe07, {.d_i32 = v__mathutil__max_T_int(1, pos.col + 1)}}, {_SLIT(":"), 0, { .d_c = 0 }}})); + string position = (filepath.len > 0 ? ( str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = path}}, {_SLIT(":"), /*100 &int*/0xfe07, {.d_i32 = pos.line_nr + 1}}, {_SLIT(":"), /*100 &int*/0xfe07, {.d_i32 = v__mathutil__max_T_int(1, pos.col + 1)}}, {_SLIT(":"), 0, { .d_c = 0 }}}))) : (_SLIT(""))); string scontext = Array_string_join(v__util__source_file_context(kind, filepath, pos), _SLIT("\n")); string final_position = v__util__bold(position); string final_kind = v__util__bold(v__util__color(kind, kind)); @@ -50702,117 +50702,128 @@ bool v__checker__Checker_check_types(v__checker__Checker* c, v__ast__Type got, v } v__ast__TypeSymbol* got_sym = v__ast__Table_sym(c->table, got); v__ast__TypeSymbol* expected_sym = v__ast__Table_sym(c->table, expected); - if (got_sym->kind == v__ast__Kind__enum_) { - if (v__ast__TypeSymbol_is_number(expected_sym)) { + if (got_sym->kind == v__ast__Kind__array && expected_sym->kind == v__ast__Kind__array) { + if (v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__Array*)__as_cast((got_sym->info)._v__ast__Array,(got_sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ).elem_type) && v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__Array*)__as_cast((expected_sym->info)._v__ast__Array,(expected_sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ).elem_type)) { bool _t8 = true; return _t8; } - } else if (got_sym->kind == v__ast__Kind__array_fixed) { - if (v__ast__TypeSymbol_is_number(expected_sym) || v__ast__Type_is_any_kind_of_pointer(expected)) { + } else if (got_sym->kind == v__ast__Kind__array_fixed && expected_sym->kind == v__ast__Kind__array_fixed) { + if (v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((got_sym->info)._v__ast__ArrayFixed,(got_sym->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ).elem_type) && v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ).elem_type)) { bool _t9 = true; return _t9; } - } else if (expected_sym->kind == v__ast__Kind__array_fixed) { - if (v__ast__TypeSymbol_is_number(got_sym) && v__ast__Type_is_any_kind_of_pointer(got)) { + } + if (got_sym->kind == v__ast__Kind__enum_) { + if (v__ast__TypeSymbol_is_number(expected_sym)) { bool _t10 = true; return _t10; + } + } else if (got_sym->kind == v__ast__Kind__array_fixed) { + if (v__ast__TypeSymbol_is_number(expected_sym) || v__ast__Type_is_any_kind_of_pointer(expected)) { + bool _t11 = true; + return _t11; + } + } else if (expected_sym->kind == v__ast__Kind__array_fixed) { + if (v__ast__TypeSymbol_is_number(got_sym) && v__ast__Type_is_any_kind_of_pointer(got)) { + bool _t12 = true; + return _t12; } else if (got_sym->kind == v__ast__Kind__array) { v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ; v__ast__Array info2 = /* as */ *(v__ast__Array*)__as_cast((got_sym->info)._v__ast__Array,(got_sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; if (v__checker__Checker_check_types(c, info.elem_type, info2.elem_type)) { - bool _t11 = true; - return _t11; + bool _t13 = true; + return _t13; } } } else if (got_sym->kind == v__ast__Kind__array) { if (v__ast__TypeSymbol_is_number(expected_sym) || v__ast__Type_is_any_kind_of_pointer(expected)) { - bool _t12 = true; - return _t12; + bool _t14 = true; + return _t14; } } else if (expected_sym->kind == v__ast__Kind__array) { if (v__ast__TypeSymbol_is_number(got_sym) && v__ast__Type_is_any_kind_of_pointer(got)) { - bool _t13 = true; - return _t13; + bool _t15 = true; + return _t15; } } if (expected_sym->kind == v__ast__Kind__enum_ && v__ast__TypeSymbol_is_number(got_sym)) { - bool _t14 = true; - return _t14; + bool _t16 = true; + return _t16; } if (got_is_ptr && exp_is_ptr) { if (v__ast__TypeSymbol_is_number(expected_sym) && v__ast__TypeSymbol_is_number(got_sym)) { - bool _t15 = true; - return _t15; + bool _t17 = true; + return _t17; } } } if (got_is_ptr && exp_is_ptr) { if (v__ast__Type_nr_muls(got) != v__ast__Type_nr_muls(expected)) { - bool _t16 = false; - return _t16; + bool _t18 = false; + return _t18; } } int exp_idx = v__ast__Type_idx(expected); int got_idx = v__ast__Type_idx(got); if (exp_idx == got_idx) { - bool _t17 = true; - return _t17; + bool _t19 = true; + return _t19; } if (exp_idx == _const_v__ast__voidptr_type_idx || exp_idx == _const_v__ast__byteptr_type_idx || (v__ast__Type_is_ptr(expected) && v__ast__Type_idx(v__ast__Type_deref(expected)) == _const_v__ast__byte_type_idx)) { if (v__ast__Type_is_ptr(got) || v__ast__Type_is_pointer(got)) { - bool _t18 = true; - return _t18; - } - } - if (v__ast__Type_is_real_pointer(expected)) { - if (v__ast__Type_alias_eq(got, _const_v__ast__int_literal_type)) { - bool _t19 = true; - return _t19; - } - } - if (got_idx == _const_v__ast__voidptr_type_idx || got_idx == _const_v__ast__byteptr_type_idx || (got_idx == _const_v__ast__byte_type_idx && v__ast__Type_is_ptr(got))) { - if (v__ast__Type_is_ptr(expected) || v__ast__Type_is_pointer(expected)) { bool _t20 = true; return _t20; } } + if (v__ast__Type_is_real_pointer(expected)) { + if (v__ast__Type_alias_eq(got, _const_v__ast__int_literal_type)) { + bool _t21 = true; + return _t21; + } + } + if (got_idx == _const_v__ast__voidptr_type_idx || got_idx == _const_v__ast__byteptr_type_idx || (got_idx == _const_v__ast__byte_type_idx && v__ast__Type_is_ptr(got))) { + if (v__ast__Type_is_ptr(expected) || v__ast__Type_is_pointer(expected)) { + bool _t22 = true; + return _t22; + } + } if (v__ast__Type_alias_eq(expected, _const_v__ast__charptr_type) && v__ast__Type_alias_eq(got, v__ast__Type_ref(_const_v__ast__char_type))) { - bool _t21 = true; - return _t21; + bool _t23 = true; + return _t23; } if (v__ast__Type_has_flag(expected, v__ast__TypeFlag__optional) || v__ast__Type_has_flag(expected, v__ast__TypeFlag__result)) { v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, got); if (((sym->idx == _const_v__ast__error_type_idx || (v__ast__Type_alias_eq(got, _const_v__ast__none_type) || v__ast__Type_alias_eq(got, _const_v__ast__error_type))) && v__ast__Type_has_flag(expected, v__ast__TypeFlag__optional)) || ((sym->idx == _const_v__ast__error_type_idx || v__ast__Type_alias_eq(got, _const_v__ast__error_type)) && v__ast__Type_has_flag(expected, v__ast__TypeFlag__result))) { - bool _t22 = true; - return _t22; + bool _t24 = true; + return _t24; } else if (!v__checker__Checker_check_basic(c, got, v__ast__Type_clear_flag(v__ast__Type_clear_flag(expected, v__ast__TypeFlag__optional), v__ast__TypeFlag__result))) { - bool _t23 = false; - return _t23; + bool _t25 = false; + return _t25; } } if (!v__checker__Checker_check_basic(c, got, expected)) { - bool _t24 = false; - return _t24; + bool _t26 = false; + return _t26; } if (v__ast__Type_is_number(got) && v__ast__Type_is_number(expected)) { if (v__ast__Type_alias_eq(got, _const_v__ast__rune_type) && v__ast__Type_alias_eq(expected, _const_v__ast__byte_type)) { - bool _t25 = true; - return _t25; + bool _t27 = true; + return _t27; } else if (v__ast__Type_alias_eq(expected, _const_v__ast__rune_type) && v__ast__Type_alias_eq(got, _const_v__ast__byte_type)) { - bool _t26 = true; - return _t26; + bool _t28 = true; + return _t28; } if (!v__ast__Type_alias_eq(v__checker__Checker_promote_num(c, expected, got), expected)) { - bool _t27 = false; - return _t27; + bool _t29 = false; + return _t29; } } if (v__ast__Type_has_flag(expected, v__ast__TypeFlag__generic)) { - bool _t28 = false; - return _t28; + bool _t30 = false; + return _t30; } - bool _t29 = true; - return _t29; + bool _t31 = true; + return _t31; } _option_void v__checker__Checker_check_expected_call_arg(v__checker__Checker* c, v__ast__Type got, v__ast__Type expected_, v__ast__Language language, v__ast__CallArg arg) { @@ -51160,10 +51171,10 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_promote_num(v__checker__Checker v__ast__Type type_hi = left_type; v__ast__Type type_lo = right_type; if (v__ast__Type_idx(type_hi) < v__ast__Type_idx(type_lo)) { - v__ast__Type _var_18083 = type_hi; - v__ast__Type _var_18092 = type_lo; - type_hi = _var_18092; - type_lo = _var_18083; + v__ast__Type _var_18612 = type_hi; + v__ast__Type _var_18621 = type_lo; + type_hi = _var_18621; + type_lo = _var_18612; } int idx_hi = v__ast__Type_idx(type_hi); int idx_lo = v__ast__Type_idx(type_lo); @@ -61801,6 +61812,8 @@ VV_LOCAL_SYMBOL void v__checker__Checker_match_exprs(v__checker__Checker* c, v__ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_sql_expr(v__checker__Checker* c, v__ast__SqlExpr* node) { bool v__checker__Checker_sql_expr_defer_0 = false; +bool v__checker__Checker_sql_expr_defer_1 = false; +v__ast__TypeSymbol old_ts; c->inside_sql = true; v__checker__Checker_sql_expr_defer_0 = true; v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, node->table_expr.typ); @@ -61817,11 +61830,18 @@ bool v__checker__Checker_sql_expr_defer_0 = false; } ; + old_ts = c->cur_orm_ts; c->cur_orm_ts = *sym; + v__checker__Checker_sql_expr_defer_1 = true; if ((sym->info)._typ != 418 /* v.ast.Struct */) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("The table symbol `"), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("` has to be a struct"), 0, { .d_c = 0 }}})), node->table_expr.pos); v__ast__Type _t3 = _const_v__ast__void_type; // Defer begin + if (v__checker__Checker_sql_expr_defer_1) { + c->cur_orm_ts = old_ts; + } + // Defer end + // Defer begin if (v__checker__Checker_sql_expr_defer_0) { c->inside_sql = false; } @@ -61910,6 +61930,11 @@ bool v__checker__Checker_sql_expr_defer_0 = false; v__checker__Checker_expr(c, node->db_expr); v__ast__Type _t8 = node->typ; // Defer begin + if (v__checker__Checker_sql_expr_defer_1) { + c->cur_orm_ts = old_ts; + } + // Defer end + // Defer begin if (v__checker__Checker_sql_expr_defer_0) { c->inside_sql = false; } @@ -61933,6 +61958,8 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_sql_stmt(v__checker__Checker* c VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_sql_stmt_line(v__checker__Checker* c, v__ast__SqlStmtLine* node) { bool v__checker__Checker_sql_stmt_line_defer_0 = false; +bool v__checker__Checker_sql_stmt_line_defer_1 = false; +v__ast__TypeSymbol old_ts; c->inside_sql = true; v__checker__Checker_sql_stmt_line_defer_0 = true; _option_void _t1 = v__checker__Checker_ensure_type_exists(c, node->table_expr.typ, node->pos); @@ -61949,11 +61976,18 @@ bool v__checker__Checker_sql_stmt_line_defer_0 = false; ; v__ast__TypeSymbol* table_sym = v__ast__Table_sym(c->table, node->table_expr.typ); + old_ts = c->cur_orm_ts; c->cur_orm_ts = *table_sym; + v__checker__Checker_sql_stmt_line_defer_1 = true; if ((table_sym->info)._typ != 418 /* v.ast.Struct */) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown type `"), /*115 &string*/0xfe10, {.d_s = table_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); v__ast__Type _t3 = _const_v__ast__void_type; // Defer begin + if (v__checker__Checker_sql_stmt_line_defer_1) { + c->cur_orm_ts = old_ts; + } + // Defer end + // Defer begin if (v__checker__Checker_sql_stmt_line_defer_0) { c->inside_sql = false; } @@ -62022,6 +62056,11 @@ bool v__checker__Checker_sql_stmt_line_defer_0 = false; } v__ast__Type _t11 = _const_v__ast__void_type; // Defer begin + if (v__checker__Checker_sql_stmt_line_defer_1) { + c->cur_orm_ts = old_ts; + } + // Defer end + // Defer begin if (v__checker__Checker_sql_stmt_line_defer_0) { c->inside_sql = false; } @@ -78418,7 +78457,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE if (left_sym->kind == v__ast__Kind__map && (string__eq(node.name, _SLIT("clone")) || string__eq(node.name, _SLIT("move")))) { receiver_type_name = _SLIT("map"); } - if (final_left_sym->kind == v__ast__Kind__array && (string__eq(node.name, _SLIT("repeat")) || string__eq(node.name, _SLIT("sort_with_compare")) || string__eq(node.name, _SLIT("free")) || string__eq(node.name, _SLIT("push_many")) || string__eq(node.name, _SLIT("trim")) || string__eq(node.name, _SLIT("first")) || string__eq(node.name, _SLIT("last")) || string__eq(node.name, _SLIT("pop")) || string__eq(node.name, _SLIT("clone")) || string__eq(node.name, _SLIT("reverse")) || string__eq(node.name, _SLIT("slice")) || string__eq(node.name, _SLIT("pointers")))) { + if (final_left_sym->kind == v__ast__Kind__array && !(left_sym->kind == v__ast__Kind__alias && v__ast__TypeSymbol_has_method(left_sym, node.name)) && (string__eq(node.name, _SLIT("repeat")) || string__eq(node.name, _SLIT("sort_with_compare")) || string__eq(node.name, _SLIT("free")) || string__eq(node.name, _SLIT("push_many")) || string__eq(node.name, _SLIT("trim")) || string__eq(node.name, _SLIT("first")) || string__eq(node.name, _SLIT("last")) || string__eq(node.name, _SLIT("pop")) || string__eq(node.name, _SLIT("clone")) || string__eq(node.name, _SLIT("reverse")) || string__eq(node.name, _SLIT("slice")) || string__eq(node.name, _SLIT("pointers")))) { if (!((left_sym->info)._typ == 433 /* v.ast.Alias */ && v__ast__TypeSymbol_has_method(typ_sym, node.name))) { receiver_type_name = _SLIT("array"); } @@ -78782,11 +78821,11 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_call(v__gen__c__Gen* g, v__ast__CallExpr } if (!print_auto_str) { if (g->pref->is_debug && string__eq(node.name, _SLIT("panic"))) { - multi_return_int_string_string_string mr_39701 = v__gen__c__Gen_panic_debug_info(g, node.pos); - int paline = mr_39701.arg0; - string pafile = mr_39701.arg1; - string pamod = mr_39701.arg2; - string pafn = mr_39701.arg3; + multi_return_int_string_string_string mr_39765 = v__gen__c__Gen_panic_debug_info(g, node.pos); + int paline = mr_39765.arg0; + string pafile = mr_39765.arg1; + string pamod = mr_39765.arg2; + string pafn = mr_39765.arg3; v__gen__c__Gen_write(g, str_intp(5, _MOV((StrIntpData[]){{_SLIT("panic_debug("), /*100 &int*/0xfe07, {.d_i32 = paline}}, {_SLIT(", tos3(\""), /*115 &string*/0xfe10, {.d_s = pafile}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pamod}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pafn}}, {_SLIT("\"), "), 0, { .d_c = 0 }}}))); v__gen__c__Gen_call_args(g, node); v__gen__c__Gen_write(g, _SLIT(")")); @@ -80310,12 +80349,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_index_of_array(v__gen__c__Gen* g, v__ast__In bool gen_or = node.or_expr.kind != v__ast__OrKind__absent || node.is_option; bool left_is_ptr = v__ast__Type_is_ptr(node.left_type); v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym.info)._v__ast__Array,(sym.info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; - string elem_type_str = v__gen__c__Gen_typ(g, info.elem_type); v__ast__Type elem_type = info.elem_type; v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, elem_type); - if (elem_sym->kind == v__ast__Kind__function) { - elem_type_str = _SLIT("voidptr"); - } + string elem_type_str = (elem_sym->kind == v__ast__Kind__function ? (_SLIT("voidptr")) : (v__gen__c__Gen_typ(g, info.elem_type))); if (g->is_assign_lhs && node.is_setter) { bool is_direct_array_access = (g->fn_decl != 0 && g->fn_decl->is_direct_arr) || node.is_direct; bool is_op_assign = g->assign_op != v__token__Kind__assign && !v__ast__Type_alias_eq(info.elem_type, _const_v__ast__string_type); @@ -80485,11 +80521,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_index_of_map(v__gen__c__Gen* g, v__ast__Inde v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((sym.info)._v__ast__Map,(sym.info)._typ, 414) /*expected idx: 414, name: v.ast.Map */ ; string key_type_str = v__gen__c__Gen_typ(g, info.key_type); v__ast__Type elem_type = info.value_type; - string elem_type_str = v__gen__c__Gen_typ(g, elem_type); v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, elem_type); - if (elem_sym->kind == v__ast__Kind__function) { - elem_type_str = _SLIT("voidptr"); - } + string elem_type_str = (elem_sym->kind == v__ast__Kind__function ? (_SLIT("voidptr")) : (v__gen__c__Gen_typ(g, elem_type))); bool get_and_set_types = (elem_sym->kind == v__ast__Kind__struct_ || elem_sym->kind == v__ast__Kind__map); if (g->is_assign_lhs && !g->is_arraymap_set && !get_and_set_types) { if (g->assign_op == v__token__Kind__assign || v__ast__Type_alias_eq(info.value_type, _const_v__ast__string_type)) { @@ -89842,12 +89875,12 @@ v__ast__Type v__parser__Parser_parse_map_type(v__parser__Parser* p) { } v__parser__Parser_check(p, v__token__Kind__lsbr); v__ast__Type key_type = v__parser__Parser_parse_type(p); - v__ast__TypeSymbol* key_sym = v__ast__Table_sym(p->table, key_type); - bool is_alias = key_sym->kind == v__ast__Kind__alias; if (v__ast__Type_idx(key_type) == 0) { v__ast__Type _t2 = 0; return _t2; } + v__ast__TypeSymbol* key_sym = v__ast__Table_sym(p->table, key_type); + bool is_alias = key_sym->kind == v__ast__Kind__alias; bool key_type_supported = (key_type == _const_v__ast__string_type_idx || key_type == _const_v__ast__voidptr_type_idx) || (key_sym->kind == v__ast__Kind__enum_ || key_sym->kind == v__ast__Kind__placeholder || key_sym->kind == v__ast__Kind__any) || ((v__ast__Type_is_int(key_type) || v__ast__Type_is_float(key_type) || is_alias) && !v__ast__Type_is_ptr(key_type)); if (!key_type_supported) { if (is_alias) { @@ -96450,7 +96483,8 @@ bool v__builder__Builder_print_warnings_and_errors_defer_0 = false; } } if (redefines.len > 0) { - eprintln( str_intp(2, _MOV((StrIntpData[]){{_SLIT("redefinition of function `"), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))); + string ferror = v__util__formatted_error(_SLIT("builder error:"), str_intp(2, _MOV((StrIntpData[]){{_SLIT("redefinition of function `"), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), _SLIT(""), ((v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,})); + eprintln(ferror); for (int _t15 = 0; _t15 < redefines.len; ++_t15) { v__builder__FunctionRedefinition redefine = ((v__builder__FunctionRedefinition*)redefines.data)[_t15]; eprintln(v__util__formatted_error(_SLIT("conflicting declaration:"), redefine.fheader, redefine.fpath, redefine.f.pos)); diff --git a/v_win.c b/v_win.c index 452e5e1..f852dd4 100644 --- a/v_win.c +++ b/v_win.c @@ -1,11 +1,11 @@ -#define V_COMMIT_HASH "12ec3b9d5" +#define V_COMMIT_HASH "9a0f49950" #ifndef V_COMMIT_HASH - #define V_COMMIT_HASH "b10cf3e0f" + #define V_COMMIT_HASH "12ec3b9d5" #endif #ifndef V_CURRENT_COMMIT_HASH - #define V_CURRENT_COMMIT_HASH "12ec3b9" + #define V_CURRENT_COMMIT_HASH "9a0f499" #endif // V comptime_definitions: @@ -36525,7 +36525,7 @@ void v__pref__Preferences_fill_with_defaults(v__pref__Preferences* p) { if ((p->third_party_option).len == 0) { p->third_party_option = p->cflags; } - string vhash = _SLIT("b10cf3e0f"); + string vhash = _SLIT("12ec3b9d5"); p->cache_manager = v__vcache__new_cache_manager(new_array_from_c_array(7, 7, sizeof(string), _MOV((string[7]){string_clone(vhash), str_intp(6, _MOV((StrIntpData[]){{_SLIT0, /*115 &v.pref.Backend*/0xfe10, {.d_s = v__pref__Backend_str(p->backend)}}, {_SLIT(" | "), /*115 &v.pref.OS*/0xfe10, {.d_s = v__pref__OS_str(p->os)}}, {_SLIT(" | "), /*115 &string*/0xfe10, {.d_s = p->ccompiler}}, {_SLIT(" | "), /*115 &bool*/0xfe10, {.d_s = p->is_prod ? _SLIT("true") : _SLIT("false")}}, {_SLIT(" | "), /*115 &bool*/0xfe10, {.d_s = p->sanitize ? _SLIT("true") : _SLIT("false")}}, {_SLIT0, 0, { .d_c = 0 }}})), string_clone(string_trim_space(p->cflags)), string_clone(string_trim_space(p->third_party_option)), string_clone(Array_string_str(p->compile_defines_all)), string_clone(Array_string_str(p->compile_defines)), string_clone(Array_string_str(p->lookup_path))}))); if (string__eq(os__user_os(), _SLIT("windows"))) { p->use_cache = false; @@ -39055,7 +39055,7 @@ string v__util__formatted_error(string kind, string omsg, string filepath, v__to path = string_replace_once(path, _const_v__util__normalised_workdir, _SLIT("")); } } - string position = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = path}}, {_SLIT(":"), /*100 &int*/0xfe07, {.d_i32 = pos.line_nr + 1}}, {_SLIT(":"), /*100 &int*/0xfe07, {.d_i32 = v__mathutil__max_T_int(1, pos.col + 1)}}, {_SLIT(":"), 0, { .d_c = 0 }}})); + string position = (filepath.len > 0 ? ( str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = path}}, {_SLIT(":"), /*100 &int*/0xfe07, {.d_i32 = pos.line_nr + 1}}, {_SLIT(":"), /*100 &int*/0xfe07, {.d_i32 = v__mathutil__max_T_int(1, pos.col + 1)}}, {_SLIT(":"), 0, { .d_c = 0 }}}))) : (_SLIT(""))); string scontext = Array_string_join(v__util__source_file_context(kind, filepath, pos), _SLIT("\n")); string final_position = v__util__bold(position); string final_kind = v__util__bold(v__util__color(kind, kind)); @@ -48768,117 +48768,128 @@ bool v__checker__Checker_check_types(v__checker__Checker* c, v__ast__Type got, v } v__ast__TypeSymbol* got_sym = v__ast__Table_sym(c->table, got); v__ast__TypeSymbol* expected_sym = v__ast__Table_sym(c->table, expected); - if (got_sym->kind == v__ast__Kind__enum_) { - if (v__ast__TypeSymbol_is_number(expected_sym)) { + if (got_sym->kind == v__ast__Kind__array && expected_sym->kind == v__ast__Kind__array) { + if (v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__Array*)__as_cast((got_sym->info)._v__ast__Array,(got_sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ).elem_type) && v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__Array*)__as_cast((expected_sym->info)._v__ast__Array,(expected_sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ).elem_type)) { bool _t8 = true; return _t8; } - } else if (got_sym->kind == v__ast__Kind__array_fixed) { - if (v__ast__TypeSymbol_is_number(expected_sym) || v__ast__Type_is_any_kind_of_pointer(expected)) { + } else if (got_sym->kind == v__ast__Kind__array_fixed && expected_sym->kind == v__ast__Kind__array_fixed) { + if (v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((got_sym->info)._v__ast__ArrayFixed,(got_sym->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ).elem_type) && v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ).elem_type)) { bool _t9 = true; return _t9; } - } else if (expected_sym->kind == v__ast__Kind__array_fixed) { - if (v__ast__TypeSymbol_is_number(got_sym) && v__ast__Type_is_any_kind_of_pointer(got)) { + } + if (got_sym->kind == v__ast__Kind__enum_) { + if (v__ast__TypeSymbol_is_number(expected_sym)) { bool _t10 = true; return _t10; + } + } else if (got_sym->kind == v__ast__Kind__array_fixed) { + if (v__ast__TypeSymbol_is_number(expected_sym) || v__ast__Type_is_any_kind_of_pointer(expected)) { + bool _t11 = true; + return _t11; + } + } else if (expected_sym->kind == v__ast__Kind__array_fixed) { + if (v__ast__TypeSymbol_is_number(got_sym) && v__ast__Type_is_any_kind_of_pointer(got)) { + bool _t12 = true; + return _t12; } else if (got_sym->kind == v__ast__Kind__array) { v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ; v__ast__Array info2 = /* as */ *(v__ast__Array*)__as_cast((got_sym->info)._v__ast__Array,(got_sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; if (v__checker__Checker_check_types(c, info.elem_type, info2.elem_type)) { - bool _t11 = true; - return _t11; + bool _t13 = true; + return _t13; } } } else if (got_sym->kind == v__ast__Kind__array) { if (v__ast__TypeSymbol_is_number(expected_sym) || v__ast__Type_is_any_kind_of_pointer(expected)) { - bool _t12 = true; - return _t12; + bool _t14 = true; + return _t14; } } else if (expected_sym->kind == v__ast__Kind__array) { if (v__ast__TypeSymbol_is_number(got_sym) && v__ast__Type_is_any_kind_of_pointer(got)) { - bool _t13 = true; - return _t13; + bool _t15 = true; + return _t15; } } if (expected_sym->kind == v__ast__Kind__enum_ && v__ast__TypeSymbol_is_number(got_sym)) { - bool _t14 = true; - return _t14; + bool _t16 = true; + return _t16; } if (got_is_ptr && exp_is_ptr) { if (v__ast__TypeSymbol_is_number(expected_sym) && v__ast__TypeSymbol_is_number(got_sym)) { - bool _t15 = true; - return _t15; + bool _t17 = true; + return _t17; } } } if (got_is_ptr && exp_is_ptr) { if (v__ast__Type_nr_muls(got) != v__ast__Type_nr_muls(expected)) { - bool _t16 = false; - return _t16; + bool _t18 = false; + return _t18; } } int exp_idx = v__ast__Type_idx(expected); int got_idx = v__ast__Type_idx(got); if (exp_idx == got_idx) { - bool _t17 = true; - return _t17; + bool _t19 = true; + return _t19; } if (exp_idx == _const_v__ast__voidptr_type_idx || exp_idx == _const_v__ast__byteptr_type_idx || (v__ast__Type_is_ptr(expected) && v__ast__Type_idx(v__ast__Type_deref(expected)) == _const_v__ast__byte_type_idx)) { if (v__ast__Type_is_ptr(got) || v__ast__Type_is_pointer(got)) { - bool _t18 = true; - return _t18; - } - } - if (v__ast__Type_is_real_pointer(expected)) { - if (v__ast__Type_alias_eq(got, _const_v__ast__int_literal_type)) { - bool _t19 = true; - return _t19; - } - } - if (got_idx == _const_v__ast__voidptr_type_idx || got_idx == _const_v__ast__byteptr_type_idx || (got_idx == _const_v__ast__byte_type_idx && v__ast__Type_is_ptr(got))) { - if (v__ast__Type_is_ptr(expected) || v__ast__Type_is_pointer(expected)) { bool _t20 = true; return _t20; } } + if (v__ast__Type_is_real_pointer(expected)) { + if (v__ast__Type_alias_eq(got, _const_v__ast__int_literal_type)) { + bool _t21 = true; + return _t21; + } + } + if (got_idx == _const_v__ast__voidptr_type_idx || got_idx == _const_v__ast__byteptr_type_idx || (got_idx == _const_v__ast__byte_type_idx && v__ast__Type_is_ptr(got))) { + if (v__ast__Type_is_ptr(expected) || v__ast__Type_is_pointer(expected)) { + bool _t22 = true; + return _t22; + } + } if (v__ast__Type_alias_eq(expected, _const_v__ast__charptr_type) && v__ast__Type_alias_eq(got, v__ast__Type_ref(_const_v__ast__char_type))) { - bool _t21 = true; - return _t21; + bool _t23 = true; + return _t23; } if (v__ast__Type_has_flag(expected, v__ast__TypeFlag__optional) || v__ast__Type_has_flag(expected, v__ast__TypeFlag__result)) { v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, got); if (((sym->idx == _const_v__ast__error_type_idx || (v__ast__Type_alias_eq(got, _const_v__ast__none_type) || v__ast__Type_alias_eq(got, _const_v__ast__error_type))) && v__ast__Type_has_flag(expected, v__ast__TypeFlag__optional)) || ((sym->idx == _const_v__ast__error_type_idx || v__ast__Type_alias_eq(got, _const_v__ast__error_type)) && v__ast__Type_has_flag(expected, v__ast__TypeFlag__result))) { - bool _t22 = true; - return _t22; + bool _t24 = true; + return _t24; } else if (!v__checker__Checker_check_basic(c, got, v__ast__Type_clear_flag(v__ast__Type_clear_flag(expected, v__ast__TypeFlag__optional), v__ast__TypeFlag__result))) { - bool _t23 = false; - return _t23; + bool _t25 = false; + return _t25; } } if (!v__checker__Checker_check_basic(c, got, expected)) { - bool _t24 = false; - return _t24; + bool _t26 = false; + return _t26; } if (v__ast__Type_is_number(got) && v__ast__Type_is_number(expected)) { if (v__ast__Type_alias_eq(got, _const_v__ast__rune_type) && v__ast__Type_alias_eq(expected, _const_v__ast__byte_type)) { - bool _t25 = true; - return _t25; + bool _t27 = true; + return _t27; } else if (v__ast__Type_alias_eq(expected, _const_v__ast__rune_type) && v__ast__Type_alias_eq(got, _const_v__ast__byte_type)) { - bool _t26 = true; - return _t26; + bool _t28 = true; + return _t28; } if (!v__ast__Type_alias_eq(v__checker__Checker_promote_num(c, expected, got), expected)) { - bool _t27 = false; - return _t27; + bool _t29 = false; + return _t29; } } if (v__ast__Type_has_flag(expected, v__ast__TypeFlag__generic)) { - bool _t28 = false; - return _t28; + bool _t30 = false; + return _t30; } - bool _t29 = true; - return _t29; + bool _t31 = true; + return _t31; } _option_void v__checker__Checker_check_expected_call_arg(v__checker__Checker* c, v__ast__Type got, v__ast__Type expected_, v__ast__Language language, v__ast__CallArg arg) { @@ -49226,10 +49237,10 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_promote_num(v__checker__Checker v__ast__Type type_hi = left_type; v__ast__Type type_lo = right_type; if (v__ast__Type_idx(type_hi) < v__ast__Type_idx(type_lo)) { - v__ast__Type _var_18083 = type_hi; - v__ast__Type _var_18092 = type_lo; - type_hi = _var_18092; - type_lo = _var_18083; + v__ast__Type _var_18612 = type_hi; + v__ast__Type _var_18621 = type_lo; + type_hi = _var_18621; + type_lo = _var_18612; } int idx_hi = v__ast__Type_idx(type_hi); int idx_lo = v__ast__Type_idx(type_lo); @@ -59799,6 +59810,8 @@ VV_LOCAL_SYMBOL void v__checker__Checker_match_exprs(v__checker__Checker* c, v__ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_sql_expr(v__checker__Checker* c, v__ast__SqlExpr* node) { bool v__checker__Checker_sql_expr_defer_0 = false; +bool v__checker__Checker_sql_expr_defer_1 = false; +v__ast__TypeSymbol old_ts; c->inside_sql = true; v__checker__Checker_sql_expr_defer_0 = true; v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, node->table_expr.typ); @@ -59815,11 +59828,18 @@ bool v__checker__Checker_sql_expr_defer_0 = false; } ; + old_ts = c->cur_orm_ts; c->cur_orm_ts = *sym; + v__checker__Checker_sql_expr_defer_1 = true; if ((sym->info)._typ != 457 /* v.ast.Struct */) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("The table symbol `"), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("` has to be a struct"), 0, { .d_c = 0 }}})), node->table_expr.pos); v__ast__Type _t3 = _const_v__ast__void_type; // Defer begin + if (v__checker__Checker_sql_expr_defer_1) { + c->cur_orm_ts = old_ts; + } + // Defer end + // Defer begin if (v__checker__Checker_sql_expr_defer_0) { c->inside_sql = false; } @@ -59908,6 +59928,11 @@ bool v__checker__Checker_sql_expr_defer_0 = false; v__checker__Checker_expr(c, node->db_expr); v__ast__Type _t8 = node->typ; // Defer begin + if (v__checker__Checker_sql_expr_defer_1) { + c->cur_orm_ts = old_ts; + } + // Defer end + // Defer begin if (v__checker__Checker_sql_expr_defer_0) { c->inside_sql = false; } @@ -59931,6 +59956,8 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_sql_stmt(v__checker__Checker* c VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_sql_stmt_line(v__checker__Checker* c, v__ast__SqlStmtLine* node) { bool v__checker__Checker_sql_stmt_line_defer_0 = false; +bool v__checker__Checker_sql_stmt_line_defer_1 = false; +v__ast__TypeSymbol old_ts; c->inside_sql = true; v__checker__Checker_sql_stmt_line_defer_0 = true; _option_void _t1 = v__checker__Checker_ensure_type_exists(c, node->table_expr.typ, node->pos); @@ -59947,11 +59974,18 @@ bool v__checker__Checker_sql_stmt_line_defer_0 = false; ; v__ast__TypeSymbol* table_sym = v__ast__Table_sym(c->table, node->table_expr.typ); + old_ts = c->cur_orm_ts; c->cur_orm_ts = *table_sym; + v__checker__Checker_sql_stmt_line_defer_1 = true; if ((table_sym->info)._typ != 457 /* v.ast.Struct */) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown type `"), /*115 &string*/0xfe10, {.d_s = table_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); v__ast__Type _t3 = _const_v__ast__void_type; // Defer begin + if (v__checker__Checker_sql_stmt_line_defer_1) { + c->cur_orm_ts = old_ts; + } + // Defer end + // Defer begin if (v__checker__Checker_sql_stmt_line_defer_0) { c->inside_sql = false; } @@ -60020,6 +60054,11 @@ bool v__checker__Checker_sql_stmt_line_defer_0 = false; } v__ast__Type _t11 = _const_v__ast__void_type; // Defer begin + if (v__checker__Checker_sql_stmt_line_defer_1) { + c->cur_orm_ts = old_ts; + } + // Defer end + // Defer begin if (v__checker__Checker_sql_stmt_line_defer_0) { c->inside_sql = false; } @@ -76132,7 +76171,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE if (left_sym->kind == v__ast__Kind__map && (string__eq(node.name, _SLIT("clone")) || string__eq(node.name, _SLIT("move")))) { receiver_type_name = _SLIT("map"); } - if (final_left_sym->kind == v__ast__Kind__array && (string__eq(node.name, _SLIT("repeat")) || string__eq(node.name, _SLIT("sort_with_compare")) || string__eq(node.name, _SLIT("free")) || string__eq(node.name, _SLIT("push_many")) || string__eq(node.name, _SLIT("trim")) || string__eq(node.name, _SLIT("first")) || string__eq(node.name, _SLIT("last")) || string__eq(node.name, _SLIT("pop")) || string__eq(node.name, _SLIT("clone")) || string__eq(node.name, _SLIT("reverse")) || string__eq(node.name, _SLIT("slice")) || string__eq(node.name, _SLIT("pointers")))) { + if (final_left_sym->kind == v__ast__Kind__array && !(left_sym->kind == v__ast__Kind__alias && v__ast__TypeSymbol_has_method(left_sym, node.name)) && (string__eq(node.name, _SLIT("repeat")) || string__eq(node.name, _SLIT("sort_with_compare")) || string__eq(node.name, _SLIT("free")) || string__eq(node.name, _SLIT("push_many")) || string__eq(node.name, _SLIT("trim")) || string__eq(node.name, _SLIT("first")) || string__eq(node.name, _SLIT("last")) || string__eq(node.name, _SLIT("pop")) || string__eq(node.name, _SLIT("clone")) || string__eq(node.name, _SLIT("reverse")) || string__eq(node.name, _SLIT("slice")) || string__eq(node.name, _SLIT("pointers")))) { if (!((left_sym->info)._typ == 472 /* v.ast.Alias */ && v__ast__TypeSymbol_has_method(typ_sym, node.name))) { receiver_type_name = _SLIT("array"); } @@ -76496,11 +76535,11 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_call(v__gen__c__Gen* g, v__ast__CallExpr } if (!print_auto_str) { if (g->pref->is_debug && string__eq(node.name, _SLIT("panic"))) { - multi_return_int_string_string_string mr_39701 = v__gen__c__Gen_panic_debug_info(g, node.pos); - int paline = mr_39701.arg0; - string pafile = mr_39701.arg1; - string pamod = mr_39701.arg2; - string pafn = mr_39701.arg3; + multi_return_int_string_string_string mr_39765 = v__gen__c__Gen_panic_debug_info(g, node.pos); + int paline = mr_39765.arg0; + string pafile = mr_39765.arg1; + string pamod = mr_39765.arg2; + string pafn = mr_39765.arg3; v__gen__c__Gen_write(g, str_intp(5, _MOV((StrIntpData[]){{_SLIT("panic_debug("), /*100 &int*/0xfe07, {.d_i32 = paline}}, {_SLIT(", tos3(\""), /*115 &string*/0xfe10, {.d_s = pafile}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pamod}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pafn}}, {_SLIT("\"), "), 0, { .d_c = 0 }}}))); v__gen__c__Gen_call_args(g, node); v__gen__c__Gen_write(g, _SLIT(")")); @@ -78024,12 +78063,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_index_of_array(v__gen__c__Gen* g, v__ast__In bool gen_or = node.or_expr.kind != v__ast__OrKind__absent || node.is_option; bool left_is_ptr = v__ast__Type_is_ptr(node.left_type); v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym.info)._v__ast__Array,(sym.info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; - string elem_type_str = v__gen__c__Gen_typ(g, info.elem_type); v__ast__Type elem_type = info.elem_type; v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, elem_type); - if (elem_sym->kind == v__ast__Kind__function) { - elem_type_str = _SLIT("voidptr"); - } + string elem_type_str = (elem_sym->kind == v__ast__Kind__function ? (_SLIT("voidptr")) : (v__gen__c__Gen_typ(g, info.elem_type))); if (g->is_assign_lhs && node.is_setter) { bool is_direct_array_access = (g->fn_decl != 0 && g->fn_decl->is_direct_arr) || node.is_direct; bool is_op_assign = g->assign_op != v__token__Kind__assign && !v__ast__Type_alias_eq(info.elem_type, _const_v__ast__string_type); @@ -78199,11 +78235,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_index_of_map(v__gen__c__Gen* g, v__ast__Inde v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((sym.info)._v__ast__Map,(sym.info)._typ, 453) /*expected idx: 453, name: v.ast.Map */ ; string key_type_str = v__gen__c__Gen_typ(g, info.key_type); v__ast__Type elem_type = info.value_type; - string elem_type_str = v__gen__c__Gen_typ(g, elem_type); v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, elem_type); - if (elem_sym->kind == v__ast__Kind__function) { - elem_type_str = _SLIT("voidptr"); - } + string elem_type_str = (elem_sym->kind == v__ast__Kind__function ? (_SLIT("voidptr")) : (v__gen__c__Gen_typ(g, elem_type))); bool get_and_set_types = (elem_sym->kind == v__ast__Kind__struct_ || elem_sym->kind == v__ast__Kind__map); if (g->is_assign_lhs && !g->is_arraymap_set && !get_and_set_types) { if (g->assign_op == v__token__Kind__assign || v__ast__Type_alias_eq(info.value_type, _const_v__ast__string_type)) { @@ -87486,12 +87519,12 @@ v__ast__Type v__parser__Parser_parse_map_type(v__parser__Parser* p) { } v__parser__Parser_check(p, v__token__Kind__lsbr); v__ast__Type key_type = v__parser__Parser_parse_type(p); - v__ast__TypeSymbol* key_sym = v__ast__Table_sym(p->table, key_type); - bool is_alias = key_sym->kind == v__ast__Kind__alias; if (v__ast__Type_idx(key_type) == 0) { v__ast__Type _t2 = 0; return _t2; } + v__ast__TypeSymbol* key_sym = v__ast__Table_sym(p->table, key_type); + bool is_alias = key_sym->kind == v__ast__Kind__alias; bool key_type_supported = (key_type == _const_v__ast__string_type_idx || key_type == _const_v__ast__voidptr_type_idx) || (key_sym->kind == v__ast__Kind__enum_ || key_sym->kind == v__ast__Kind__placeholder || key_sym->kind == v__ast__Kind__any) || ((v__ast__Type_is_int(key_type) || v__ast__Type_is_float(key_type) || is_alias) && !v__ast__Type_is_ptr(key_type)); if (!key_type_supported) { if (is_alias) { @@ -94027,7 +94060,8 @@ bool v__builder__Builder_print_warnings_and_errors_defer_0 = false; } } if (redefines.len > 0) { - eprintln( str_intp(2, _MOV((StrIntpData[]){{_SLIT("redefinition of function `"), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))); + string ferror = v__util__formatted_error(_SLIT("builder error:"), str_intp(2, _MOV((StrIntpData[]){{_SLIT("redefinition of function `"), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), _SLIT(""), ((v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,})); + eprintln(ferror); for (int _t15 = 0; _t15 < redefines.len; ++_t15) { v__builder__FunctionRedefinition redefine = ((v__builder__FunctionRedefinition*)redefines.data)[_t15]; eprintln(v__util__formatted_error(_SLIT("conflicting declaration:"), redefine.fheader, redefine.fpath, redefine.f.pos));