[v:master] 3baf1741b - make files: add a `make check` target, that runs `v test-all` locally

main
vbot 2022-05-01 17:28:14 +00:00
parent 73298627b0
commit 8d22963075
2 changed files with 186 additions and 120 deletions

153
v.c
View File

@ -1,11 +1,11 @@
#define V_COMMIT_HASH "91a9137b3"
#define V_COMMIT_HASH "3baf1741b"
#ifndef V_COMMIT_HASH
#define V_COMMIT_HASH "455a52e74"
#define V_COMMIT_HASH "91a9137b3"
#endif
#ifndef V_CURRENT_COMMIT_HASH
#define V_CURRENT_COMMIT_HASH "91a9137"
#define V_CURRENT_COMMIT_HASH "3baf174"
#endif
// V comptime_definitions:
@ -36494,78 +36494,111 @@ time__Duration time__since(time__Time t) {
string time__Time_relative(time__Time* t) {
time__Time znow = time__now();
i64 secs = znow._v_unix - t->_v_unix;
if (secs <= 30) {
string prefix = _SLIT("");
string suffix = _SLIT("");
if (secs < 0) {
secs *= -1;
prefix = _SLIT("in ");
} else {
suffix = _SLIT(" ago");
}
if (secs < _const_time__seconds_per_minute / 2) {
string _t1 = _SLIT("now");
return _t1;
}
if (secs < 60) {
string _t2 = _SLIT("1m");
return _t2;
}
if (secs < 3600) {
i64 m = secs / 60;
if (secs < _const_time__seconds_per_hour) {
i64 m = secs / _const_time__seconds_per_minute;
if (m == 1) {
string _t3 = _SLIT("1 minute ago");
return _t3;
string _t2 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1 minute"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t2;
}
string _t4 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = m}}, {_SLIT(" minutes ago"), 0, { .d_c = 0 }}}));
return _t4;
string _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = m}}, {_SLIT(" minutes"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t3;
}
if (secs < 86400) {
i64 h = secs / 3600;
if (secs < _const_time__seconds_per_hour * 24) {
i64 h = secs / _const_time__seconds_per_hour;
if (h == 1) {
string _t5 = _SLIT("1 hour ago");
return _t5;
string _t4 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1 hour"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t4;
}
string _t6 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = h}}, {_SLIT(" hours ago"), 0, { .d_c = 0 }}}));
return _t6;
string _t5 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = h}}, {_SLIT(" hours"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t5;
}
if (secs < 432000) {
i64 d = secs / 3600 / 24;
if (secs < _const_time__seconds_per_hour * 24 * 7) {
i64 d = secs / _const_time__seconds_per_hour / 24;
if (d == 1) {
string _t7 = _SLIT("1 day ago");
return _t7;
string _t6 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1 day"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t6;
}
string _t8 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = d}}, {_SLIT(" days ago"), 0, { .d_c = 0 }}}));
return _t8;
string _t7 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = d}}, {_SLIT(" days"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t7;
}
if (secs > 864000000) {
string _t9 = _SLIT("");
if (secs < _const_time__seconds_per_hour * 24 * 365) {
if (string__eq(prefix, _SLIT("in "))) {
string _t8 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("on "), /*115 &string*/0xfe10, {.d_s = time__Time_md(/*rec*/*t)}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t8;
}
string _t9 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("last "), /*115 &string*/0xfe10, {.d_s = time__Time_md(/*rec*/*t)}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t9;
}
string _t10 = time__Time_md(/*rec*/*t);
return _t10;
i64 y = secs / _const_time__seconds_per_hour / 24 / 365;
if (y == 1) {
string _t10 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1 year"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t10;
}
string _t11 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = y}}, {_SLIT(" years"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t11;
}
string time__Time_relative_short(time__Time* t) {
time__Time znow = time__now();
i64 secs = znow._v_unix - t->_v_unix;
if (secs <= 30) {
string prefix = _SLIT("");
string suffix = _SLIT("");
if (secs < 0) {
secs *= -1;
prefix = _SLIT("in ");
} else {
suffix = _SLIT(" ago");
}
if (secs < _const_time__seconds_per_minute / 2) {
string _t1 = _SLIT("now");
return _t1;
}
if (secs < 60) {
string _t2 = _SLIT("1m");
return _t2;
}
if (secs < 3600) {
string _t3 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = secs / 60}}, {_SLIT("m"), 0, { .d_c = 0 }}}));
if (secs < _const_time__seconds_per_hour) {
i64 m = secs / _const_time__seconds_per_minute;
if (m == 1) {
string _t2 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1m"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t2;
}
string _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = m}}, {_SLIT("m"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t3;
}
if (secs < 86400) {
string _t4 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = secs / 3600}}, {_SLIT("h"), 0, { .d_c = 0 }}}));
return _t4;
}
if (secs < 432000) {
string _t5 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = secs / 3600 / 24}}, {_SLIT("d"), 0, { .d_c = 0 }}}));
if (secs < _const_time__seconds_per_hour * 24) {
i64 h = secs / _const_time__seconds_per_hour;
if (h == 1) {
string _t4 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1h"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t4;
}
string _t5 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = h}}, {_SLIT("h"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t5;
}
if (secs > 864000000) {
string _t6 = _SLIT("");
return _t6;
if (secs < _const_time__seconds_per_hour * 24 * 365) {
i64 d = secs / _const_time__seconds_per_hour / 24;
if (d == 1) {
string _t6 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1d"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t6;
}
string _t7 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = d}}, {_SLIT("d"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t7;
}
string _t7 = time__Time_md(/*rec*/*t);
return _t7;
i64 y = secs / _const_time__seconds_per_hour / 24 / 365;
if (y == 1) {
string _t8 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1y"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t8;
}
string _t9 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = y}}, {_SLIT("y"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t9;
}
int time__day_of_week(int y, int m, int d) {
@ -37925,7 +37958,7 @@ void v__pref__Preferences_fill_with_defaults(v__pref__Preferences* p) {
}
#endif
}
string vhash = _SLIT("455a52e74");
string vhash = _SLIT("91a9137b3");
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;
@ -55503,7 +55536,7 @@ v__ast__Type v__checker__Checker_prefix_expr(v__checker__Checker* c, v__ast__Pre
VV_LOCAL_SYMBOL void v__checker__Checker_check_index(v__checker__Checker* c, v__ast__TypeSymbol* typ_sym, v__ast__Expr index, v__ast__Type index_type, v__token__Pos pos, bool range_index, bool is_gated) {
v__ast__TypeSymbol* index_type_sym = v__ast__Table_sym(c->table, index_type);
if (typ_sym->kind == v__ast__Kind__array || typ_sym->kind == v__ast__Kind__array_fixed || typ_sym->kind == v__ast__Kind__string) {
if (!(v__ast__Type_is_int(index_type) || index_type_sym->kind == v__ast__Kind__enum_ || (index_type_sym->kind == v__ast__Kind__alias && v__ast__Type_is_int((/* as */ *(v__ast__Alias*)__as_cast((index_type_sym->info)._v__ast__Alias,(index_type_sym->info)._typ, 432) /*expected idx: 432, name: v.ast.Alias */ ).parent_type)))) {
if (!(v__ast__Type_is_int(index_type) || index_type_sym->kind == v__ast__Kind__enum_ || (index_type_sym->kind == v__ast__Kind__alias && v__ast__Type_is_int((/* as */ *(v__ast__Alias*)__as_cast((index_type_sym->info)._v__ast__Alias,(index_type_sym->info)._typ, 432) /*expected idx: 432, name: v.ast.Alias */ ).parent_type)) || (c->pref->translated && v__ast__Type_is_any_kind_of_pointer(index_type)))) {
string type_str = (typ_sym->kind == v__ast__Kind__string ? ( str_intp(2, _MOV((StrIntpData[]){{_SLIT("non-integer string index `"), /*115 &string*/0xfe10, {.d_s = index_type_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))) : ( str_intp(3, _MOV((StrIntpData[]){{_SLIT("non-integer index `"), /*115 &string*/0xfe10, {.d_s = index_type_sym->name}}, {_SLIT("` (array type `"), /*115 &string*/0xfe10, {.d_s = typ_sym->name}}, {_SLIT("`)"), 0, { .d_c = 0 }}}))));
v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = type_str}}, {_SLIT0, 0, { .d_c = 0 }}})), pos);
}
@ -74329,7 +74362,7 @@ inline VV_LOCAL_SYMBOL string v__gen__c__c_name(string name_) {
VV_LOCAL_SYMBOL string v__gen__c__Gen_type_default(v__gen__c__Gen* g, v__ast__Type typ_) {
v__ast__Type typ = v__gen__c__Gen_unwrap_generic(g, typ_);
if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__optional)) {
if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__optional) || v__ast__Type_has_flag(typ, v__ast__TypeFlag__result)) {
string _t1 = _SLIT("{0}");
return _t1;
}
@ -74397,11 +74430,11 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_type_default(v__gen__c__Gen* g, v__ast__Ty
{
v__ast__Map info = v__ast__TypeSymbol_map_info(sym);
v__ast__TypeSymbol* key_typ = v__ast__Table_sym(g->table, info.key_type);
multi_return_string_string_string_string mr_159244 = v__gen__c__Gen_map_fn_ptrs(g, *key_typ);
string hash_fn = mr_159244.arg0;
string key_eq_fn = mr_159244.arg1;
string clone_fn = mr_159244.arg2;
string free_fn = mr_159244.arg3;
multi_return_string_string_string_string mr_159269 = v__gen__c__Gen_map_fn_ptrs(g, *key_typ);
string hash_fn = mr_159269.arg0;
string key_eq_fn = mr_159269.arg1;
string clone_fn = mr_159269.arg2;
string free_fn = mr_159269.arg3;
string noscan_key = v__gen__c__Gen_check_noscan(g, info.key_type);
string noscan_value = v__gen__c__Gen_check_noscan(g, info.value_type);
string noscan = (noscan_key.len != 0 || noscan_value.len != 0 ? (_SLIT("_noscan")) : (_SLIT("")));
@ -74932,8 +74965,8 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) {
int params_start_pos = g->out.len;
Array_v__ast__Param params = array_clone_to_depth(&method.params, 0);
array_set(&params, 0, &(v__ast__Param[]) { ((v__ast__Param){(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).pos,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).name,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).is_mut,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).is_auto_rec,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).type_pos,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).is_hidden,.typ = v__ast__Type_set_nr_muls(st, 1),}) });
multi_return_Array_string_Array_string_Array_bool mr_173726 = v__gen__c__Gen_fn_decl_params(g, params, ((voidptr)(0)), false);
Array_string fargs = mr_173726.arg0;
multi_return_Array_string_Array_string_Array_bool mr_173751 = v__gen__c__Gen_fn_decl_params(g, params, ((voidptr)(0)), false);
Array_string fargs = mr_173751.arg0;
string parameter_name = strings__Builder_cut_last(&g->out, g->out.len - params_start_pos);
if (v__ast__Type_is_ptr(st)) {
parameter_name = string_trim_string_left(parameter_name, _SLIT("__shared__"));
@ -74950,8 +74983,8 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) {
*(multi_return_v__ast__Fn_Array_v__ast__Type*) _t26.data = (multi_return_v__ast__Fn_Array_v__ast__Type){.arg0=((v__ast__Fn){.is_variadic = 0,.language = 0,.is_pub = 0,.is_ctor_new = 0,.is_deprecated = 0,.is_noreturn = 0,.is_unsafe = 0,.is_placeholder = 0,.is_main = 0,.is_test = 0,.is_keep_alive = 0,.is_method = 0,.no_body = 0,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.file_mode = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type = 0,.receiver_type = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)};
}
multi_return_v__ast__Fn_Array_v__ast__Type mr_174190 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t26.data);
Array_v__ast__Type embed_types = mr_174190.arg1;
multi_return_v__ast__Fn_Array_v__ast__Type mr_174215 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t26.data);
Array_v__ast__Type embed_types = mr_174215.arg1;
if (embed_types.len > 0 && !Array_string_contains(method_names, method.name)) {
v__ast__TypeSymbol* embed_sym = v__ast__Table_sym(g->table, (*(v__ast__Type*)array_last(embed_types)));
string method_name = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = embed_sym->cname}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = method.name}}, {_SLIT0, 0, { .d_c = 0 }}}));

153
v_win.c
View File

@ -1,11 +1,11 @@
#define V_COMMIT_HASH "91a9137b3"
#define V_COMMIT_HASH "3baf1741b"
#ifndef V_COMMIT_HASH
#define V_COMMIT_HASH "455a52e74"
#define V_COMMIT_HASH "91a9137b3"
#endif
#ifndef V_CURRENT_COMMIT_HASH
#define V_CURRENT_COMMIT_HASH "91a9137"
#define V_CURRENT_COMMIT_HASH "3baf174"
#endif
// V comptime_definitions:
@ -33656,78 +33656,111 @@ time__Duration time__since(time__Time t) {
string time__Time_relative(time__Time* t) {
time__Time znow = time__now();
i64 secs = znow._v_unix - t->_v_unix;
if (secs <= 30) {
string prefix = _SLIT("");
string suffix = _SLIT("");
if (secs < 0) {
secs *= -1;
prefix = _SLIT("in ");
} else {
suffix = _SLIT(" ago");
}
if (secs < _const_time__seconds_per_minute / 2) {
string _t1 = _SLIT("now");
return _t1;
}
if (secs < 60) {
string _t2 = _SLIT("1m");
return _t2;
}
if (secs < 3600) {
i64 m = secs / 60;
if (secs < _const_time__seconds_per_hour) {
i64 m = secs / _const_time__seconds_per_minute;
if (m == 1) {
string _t3 = _SLIT("1 minute ago");
return _t3;
string _t2 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1 minute"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t2;
}
string _t4 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = m}}, {_SLIT(" minutes ago"), 0, { .d_c = 0 }}}));
return _t4;
string _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = m}}, {_SLIT(" minutes"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t3;
}
if (secs < 86400) {
i64 h = secs / 3600;
if (secs < _const_time__seconds_per_hour * 24) {
i64 h = secs / _const_time__seconds_per_hour;
if (h == 1) {
string _t5 = _SLIT("1 hour ago");
return _t5;
string _t4 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1 hour"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t4;
}
string _t6 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = h}}, {_SLIT(" hours ago"), 0, { .d_c = 0 }}}));
return _t6;
string _t5 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = h}}, {_SLIT(" hours"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t5;
}
if (secs < 432000) {
i64 d = secs / 3600 / 24;
if (secs < _const_time__seconds_per_hour * 24 * 7) {
i64 d = secs / _const_time__seconds_per_hour / 24;
if (d == 1) {
string _t7 = _SLIT("1 day ago");
return _t7;
string _t6 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1 day"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t6;
}
string _t8 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = d}}, {_SLIT(" days ago"), 0, { .d_c = 0 }}}));
return _t8;
string _t7 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = d}}, {_SLIT(" days"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t7;
}
if (secs > 864000000) {
string _t9 = _SLIT("");
if (secs < _const_time__seconds_per_hour * 24 * 365) {
if (string__eq(prefix, _SLIT("in "))) {
string _t8 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("on "), /*115 &string*/0xfe10, {.d_s = time__Time_md(/*rec*/*t)}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t8;
}
string _t9 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("last "), /*115 &string*/0xfe10, {.d_s = time__Time_md(/*rec*/*t)}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t9;
}
string _t10 = time__Time_md(/*rec*/*t);
return _t10;
i64 y = secs / _const_time__seconds_per_hour / 24 / 365;
if (y == 1) {
string _t10 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1 year"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t10;
}
string _t11 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = y}}, {_SLIT(" years"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t11;
}
string time__Time_relative_short(time__Time* t) {
time__Time znow = time__now();
i64 secs = znow._v_unix - t->_v_unix;
if (secs <= 30) {
string prefix = _SLIT("");
string suffix = _SLIT("");
if (secs < 0) {
secs *= -1;
prefix = _SLIT("in ");
} else {
suffix = _SLIT(" ago");
}
if (secs < _const_time__seconds_per_minute / 2) {
string _t1 = _SLIT("now");
return _t1;
}
if (secs < 60) {
string _t2 = _SLIT("1m");
return _t2;
}
if (secs < 3600) {
string _t3 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = secs / 60}}, {_SLIT("m"), 0, { .d_c = 0 }}}));
if (secs < _const_time__seconds_per_hour) {
i64 m = secs / _const_time__seconds_per_minute;
if (m == 1) {
string _t2 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1m"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t2;
}
string _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = m}}, {_SLIT("m"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t3;
}
if (secs < 86400) {
string _t4 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = secs / 3600}}, {_SLIT("h"), 0, { .d_c = 0 }}}));
return _t4;
}
if (secs < 432000) {
string _t5 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = secs / 3600 / 24}}, {_SLIT("d"), 0, { .d_c = 0 }}}));
if (secs < _const_time__seconds_per_hour * 24) {
i64 h = secs / _const_time__seconds_per_hour;
if (h == 1) {
string _t4 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1h"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t4;
}
string _t5 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = h}}, {_SLIT("h"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t5;
}
if (secs > 864000000) {
string _t6 = _SLIT("");
return _t6;
if (secs < _const_time__seconds_per_hour * 24 * 365) {
i64 d = secs / _const_time__seconds_per_hour / 24;
if (d == 1) {
string _t6 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1d"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t6;
}
string _t7 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = d}}, {_SLIT("d"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t7;
}
string _t7 = time__Time_md(/*rec*/*t);
return _t7;
i64 y = secs / _const_time__seconds_per_hour / 24 / 365;
if (y == 1) {
string _t8 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1y"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t8;
}
string _t9 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = y}}, {_SLIT("y"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}}));
return _t9;
}
int time__day_of_week(int y, int m, int d) {
@ -36276,7 +36309,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("455a52e74");
string vhash = _SLIT("91a9137b3");
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;
@ -53587,7 +53620,7 @@ v__ast__Type v__checker__Checker_prefix_expr(v__checker__Checker* c, v__ast__Pre
VV_LOCAL_SYMBOL void v__checker__Checker_check_index(v__checker__Checker* c, v__ast__TypeSymbol* typ_sym, v__ast__Expr index, v__ast__Type index_type, v__token__Pos pos, bool range_index, bool is_gated) {
v__ast__TypeSymbol* index_type_sym = v__ast__Table_sym(c->table, index_type);
if (typ_sym->kind == v__ast__Kind__array || typ_sym->kind == v__ast__Kind__array_fixed || typ_sym->kind == v__ast__Kind__string) {
if (!(v__ast__Type_is_int(index_type) || index_type_sym->kind == v__ast__Kind__enum_ || (index_type_sym->kind == v__ast__Kind__alias && v__ast__Type_is_int((/* as */ *(v__ast__Alias*)__as_cast((index_type_sym->info)._v__ast__Alias,(index_type_sym->info)._typ, 471) /*expected idx: 471, name: v.ast.Alias */ ).parent_type)))) {
if (!(v__ast__Type_is_int(index_type) || index_type_sym->kind == v__ast__Kind__enum_ || (index_type_sym->kind == v__ast__Kind__alias && v__ast__Type_is_int((/* as */ *(v__ast__Alias*)__as_cast((index_type_sym->info)._v__ast__Alias,(index_type_sym->info)._typ, 471) /*expected idx: 471, name: v.ast.Alias */ ).parent_type)) || (c->pref->translated && v__ast__Type_is_any_kind_of_pointer(index_type)))) {
string type_str = (typ_sym->kind == v__ast__Kind__string ? ( str_intp(2, _MOV((StrIntpData[]){{_SLIT("non-integer string index `"), /*115 &string*/0xfe10, {.d_s = index_type_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))) : ( str_intp(3, _MOV((StrIntpData[]){{_SLIT("non-integer index `"), /*115 &string*/0xfe10, {.d_s = index_type_sym->name}}, {_SLIT("` (array type `"), /*115 &string*/0xfe10, {.d_s = typ_sym->name}}, {_SLIT("`)"), 0, { .d_c = 0 }}}))));
v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = type_str}}, {_SLIT0, 0, { .d_c = 0 }}})), pos);
}
@ -72144,7 +72177,7 @@ inline VV_LOCAL_SYMBOL string v__gen__c__c_name(string name_) {
VV_LOCAL_SYMBOL string v__gen__c__Gen_type_default(v__gen__c__Gen* g, v__ast__Type typ_) {
v__ast__Type typ = v__gen__c__Gen_unwrap_generic(g, typ_);
if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__optional)) {
if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__optional) || v__ast__Type_has_flag(typ, v__ast__TypeFlag__result)) {
string _t1 = _SLIT("{0}");
return _t1;
}
@ -72212,11 +72245,11 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_type_default(v__gen__c__Gen* g, v__ast__Ty
{
v__ast__Map info = v__ast__TypeSymbol_map_info(sym);
v__ast__TypeSymbol* key_typ = v__ast__Table_sym(g->table, info.key_type);
multi_return_string_string_string_string mr_159244 = v__gen__c__Gen_map_fn_ptrs(g, *key_typ);
string hash_fn = mr_159244.arg0;
string key_eq_fn = mr_159244.arg1;
string clone_fn = mr_159244.arg2;
string free_fn = mr_159244.arg3;
multi_return_string_string_string_string mr_159269 = v__gen__c__Gen_map_fn_ptrs(g, *key_typ);
string hash_fn = mr_159269.arg0;
string key_eq_fn = mr_159269.arg1;
string clone_fn = mr_159269.arg2;
string free_fn = mr_159269.arg3;
string noscan_key = v__gen__c__Gen_check_noscan(g, info.key_type);
string noscan_value = v__gen__c__Gen_check_noscan(g, info.value_type);
string noscan = (noscan_key.len != 0 || noscan_value.len != 0 ? (_SLIT("_noscan")) : (_SLIT("")));
@ -72742,8 +72775,8 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) {
int params_start_pos = g->out.len;
Array_v__ast__Param params = array_clone_to_depth(&method.params, 0);
array_set(&params, 0, &(v__ast__Param[]) { ((v__ast__Param){(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).pos,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).name,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).is_mut,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).is_auto_rec,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).type_pos,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).is_hidden,.typ = v__ast__Type_set_nr_muls(st, 1),}) });
multi_return_Array_string_Array_string_Array_bool mr_173726 = v__gen__c__Gen_fn_decl_params(g, params, ((voidptr)(0)), false);
Array_string fargs = mr_173726.arg0;
multi_return_Array_string_Array_string_Array_bool mr_173751 = v__gen__c__Gen_fn_decl_params(g, params, ((voidptr)(0)), false);
Array_string fargs = mr_173751.arg0;
string parameter_name = strings__Builder_cut_last(&g->out, g->out.len - params_start_pos);
if (v__ast__Type_is_ptr(st)) {
parameter_name = string_trim_string_left(parameter_name, _SLIT("__shared__"));
@ -72760,8 +72793,8 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) {
*(multi_return_v__ast__Fn_Array_v__ast__Type*) _t26.data = (multi_return_v__ast__Fn_Array_v__ast__Type){.arg0=((v__ast__Fn){.is_variadic = 0,.language = 0,.is_pub = 0,.is_ctor_new = 0,.is_deprecated = 0,.is_noreturn = 0,.is_unsafe = 0,.is_placeholder = 0,.is_main = 0,.is_test = 0,.is_keep_alive = 0,.is_method = 0,.no_body = 0,.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.file_mode = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type = 0,.receiver_type = 0,.name = (string){.str=(byteptr)"", .is_lit=1},.params = __new_array(0, 0, sizeof(v__ast__Param)),.source_fn = 0,.usages = 0,.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.is_conditional = 0,.ctdefine_idx = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)};
}
multi_return_v__ast__Fn_Array_v__ast__Type mr_174190 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t26.data);
Array_v__ast__Type embed_types = mr_174190.arg1;
multi_return_v__ast__Fn_Array_v__ast__Type mr_174215 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t26.data);
Array_v__ast__Type embed_types = mr_174215.arg1;
if (embed_types.len > 0 && !Array_string_contains(method_names, method.name)) {
v__ast__TypeSymbol* embed_sym = v__ast__Table_sym(g->table, (*(v__ast__Type*)array_last(embed_types)));
string method_name = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = embed_sym->cname}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = method.name}}, {_SLIT0, 0, { .d_c = 0 }}}));