[v:master] 3afb88c4e - chore: switched to vieter/vc repo

main
vbot 2022-05-05 09:01:41 +00:00
parent 6fb7a0edb9
commit d65f4e319f
2 changed files with 464 additions and 438 deletions

453
v.c
View File

@ -1,11 +1,11 @@
#define V_COMMIT_HASH "c405c1916" #define V_COMMIT_HASH "3afb88c4e"
#ifndef V_COMMIT_HASH #ifndef V_COMMIT_HASH
#define V_COMMIT_HASH "41857b0ac" #define V_COMMIT_HASH "c405c1916"
#endif #endif
#ifndef V_CURRENT_COMMIT_HASH #ifndef V_CURRENT_COMMIT_HASH
#define V_CURRENT_COMMIT_HASH "c405c19" #define V_CURRENT_COMMIT_HASH "3afb88c"
#endif #endif
// V comptime_definitions: // V comptime_definitions:
@ -7734,7 +7734,7 @@ string string_clone(string a);
string string_replace_once(string s, string rep, string with); string string_replace_once(string s, string rep, string with);
string string_replace(string s, string rep, string with); string string_replace(string s, string rep, string with);
string string_replace_each(string s, Array_string vals); string string_replace_each(string s, Array_string vals);
VV_LOCAL_SYMBOL int compare_11653268393309465375_RepIndex_by_idx(RepIndex* a, RepIndex* b) { VV_LOCAL_SYMBOL int compare_3079424758118292824_RepIndex_by_idx(RepIndex* a, RepIndex* b) {
if (a->idx < b->idx) return -1; if (a->idx < b->idx) return -1;
else return 1; else return 1;
} }
@ -7974,7 +7974,7 @@ Option_void os__execve(string cmdpath, Array_string cmdargs, Array_string envs);
int os__is_atty(int fd); int os__is_atty(int fd);
Option_void os__write_file_array(string path, array buffer); Option_void os__write_file_array(string path, array buffer);
Option_Array_string os__glob(Array_string patterns); Option_Array_string os__glob(Array_string patterns);
VV_LOCAL_SYMBOL int compare_3075544183021293552_string(string* a, string* b) { VV_LOCAL_SYMBOL int compare_3677745349018262865_string(string* a, string* b) {
if (string__lt(*a, *b)) return -1; if (string__lt(*a, *b)) return -1;
else return 1; else return 1;
} }
@ -8155,7 +8155,7 @@ Array_string os__cmdline__only_non_options(Array_string args);
Array_string os__cmdline__only_options(Array_string args); Array_string os__cmdline__only_options(Array_string args);
#define _const_v__token__max_keyword_len 20 #define _const_v__token__max_keyword_len 20
v__token__KeywordsMatcher v__token__new_keywords_matcher_T_v__token__Kind(Map_string_v__token__Kind kw_map); v__token__KeywordsMatcher v__token__new_keywords_matcher_T_v__token__Kind(Map_string_v__token__Kind kw_map);
VV_LOCAL_SYMBOL int compare_186646746980636166_v__token__WIndex_by_word(v__token__WIndex* a, v__token__WIndex* b) { VV_LOCAL_SYMBOL int compare_5690199065019732925_v__token__WIndex_by_word(v__token__WIndex* a, v__token__WIndex* b) {
if (string__lt(a->word, b->word)) return -1; if (string__lt(a->word, b->word)) return -1;
else return 1; else return 1;
} }
@ -8197,7 +8197,7 @@ Option_v__token__Kind v__token__kind_from_string(string s);
int v__mathutil__min_T_int(int a, int b); int v__mathutil__min_T_int(int a, int b);
int v__mathutil__max_T_int(int a, int b); int v__mathutil__max_T_int(int a, int b);
void v__dotgraph__start_digraph(void); void v__dotgraph__start_digraph(void);
VV_LOCAL_SYMBOL void anon_fn_eb34f0b759dade77__82(void); VV_LOCAL_SYMBOL void anon_fn_6b9593b3d6ef610a__82(void);
v__dotgraph__DotGraph* v__dotgraph__new(string name, string label, string color); v__dotgraph__DotGraph* v__dotgraph__new(string name, string label, string color);
void v__dotgraph__DotGraph_writeln(v__dotgraph__DotGraph* d, string line); void v__dotgraph__DotGraph_writeln(v__dotgraph__DotGraph* d, string line);
void v__dotgraph__DotGraph_finish(v__dotgraph__DotGraph* d); void v__dotgraph__DotGraph_finish(v__dotgraph__DotGraph* d);
@ -8801,7 +8801,7 @@ f64 math__with_set_high_word(f64 f, u32 hi);
u32 math__get_high_word(f64 f); u32 math__get_high_word(f64 f);
VV_LOCAL_SYMBOL Option_string v__pkgconfig__desc(string mod); VV_LOCAL_SYMBOL Option_string v__pkgconfig__desc(string mod);
Option_v__pkgconfig__Main_ptr v__pkgconfig__main(Array_string args); Option_v__pkgconfig__Main_ptr v__pkgconfig__main(Array_string args);
VV_LOCAL_SYMBOL int compare_16330786295575367509_string(string* a, string* b) { VV_LOCAL_SYMBOL int compare_10129308118656229290_string(string* a, string* b) {
if (string__lt(*a, *b)) return -1; if (string__lt(*a, *b)) return -1;
else return 1; else return 1;
} }
@ -9069,7 +9069,7 @@ v__pref__CompilerType v__pref__cc_from_string(string cc_str);
v__pref__Arch v__pref__get_host_arch(void); v__pref__Arch v__pref__get_host_arch(void);
VV_LOCAL_SYMBOL void v__pref__Preferences_parse_define(v__pref__Preferences* prefs, string define); VV_LOCAL_SYMBOL void v__pref__Preferences_parse_define(v__pref__Preferences* prefs, string define);
Array_string v__pref__Preferences_should_compile_filtered_files(v__pref__Preferences* prefs, string dir, Array_string files_); Array_string v__pref__Preferences_should_compile_filtered_files(v__pref__Preferences* prefs, string dir, Array_string files_);
VV_LOCAL_SYMBOL int compare_13661271458656804876_string(string* a, string* b) { VV_LOCAL_SYMBOL int compare_11540237029762306605_string(string* a, string* b) {
if (string__lt(*a, *b)) return -1; if (string__lt(*a, *b)) return -1;
else return 1; else return 1;
} }
@ -9130,7 +9130,7 @@ u64 sync__thread_id(void);
string _const_help__unknown_topic; // a string literal, inited later string _const_help__unknown_topic; // a string literal, inited later
void help__print_and_exit(string topic); void help__print_and_exit(string topic);
VV_LOCAL_SYMBOL string help__known_topics(string topicdir); VV_LOCAL_SYMBOL string help__known_topics(string topicdir);
VV_LOCAL_SYMBOL int compare_10452767129756656329_string(string* a, string* b) { VV_LOCAL_SYMBOL int compare_1468091262560489642_string(string* a, string* b) {
if (string__lt(*a, *b)) return -1; if (string__lt(*a, *b)) return -1;
else return 1; else return 1;
} }
@ -9173,13 +9173,13 @@ v__util__Suggestion v__util__new_suggestion(string wanted, Array_string possibil
void v__util__Suggestion_add(v__util__Suggestion* s, string val); void v__util__Suggestion_add(v__util__Suggestion* s, string val);
void v__util__Suggestion_add_many(v__util__Suggestion* s, Array_string many); void v__util__Suggestion_add_many(v__util__Suggestion* s, Array_string many);
void v__util__Suggestion_sort(v__util__Suggestion* s); void v__util__Suggestion_sort(v__util__Suggestion* s);
VV_LOCAL_SYMBOL int compare_6907021362050549619_v__util__Possibility_by_similarity(v__util__Possibility* a, v__util__Possibility* b) { VV_LOCAL_SYMBOL int compare_15123029833316296960_v__util__Possibility_by_similarity(v__util__Possibility* a, v__util__Possibility* b) {
if (a->similarity < b->similarity) return -1; if (a->similarity < b->similarity) return -1;
else return 1; else return 1;
} }
string v__util__Suggestion_say(v__util__Suggestion s, string msg); string v__util__Suggestion_say(v__util__Suggestion s, string msg);
VV_LOCAL_SYMBOL int compare_6907021362050549619_string(string* a, string* b) { VV_LOCAL_SYMBOL int compare_15123029833316296960_string(string* a, string* b) {
if (string__lt(*a, *b)) return -1; if (string__lt(*a, *b)) return -1;
else return 1; else return 1;
} }
@ -9764,7 +9764,7 @@ v__ast__Type v__checker__Checker_int_lit(v__checker__Checker* c, v__ast__Integer
void v__checker__Checker_struct_decl(v__checker__Checker* c, v__ast__StructDecl* node); void v__checker__Checker_struct_decl(v__checker__Checker* c, v__ast__StructDecl* node);
VV_LOCAL_SYMBOL int v__checker__minify_sort_fn(v__ast__StructField* a, v__ast__StructField* b); VV_LOCAL_SYMBOL int v__checker__minify_sort_fn(v__ast__StructField* a, v__ast__StructField* b);
v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__StructInit* node); v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__StructInit* node);
VV_LOCAL_SYMBOL int compare_2892273012681280244_v__ast__StructField_by_i(v__ast__StructField* a, v__ast__StructField* b) { VV_LOCAL_SYMBOL int compare_5995660241070764127_v__ast__StructField_by_i(v__ast__StructField* a, v__ast__StructField* b) {
if (a->i < b->i) return -1; if (a->i < b->i) return -1;
else return 1; else return 1;
} }
@ -10285,7 +10285,7 @@ v__ast__Type v__parser__Parser_parse_fn_type(v__parser__Parser* p, string name);
v__ast__Type v__parser__Parser_parse_type_with_mut(v__parser__Parser* p, bool is_mut); v__ast__Type v__parser__Parser_parse_type_with_mut(v__parser__Parser* p, bool is_mut);
v__ast__Language v__parser__Parser_parse_language(v__parser__Parser* p); v__ast__Language v__parser__Parser_parse_language(v__parser__Parser* p);
v__ast__Type v__parser__Parser_parse_inline_sum_type(v__parser__Parser* p); v__ast__Type v__parser__Parser_parse_inline_sum_type(v__parser__Parser* p);
VV_LOCAL_SYMBOL int compare_7932637671395545435_string(string* a, string* b) { VV_LOCAL_SYMBOL int compare_14364895672131222426_string(string* a, string* b) {
if (string__lt(*a, *b)) return -1; if (string__lt(*a, *b)) return -1;
else return 1; else return 1;
} }
@ -13141,7 +13141,7 @@ void v__ast__TypeSymbol_free(v__ast__TypeSymbol* it) {
string_free(&(it->mod)); string_free(&(it->mod));
} }
VV_LOCAL_SYMBOL void anon_fn_eb34f0b759dade77__82(void) { VV_LOCAL_SYMBOL void anon_fn_6b9593b3d6ef610a__82(void) {
println(_SLIT("}")); println(_SLIT("}"));
} }
@ -21003,7 +21003,7 @@ string string_replace_each(string s, Array_string vals) {
if (idxs.len == 0) { if (idxs.len == 0) {
return string_clone(s); return string_clone(s);
} }
qsort(idxs.data, idxs.len, idxs.element_size, (int (*)(const void *, const void *))&compare_11653268393309465375_RepIndex_by_idx); qsort(idxs.data, idxs.len, idxs.element_size, (int (*)(const void *, const void *))&compare_3079424758118292824_RepIndex_by_idx);
u8* b = malloc_noscan(new_len + 1); u8* b = malloc_noscan(new_len + 1);
int idx_pos = 0; int idx_pos = 0;
RepIndex cur_idx = ((RepIndex*)idxs.data)[idx_pos]; RepIndex cur_idx = ((RepIndex*)idxs.data)[idx_pos];
@ -25997,7 +25997,7 @@ Option_Array_string os__glob(Array_string patterns) {
; ;
} }
qsort(matches.data, matches.len, matches.element_size, (int (*)(const void *, const void *))&compare_3075544183021293552_string); qsort(matches.data, matches.len, matches.element_size, (int (*)(const void *, const void *))&compare_3677745349018262865_string);
Option_Array_string _t4; Option_Array_string _t4;
opt_ok(&(Array_string[]) { matches }, (Option*)(&_t4), sizeof(Array_string)); opt_ok(&(Array_string[]) { matches }, (Option*)(&_t4), sizeof(Array_string));
return _t4; return _t4;
@ -28348,7 +28348,7 @@ v__token__KeywordsMatcher v__token__new_keywords_matcher_T_v__token__Kind(Map_st
} }
for (int i = 0; i < _const_v__token__max_keyword_len; ++i) { for (int i = 0; i < _const_v__token__max_keyword_len; ++i) {
if (km.words[v_fixed_index(i, 20)].len > 0) { if (km.words[v_fixed_index(i, 20)].len > 0) {
qsort(km.words[v_fixed_index(i, 20)].data, km.words[v_fixed_index(i, 20)].len, km.words[v_fixed_index(i, 20)].element_size, (int (*)(const void *, const void *))&compare_186646746980636166_v__token__WIndex_by_word); qsort(km.words[v_fixed_index(i, 20)].data, km.words[v_fixed_index(i, 20)].len, km.words[v_fixed_index(i, 20)].element_size, (int (*)(const void *, const void *))&compare_5690199065019732925_v__token__WIndex_by_word);
#if defined(CUSTOM_DEFINE_trace_keyword_matcher_initialisation) #if defined(CUSTOM_DEFINE_trace_keyword_matcher_initialisation)
{ {
print( str_intp(2, _MOV((StrIntpData[]){{_SLIT("word len: "), /*100 &int literal*/0x6fe27, {.d_i32 = i}}, {_SLIT(" | words: "), 0, { .d_c = 0 }}}))); print( str_intp(2, _MOV((StrIntpData[]){{_SLIT("word len: "), /*100 &int literal*/0x6fe27, {.d_i32 = i}}, {_SLIT(" | words: "), 0, { .d_c = 0 }}})));
@ -28386,7 +28386,7 @@ v__token__KeywordsMatcher v__token__new_keywords_matcher_T_int(Map_string_int kw
} }
for (int i = 0; i < _const_v__token__max_keyword_len; ++i) { for (int i = 0; i < _const_v__token__max_keyword_len; ++i) {
if (km.words[v_fixed_index(i, 20)].len > 0) { if (km.words[v_fixed_index(i, 20)].len > 0) {
qsort(km.words[v_fixed_index(i, 20)].data, km.words[v_fixed_index(i, 20)].len, km.words[v_fixed_index(i, 20)].element_size, (int (*)(const void *, const void *))&compare_186646746980636166_v__token__WIndex_by_word); qsort(km.words[v_fixed_index(i, 20)].data, km.words[v_fixed_index(i, 20)].len, km.words[v_fixed_index(i, 20)].element_size, (int (*)(const void *, const void *))&compare_5690199065019732925_v__token__WIndex_by_word);
#if defined(CUSTOM_DEFINE_trace_keyword_matcher_initialisation) #if defined(CUSTOM_DEFINE_trace_keyword_matcher_initialisation)
{ {
print( str_intp(2, _MOV((StrIntpData[]){{_SLIT("word len: "), /*100 &int literal*/0x6fe27, {.d_i32 = i}}, {_SLIT(" | words: "), 0, { .d_c = 0 }}}))); print( str_intp(2, _MOV((StrIntpData[]){{_SLIT("word len: "), /*100 &int literal*/0x6fe27, {.d_i32 = i}}, {_SLIT(" | words: "), 0, { .d_c = 0 }}})));
@ -29721,7 +29721,7 @@ inline int v__mathutil__max_T_int(int a, int b) {
void v__dotgraph__start_digraph(void) { void v__dotgraph__start_digraph(void) {
println(_SLIT("digraph G {")); println(_SLIT("digraph G {"));
atexit((voidptr) anon_fn_eb34f0b759dade77__82); atexit((voidptr) anon_fn_6b9593b3d6ef610a__82);
} }
v__dotgraph__DotGraph* v__dotgraph__new(string name, string label, string color) { v__dotgraph__DotGraph* v__dotgraph__new(string name, string label, string color) {
@ -34952,7 +34952,7 @@ Option_v__pkgconfig__Main_ptr v__pkgconfig__main(Array_string args) {
m->res = _const_v__pkgconfig__version; m->res = _const_v__pkgconfig__version;
} else if (opt->listall) { } else if (opt->listall) {
Array_string modules = v__pkgconfig__list(); Array_string modules = v__pkgconfig__list();
qsort(modules.data, modules.len, modules.element_size, (int (*)(const void *, const void *))&compare_16330786295575367509_string); qsort(modules.data, modules.len, modules.element_size, (int (*)(const void *, const void *))&compare_10129308118656229290_string);
if (opt->description) { if (opt->description) {
for (int _t1 = 0; _t1 < modules.len; ++_t1) { for (int _t1 = 0; _t1 < modules.len; ++_t1) {
string mod = ((string*)modules.data)[_t1]; string mod = ((string*)modules.data)[_t1];
@ -38040,7 +38040,7 @@ void v__pref__Preferences_fill_with_defaults(v__pref__Preferences* p) {
} }
#endif #endif
} }
string vhash = _SLIT("41857b0ac"); string vhash = _SLIT("c405c1916");
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))}))); 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"))) { if (string__eq(os__user_os(), _SLIT("windows"))) {
p->use_cache = false; p->use_cache = false;
@ -39444,7 +39444,7 @@ VV_LOCAL_SYMBOL void v__pref__Preferences_parse_define(v__pref__Preferences* pre
Array_string v__pref__Preferences_should_compile_filtered_files(v__pref__Preferences* prefs, string dir, Array_string files_) { Array_string v__pref__Preferences_should_compile_filtered_files(v__pref__Preferences* prefs, string dir, Array_string files_) {
Array_string res = __new_array_with_default(0, 0, sizeof(string), 0); Array_string res = __new_array_with_default(0, 0, sizeof(string), 0);
Array_string files = array_clone_to_depth(&files_, 0); Array_string files = array_clone_to_depth(&files_, 0);
qsort(files.data, files.len, files.element_size, (int (*)(const void *, const void *))&compare_13661271458656804876_string); qsort(files.data, files.len, files.element_size, (int (*)(const void *, const void *))&compare_11540237029762306605_string);
Array_string all_v_files = __new_array_with_default(0, 0, sizeof(string), 0); Array_string all_v_files = __new_array_with_default(0, 0, sizeof(string), 0);
for (int _t1 = 0; _t1 < files.len; ++_t1) { for (int _t1 = 0; _t1 < files.len; ++_t1) {
string file = ((string*)files.data)[_t1]; string file = ((string*)files.data)[_t1];
@ -40201,7 +40201,7 @@ int sync__channel_select(Array_sync__Channel_ptr* channels, Array_sync__Directio
// assert // assert
if (!(channels->len == dir.len)) { if (!(channels->len == dir.len)) {
VAssertMetaInfo v_assert_meta_info__t1 = {0}; VAssertMetaInfo v_assert_meta_info__t1 = {0};
v_assert_meta_info__t1.fpath = _SLIT("/woodpecker/src/git.rustybever.be/Chewing_Bever/v/vlib/sync/channels.c.v"); v_assert_meta_info__t1.fpath = _SLIT("/woodpecker/src/git.rustybever.be/vieter/v/vlib/sync/channels.c.v");
v_assert_meta_info__t1.line_nr = 550; v_assert_meta_info__t1.line_nr = 550;
v_assert_meta_info__t1.fn_name = _SLIT("sync.channel_select"); v_assert_meta_info__t1.fn_name = _SLIT("sync.channel_select");
v_assert_meta_info__t1.src = _SLIT("channels.len == dir.len"); v_assert_meta_info__t1.src = _SLIT("channels.len == dir.len");
@ -40216,7 +40216,7 @@ int sync__channel_select(Array_sync__Channel_ptr* channels, Array_sync__Directio
// assert // assert
if (!(dir.len == objrefs->len)) { if (!(dir.len == objrefs->len)) {
VAssertMetaInfo v_assert_meta_info__t2 = {0}; VAssertMetaInfo v_assert_meta_info__t2 = {0};
v_assert_meta_info__t2.fpath = _SLIT("/woodpecker/src/git.rustybever.be/Chewing_Bever/v/vlib/sync/channels.c.v"); v_assert_meta_info__t2.fpath = _SLIT("/woodpecker/src/git.rustybever.be/vieter/v/vlib/sync/channels.c.v");
v_assert_meta_info__t2.line_nr = 551; v_assert_meta_info__t2.line_nr = 551;
v_assert_meta_info__t2.fn_name = _SLIT("sync.channel_select"); v_assert_meta_info__t2.fn_name = _SLIT("sync.channel_select");
v_assert_meta_info__t2.src = _SLIT("dir.len == objrefs.len"); v_assert_meta_info__t2.src = _SLIT("dir.len == objrefs.len");
@ -40690,7 +40690,7 @@ VV_LOCAL_SYMBOL string help__known_topics(string topicdir) {
array_push((array*)&_t3, &ti); array_push((array*)&_t3, &ti);
} }
Array_string topics =_t3; Array_string topics =_t3;
qsort(topics.data, topics.len, topics.element_size, (int (*)(const void *, const void *))&compare_10452767129756656329_string); qsort(topics.data, topics.len, topics.element_size, (int (*)(const void *, const void *))&compare_1468091262560489642_string);
array_push((array*)&res, _MOV((string[]){ string_clone(Array_string_join(topics, _SLIT(", "))) })); array_push((array*)&res, _MOV((string[]){ string_clone(Array_string_join(topics, _SLIT(", "))) }));
array_push((array*)&res, _MOV((string[]){ string_clone(_SLIT(".")) })); array_push((array*)&res, _MOV((string[]){ string_clone(_SLIT(".")) }));
string _t7 = Array_string_join(res, _SLIT("")); string _t7 = Array_string_join(res, _SLIT(""));
@ -41187,7 +41187,7 @@ void v__util__Suggestion_add_many(v__util__Suggestion* s, Array_string many) {
} }
void v__util__Suggestion_sort(v__util__Suggestion* s) { void v__util__Suggestion_sort(v__util__Suggestion* s) {
qsort(s->known.data, s->known.len, s->known.element_size, (int (*)(const void *, const void *))&compare_6907021362050549619_v__util__Possibility_by_similarity); qsort(s->known.data, s->known.len, s->known.element_size, (int (*)(const void *, const void *))&compare_15123029833316296960_v__util__Possibility_by_similarity);
} }
string v__util__Suggestion_say(v__util__Suggestion s, string msg) { string v__util__Suggestion_say(v__util__Suggestion s, string msg) {
@ -41216,7 +41216,7 @@ string v__util__Suggestion_say(v__util__Suggestion s, string msg) {
array_push((array*)&_t1, &ti); array_push((array*)&_t1, &ti);
} }
Array_string values =_t1; Array_string values =_t1;
qsort(values.data, values.len, values.element_size, (int (*)(const void *, const void *))&compare_6907021362050549619_string); qsort(values.data, values.len, values.element_size, (int (*)(const void *, const void *))&compare_15123029833316296960_string);
if (values.len == 1) { if (values.len == 1) {
res = /*f*/string__plus(res, str_intp(2, _MOV((StrIntpData[]){{_SLIT(".\n1 possibility: "), /*115 &string*/0xfe10, {.d_s = (*(string*)/*ee elem_sym */array_get(values, 0))}}, {_SLIT("."), 0, { .d_c = 0 }}}))); res = /*f*/string__plus(res, str_intp(2, _MOV((StrIntpData[]){{_SLIT(".\n1 possibility: "), /*115 &string*/0xfe10, {.d_s = (*(string*)/*ee elem_sym */array_get(values, 0))}}, {_SLIT("."), 0, { .d_c = 0 }}})));
} else if (values.len < 25) { } else if (values.len < 25) {
@ -50521,137 +50521,141 @@ bool v__checker__Checker_check_types(v__checker__Checker* c, v__ast__Type got, v
bool got_is_ptr = v__ast__Type_is_ptr(got); bool got_is_ptr = v__ast__Type_is_ptr(got);
bool exp_is_ptr = v__ast__Type_is_ptr(expected); bool exp_is_ptr = v__ast__Type_is_ptr(expected);
if (c->pref->translated) { if (c->pref->translated) {
if (v__ast__Type_alias_eq(expected, _const_v__ast__byteptr_type)) { if (v__ast__Type_is_int(expected) && v__ast__Type_is_int(got)) {
bool _t2 = true; bool _t2 = true;
return _t2; return _t2;
} }
if (v__ast__Type_alias_eq(expected, _const_v__ast__voidptr_type)) { if (v__ast__Type_alias_eq(expected, _const_v__ast__byteptr_type)) {
bool _t3 = true; bool _t3 = true;
return _t3; return _t3;
} }
if (v__ast__Type_alias_eq(expected, _const_v__ast__bool_type) && (v__ast__Type_is_any_kind_of_pointer(got) || v__ast__Type_is_int(got))) { if (v__ast__Type_alias_eq(expected, _const_v__ast__voidptr_type)) {
bool _t4 = true; bool _t4 = true;
return _t4; return _t4;
} }
if (v__ast__Type_alias_eq(expected, _const_v__ast__bool_type) && (v__ast__Type_is_any_kind_of_pointer(got) || v__ast__Type_is_int(got))) {
bool _t5 = true;
return _t5;
}
if (v__ast__Type_is_any_kind_of_pointer(expected)) { if (v__ast__Type_is_any_kind_of_pointer(expected)) {
v__ast__Type deref = v__ast__Type_deref(expected); v__ast__Type deref = v__ast__Type_deref(expected);
v__ast__TypeSymbol* got_sym = v__ast__Table_sym(c->table, got); v__ast__TypeSymbol* got_sym = v__ast__Table_sym(c->table, got);
if (v__ast__Type_is_number(deref) && (v__ast__TypeSymbol_is_number(got_sym) || got_sym->kind == v__ast__Kind__enum_)) { if (v__ast__Type_is_number(deref) && (v__ast__TypeSymbol_is_number(got_sym) || got_sym->kind == v__ast__Kind__enum_)) {
bool _t5 = true; bool _t6 = true;
return _t5; return _t6;
} }
} }
if ((v__ast__Type_alias_eq(expected, _const_v__ast__rune_type) && v__ast__Type_is_int(got)) || (v__ast__Type_alias_eq(got, _const_v__ast__rune_type) && v__ast__Type_is_int(expected))) { if ((v__ast__Type_alias_eq(expected, _const_v__ast__rune_type) && v__ast__Type_is_int(got)) || (v__ast__Type_alias_eq(got, _const_v__ast__rune_type) && v__ast__Type_is_int(expected))) {
bool _t6 = true; bool _t7 = true;
return _t6; return _t7;
} }
v__ast__TypeSymbol* got_sym = v__ast__Table_sym(c->table, got); v__ast__TypeSymbol* got_sym = v__ast__Table_sym(c->table, got);
v__ast__TypeSymbol* expected_sym = v__ast__Table_sym(c->table, expected); v__ast__TypeSymbol* expected_sym = v__ast__Table_sym(c->table, expected);
if (got_sym->kind == v__ast__Kind__enum_) { if (got_sym->kind == v__ast__Kind__enum_) {
if (v__ast__TypeSymbol_is_number(expected_sym)) { if (v__ast__TypeSymbol_is_number(expected_sym)) {
bool _t7 = true; bool _t8 = true;
return _t7; return _t8;
} }
} else if (got_sym->kind == v__ast__Kind__array_fixed) { } else if (got_sym->kind == v__ast__Kind__array_fixed) {
if (v__ast__TypeSymbol_is_number(expected_sym)) { if (v__ast__TypeSymbol_is_number(expected_sym)) {
bool _t8 = true;
return _t8;
} else if (v__ast__Type_is_any_kind_of_pointer(expected)) {
bool _t9 = true; bool _t9 = true;
return _t9; return _t9;
} else if (v__ast__Type_is_any_kind_of_pointer(expected)) {
bool _t10 = true;
return _t10;
} }
} else if (expected_sym->kind == v__ast__Kind__array_fixed) { } 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 (v__ast__TypeSymbol_is_number(got_sym) && v__ast__Type_is_any_kind_of_pointer(got)) {
bool _t10 = true; bool _t11 = true;
return _t10; return _t11;
} else if (got_sym->kind == v__ast__Kind__array) { } 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, 440) /*expected idx: 440, name: v.ast.ArrayFixed */ ; v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 440) /*expected idx: 440, name: v.ast.ArrayFixed */ ;
v__ast__Array info2 = /* as */ *(v__ast__Array*)__as_cast((got_sym->info)._v__ast__Array,(got_sym->info)._typ, 412) /*expected idx: 412, name: v.ast.Array */ ; v__ast__Array info2 = /* as */ *(v__ast__Array*)__as_cast((got_sym->info)._v__ast__Array,(got_sym->info)._typ, 412) /*expected idx: 412, name: v.ast.Array */ ;
if (v__checker__Checker_check_types(c, info.elem_type, info2.elem_type)) { if (v__checker__Checker_check_types(c, info.elem_type, info2.elem_type)) {
bool _t11 = true; bool _t12 = true;
return _t11; return _t12;
} }
} }
} }
if (expected_sym->kind == v__ast__Kind__enum_ && v__ast__TypeSymbol_is_number(got_sym)) { if (expected_sym->kind == v__ast__Kind__enum_ && v__ast__TypeSymbol_is_number(got_sym)) {
bool _t12 = true; bool _t13 = true;
return _t12; return _t13;
} }
if (got_is_ptr && exp_is_ptr) { if (got_is_ptr && exp_is_ptr) {
if (v__ast__TypeSymbol_is_number(expected_sym) && v__ast__TypeSymbol_is_number(got_sym)) { if (v__ast__TypeSymbol_is_number(expected_sym) && v__ast__TypeSymbol_is_number(got_sym)) {
bool _t13 = true; bool _t14 = true;
return _t13; return _t14;
} }
} }
} }
if (got_is_ptr && exp_is_ptr) { if (got_is_ptr && exp_is_ptr) {
if (v__ast__Type_nr_muls(got) != v__ast__Type_nr_muls(expected)) { if (v__ast__Type_nr_muls(got) != v__ast__Type_nr_muls(expected)) {
bool _t14 = false; bool _t15 = false;
return _t14; return _t15;
} }
} }
int exp_idx = v__ast__Type_idx(expected); int exp_idx = v__ast__Type_idx(expected);
int got_idx = v__ast__Type_idx(got); int got_idx = v__ast__Type_idx(got);
if (exp_idx == got_idx) { if (exp_idx == got_idx) {
bool _t15 = true;
return _t15;
}
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 _t16 = true; bool _t16 = true;
return _t16; return _t16;
} }
} 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_real_pointer(expected)) { if (v__ast__Type_is_ptr(got) || v__ast__Type_is_pointer(got)) {
if (v__ast__Type_alias_eq(got, _const_v__ast__int_literal_type)) {
bool _t17 = true; bool _t17 = true;
return _t17; return _t17;
} }
} }
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_real_pointer(expected)) {
if (v__ast__Type_is_ptr(expected) || v__ast__Type_is_pointer(expected)) { if (v__ast__Type_alias_eq(got, _const_v__ast__int_literal_type)) {
bool _t18 = true; bool _t18 = true;
return _t18; return _t18;
} }
} }
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))) { 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 _t19 = true; bool _t19 = true;
return _t19; return _t19;
} }
}
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 _t20 = true;
return _t20;
}
if (v__ast__Type_has_flag(expected, v__ast__TypeFlag__optional) || v__ast__Type_has_flag(expected, v__ast__TypeFlag__result)) { 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); 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))) { 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 _t20 = true; bool _t21 = true;
return _t20;
} 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 _t21 = false;
return _t21; return _t21;
} } 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))) {
}
if (!v__checker__Checker_check_basic(c, got, expected)) {
bool _t22 = false; bool _t22 = false;
return _t22; return _t22;
} }
}
if (!v__checker__Checker_check_basic(c, got, expected)) {
bool _t23 = false;
return _t23;
}
if (v__ast__Type_is_number(got) && v__ast__Type_is_number(expected)) { 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)) { if (v__ast__Type_alias_eq(got, _const_v__ast__rune_type) && v__ast__Type_alias_eq(expected, _const_v__ast__byte_type)) {
bool _t23 = true;
return _t23;
} 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 _t24 = true; bool _t24 = true;
return _t24; return _t24;
} } else if (v__ast__Type_alias_eq(expected, _const_v__ast__rune_type) && v__ast__Type_alias_eq(got, _const_v__ast__byte_type)) {
if (!v__ast__Type_alias_eq(v__checker__Checker_promote_num(c, expected, got), expected)) { bool _t25 = true;
bool _t25 = false;
return _t25; return _t25;
} }
} if (!v__ast__Type_alias_eq(v__checker__Checker_promote_num(c, expected, got), expected)) {
if (v__ast__Type_has_flag(expected, v__ast__TypeFlag__generic)) {
bool _t26 = false; bool _t26 = false;
return _t26; return _t26;
} }
bool _t27 = true; }
if (v__ast__Type_has_flag(expected, v__ast__TypeFlag__generic)) {
bool _t27 = false;
return _t27; return _t27;
} }
bool _t28 = true;
return _t28;
}
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) { 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) {
if (got == 0) { if (got == 0) {
@ -50998,10 +51002,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_hi = left_type;
v__ast__Type type_lo = right_type; v__ast__Type type_lo = right_type;
if (v__ast__Type_idx(type_hi) < v__ast__Type_idx(type_lo)) { if (v__ast__Type_idx(type_hi) < v__ast__Type_idx(type_lo)) {
v__ast__Type _var_17710 = type_hi; v__ast__Type _var_17770 = type_hi;
v__ast__Type _var_17719 = type_lo; v__ast__Type _var_17779 = type_lo;
type_hi = _var_17719; type_hi = _var_17779;
type_lo = _var_17710; type_lo = _var_17770;
} }
int idx_hi = v__ast__Type_idx(type_hi); int idx_hi = v__ast__Type_idx(type_hi);
int idx_lo = v__ast__Type_idx(type_lo); int idx_lo = v__ast__Type_idx(type_lo);
@ -59230,6 +59234,9 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp
if (v__ast__Type_alias_eq(arg_typ, _const_v__ast__int_type) && param_typ_sym->kind == v__ast__Kind__enum_) { if (v__ast__Type_alias_eq(arg_typ, _const_v__ast__int_type) && param_typ_sym->kind == v__ast__Kind__enum_) {
continue; continue;
} }
if ((v__ast__Type_alias_eq(arg_typ, _const_v__ast__bool_type) && v__ast__Type_is_int(param.typ)) || (v__ast__Type_is_int(arg_typ) && v__ast__Type_alias_eq(param.typ, _const_v__ast__bool_type))) {
continue;
}
bool param_is_number = v__ast__Type_is_number(param.typ); bool param_is_number = v__ast__Type_is_number(param.typ);
if (v__ast__Type_is_ptr(param.typ)) { if (v__ast__Type_is_ptr(param.typ)) {
param_is_number = v__ast__Type_is_number(v__ast__Type_deref(param.typ)); param_is_number = v__ast__Type_is_number(v__ast__Type_deref(param.typ));
@ -59244,7 +59251,7 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp
if (param.typ == _const_v__ast__voidptr_type_idx || arg_typ == _const_v__ast__voidptr_type_idx) { if (param.typ == _const_v__ast__voidptr_type_idx || arg_typ == _const_v__ast__voidptr_type_idx) {
continue; continue;
} }
if ((arg_typ_sym->kind == v__ast__Kind__array_fixed && param_is_number) || (param_typ_sym->kind == v__ast__Kind__array_fixed && typ_is_number)) { if ((arg_typ_sym->kind == v__ast__Kind__array_fixed && (param_is_number || v__ast__Type_is_any_kind_of_pointer(param.typ))) || (param_typ_sym->kind == v__ast__Kind__array_fixed && (typ_is_number || v__ast__Type_is_any_kind_of_pointer(arg_typ)))) {
continue; continue;
} }
if (v__ast__Type_is_any_kind_of_pointer(param.typ) && typ_is_number) { if (v__ast__Type_is_any_kind_of_pointer(param.typ) && typ_is_number) {
@ -59346,12 +59353,6 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
v__ast__Type left_type = v__checker__Checker_expr(c, node->left); v__ast__Type left_type = v__checker__Checker_expr(c, node->left);
c->expected_type = left_type; c->expected_type = left_type;
bool is_generic = v__ast__Type_has_flag(left_type, v__ast__TypeFlag__generic); bool is_generic = v__ast__Type_has_flag(left_type, v__ast__TypeFlag__generic);
if (is_generic && node->concrete_types.len == 0) {
v__ast__TypeSymbol* rec_sym = v__ast__Table_sym(c->table, left_type);
if ((rec_sym->info)._typ == 417 /* v.ast.Struct */) {
node->concrete_types = (*rec_sym->info._v__ast__Struct).generic_types;
}
}
node->left_type = left_type; node->left_type = left_type;
node->return_type = left_type; node->return_type = left_type;
node->receiver_type = left_type; node->receiver_type = left_type;
@ -59391,51 +59392,37 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
v__ast__Type _t6 = _const_v__ast__void_type; v__ast__Type _t6 = _const_v__ast__void_type;
return _t6; return _t6;
} }
Array_v__ast__Type concrete_types = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0);
for (int _t7 = 0; _t7 < node->concrete_types.len; ++_t7) {
v__ast__Type concrete_type = ((v__ast__Type*)node->concrete_types.data)[_t7];
if (v__ast__Type_has_flag(concrete_type, v__ast__TypeFlag__generic)) {
array_push((array*)&concrete_types, _MOV((v__ast__Type[]){ v__checker__Checker_unwrap_generic(c, concrete_type) }));
} else {
array_push((array*)&concrete_types, _MOV((v__ast__Type[]){ concrete_type }));
}
}
if (concrete_types.len > 0) {
if (v__ast__Table_register_fn_concrete_types(c->table, v__ast__CallExpr_fkey(node), concrete_types)) {
c->need_recheck_generic_fns = true;
}
}
if (left_sym->kind == v__ast__Kind__array && Array_string_contains(_const_v__checker__array_builtin_methods, method_name)) { if (left_sym->kind == v__ast__Kind__array && Array_string_contains(_const_v__checker__array_builtin_methods, method_name)) {
v__ast__Type _t10 = v__checker__Checker_array_builtin_method_call(c, node, left_type, *v__ast__Table_sym(c->table, left_type)); v__ast__Type _t7 = v__checker__Checker_array_builtin_method_call(c, node, left_type, *v__ast__Table_sym(c->table, left_type));
return _t10; return _t7;
} else if ((left_sym->kind == v__ast__Kind__map || final_left_sym->kind == v__ast__Kind__map) && (string__eq(method_name, _SLIT("clone")) || string__eq(method_name, _SLIT("keys")) || string__eq(method_name, _SLIT("move")) || string__eq(method_name, _SLIT("delete")))) { } else if ((left_sym->kind == v__ast__Kind__map || final_left_sym->kind == v__ast__Kind__map) && (string__eq(method_name, _SLIT("clone")) || string__eq(method_name, _SLIT("keys")) || string__eq(method_name, _SLIT("move")) || string__eq(method_name, _SLIT("delete")))) {
if (left_sym->kind == v__ast__Kind__map) { if (left_sym->kind == v__ast__Kind__map) {
v__ast__Type _t11 = v__checker__Checker_map_builtin_method_call(c, node, left_type, *left_sym); v__ast__Type _t8 = v__checker__Checker_map_builtin_method_call(c, node, left_type, *left_sym);
return _t11; return _t8;
} else { } else {
v__ast__Type parent_type = (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 432) /*expected idx: 432, name: v.ast.Alias */ ).parent_type; v__ast__Type parent_type = (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 432) /*expected idx: 432, name: v.ast.Alias */ ).parent_type;
v__ast__Type _t12 = v__checker__Checker_map_builtin_method_call(c, node, parent_type, *final_left_sym); v__ast__Type _t9 = v__checker__Checker_map_builtin_method_call(c, node, parent_type, *final_left_sym);
return _t12; return _t9;
} }
} else if (left_sym->kind == v__ast__Kind__array && (string__eq(method_name, _SLIT("insert")) || string__eq(method_name, _SLIT("prepend")))) { } else if (left_sym->kind == v__ast__Kind__array && (string__eq(method_name, _SLIT("insert")) || string__eq(method_name, _SLIT("prepend")))) {
if (string__eq(method_name, _SLIT("insert"))) { if (string__eq(method_name, _SLIT("insert"))) {
if (node->args.len != 2) { if (node->args.len != 2) {
v__checker__Checker_error(c, _SLIT("`array.insert()` should have 2 arguments, e.g. `insert(1, val)`"), node->pos); v__checker__Checker_error(c, _SLIT("`array.insert()` should have 2 arguments, e.g. `insert(1, val)`"), node->pos);
v__ast__Type _t13 = _const_v__ast__void_type; v__ast__Type _t10 = _const_v__ast__void_type;
return _t13; return _t10;
} else { } else {
v__ast__Type arg_type = v__checker__Checker_expr(c, (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr); v__ast__Type arg_type = v__checker__Checker_expr(c, (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr);
if (!(v__ast__Type_alias_eq(arg_type, _const_v__ast__int_type) || v__ast__Type_alias_eq(arg_type, _const_v__ast__int_literal_type))) { if (!(v__ast__Type_alias_eq(arg_type, _const_v__ast__int_type) || v__ast__Type_alias_eq(arg_type, _const_v__ast__int_literal_type))) {
v__checker__Checker_error(c, _SLIT("the first argument of `array.insert()` should be integer"), v__ast__Expr_pos((*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr)); v__checker__Checker_error(c, _SLIT("the first argument of `array.insert()` should be integer"), v__ast__Expr_pos((*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr));
v__ast__Type _t14 = _const_v__ast__void_type; v__ast__Type _t11 = _const_v__ast__void_type;
return _t14; return _t11;
} }
} }
} else { } else {
if (node->args.len != 1) { if (node->args.len != 1) {
v__checker__Checker_error(c, _SLIT("`array.prepend()` should have 1 argument, e.g. `prepend(val)`"), node->pos); v__checker__Checker_error(c, _SLIT("`array.prepend()` should have 1 argument, e.g. `prepend(val)`"), node->pos);
v__ast__Type _t15 = _const_v__ast__void_type; v__ast__Type _t12 = _const_v__ast__void_type;
return _t15; return _t12;
} }
} }
v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((left_sym->info)._v__ast__Array,(left_sym->info)._typ, 412) /*expected idx: 412, name: v.ast.Array */ ; v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((left_sym->info)._v__ast__Array,(left_sym->info)._typ, 412) /*expected idx: 412, name: v.ast.Array */ ;
@ -59448,8 +59435,8 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
} else if (final_left_sym->kind == v__ast__Kind__array && (string__eq(method_name, _SLIT("first")) || string__eq(method_name, _SLIT("last")) || string__eq(method_name, _SLIT("pop")))) { } else if (final_left_sym->kind == v__ast__Kind__array && (string__eq(method_name, _SLIT("first")) || string__eq(method_name, _SLIT("last")) || string__eq(method_name, _SLIT("pop")))) {
if ((final_left_sym->info)._typ == 412 /* v.ast.Array */) { if ((final_left_sym->info)._typ == 412 /* v.ast.Array */) {
node->return_type = (*final_left_sym->info._v__ast__Array).elem_type; node->return_type = (*final_left_sym->info._v__ast__Array).elem_type;
v__ast__Type _t16 = node->return_type; v__ast__Type _t13 = node->return_type;
return _t16; return _t13;
} }
} else if (v__pref__Backend_is_js(c->pref->backend) && string_starts_with(left_sym->name, _SLIT("Promise<")) && string__eq(method_name, _SLIT("wait"))) { } else if (v__pref__Backend_is_js(c->pref->backend) && string_starts_with(left_sym->name, _SLIT("Promise<")) && string__eq(method_name, _SLIT("wait"))) {
v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((left_sym->info)._v__ast__Struct,(left_sym->info)._typ, 417) /*expected idx: 417, name: v.ast.Struct */ ; v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((left_sym->info)._v__ast__Struct,(left_sym->info)._typ, 417) /*expected idx: 417, name: v.ast.Struct */ ;
@ -59459,31 +59446,31 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
c->table->cur_fn->has_await = true; c->table->cur_fn->has_await = true;
node->return_type = (*(v__ast__Type*)/*ee elem_sym */array_get(info.concrete_types, 0)); node->return_type = (*(v__ast__Type*)/*ee elem_sym */array_get(info.concrete_types, 0));
v__ast__Type_set_flag(node->return_type, v__ast__TypeFlag__optional); v__ast__Type_set_flag(node->return_type, v__ast__TypeFlag__optional);
v__ast__Type _t17 = node->return_type; v__ast__Type _t14 = node->return_type;
return _t17; return _t14;
} else if (left_sym->kind == v__ast__Kind__thread && string__eq(method_name, _SLIT("wait"))) { } else if (left_sym->kind == v__ast__Kind__thread && string__eq(method_name, _SLIT("wait"))) {
v__ast__Thread info = /* as */ *(v__ast__Thread*)__as_cast((left_sym->info)._v__ast__Thread,(left_sym->info)._typ, 442) /*expected idx: 442, name: v.ast.Thread */ ; v__ast__Thread info = /* as */ *(v__ast__Thread*)__as_cast((left_sym->info)._v__ast__Thread,(left_sym->info)._typ, 442) /*expected idx: 442, name: v.ast.Thread */ ;
if (node->args.len > 0) { if (node->args.len > 0) {
v__checker__Checker_error(c, _SLIT("wait() does not have any arguments"), (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).pos); v__checker__Checker_error(c, _SLIT("wait() does not have any arguments"), (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).pos);
} }
node->return_type = info.return_type; node->return_type = info.return_type;
v__ast__Type _t18 = info.return_type; v__ast__Type _t15 = info.return_type;
return _t18; return _t15;
} else if (left_sym->kind == v__ast__Kind__char && v__ast__Type_nr_muls(left_type) == 0 && string__eq(method_name, _SLIT("str"))) { } else if (left_sym->kind == v__ast__Kind__char && v__ast__Type_nr_muls(left_type) == 0 && string__eq(method_name, _SLIT("str"))) {
v__checker__Checker_error(c, _SLIT("calling `.str()` on type `char` is not allowed, use its address or cast it to an integer instead"), v__token__Pos_extend(v__ast__Expr_pos(node->left), node->pos)); v__checker__Checker_error(c, _SLIT("calling `.str()` on type `char` is not allowed, use its address or cast it to an integer instead"), v__token__Pos_extend(v__ast__Expr_pos(node->left), node->pos));
v__ast__Type _t19 = _const_v__ast__void_type; v__ast__Type _t16 = _const_v__ast__void_type;
return _t19; return _t16;
} }
v__ast__Fn method = ((v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.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,.usages = 0,.ctdefine_idx = 0,.source_fn = 0,.language = 0,.file_mode = 0,.is_variadic = 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,.is_conditional = 0,}); v__ast__Fn method = ((v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.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,.usages = 0,.ctdefine_idx = 0,.source_fn = 0,.language = 0,.file_mode = 0,.is_variadic = 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,.is_conditional = 0,});
bool has_method = false; bool has_method = false;
bool is_method_from_embed = false; bool is_method_from_embed = false;
Option_v__ast__Fn _t20; Option_v__ast__Fn _t17;
if (_t20 = v__ast__Table_find_method(c->table, left_sym, method_name), _t20.state == 0) { if (_t17 = v__ast__Table_find_method(c->table, left_sym, method_name), _t17.state == 0) {
v__ast__Fn m = *(v__ast__Fn*)_t20.data; v__ast__Fn m = *(v__ast__Fn*)_t17.data;
method = m; method = m;
has_method = true; has_method = true;
} else { } else {
IError err = _t20.err; IError err = _t17.err;
if (left_sym->kind == v__ast__Kind__struct_ || left_sym->kind == v__ast__Kind__sum_type || left_sym->kind == v__ast__Kind__interface_) { if (left_sym->kind == v__ast__Kind__struct_ || left_sym->kind == v__ast__Kind__sum_type || left_sym->kind == v__ast__Kind__interface_) {
v__ast__Type parent_type = _const_v__ast__void_type; v__ast__Type parent_type = _const_v__ast__void_type;
if ((left_sym->info)._typ == 417 /* v.ast.Struct */) { if ((left_sym->info)._typ == 417 /* v.ast.Struct */) {
@ -59495,9 +59482,9 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
} }
if (parent_type != 0) { if (parent_type != 0) {
v__ast__TypeSymbol* type_sym = v__ast__Table_sym(c->table, parent_type); v__ast__TypeSymbol* type_sym = v__ast__Table_sym(c->table, parent_type);
Option_v__ast__Fn _t21; Option_v__ast__Fn _t18;
if (_t21 = v__ast__Table_find_method(c->table, type_sym, method_name), _t21.state == 0) { if (_t18 = v__ast__Table_find_method(c->table, type_sym, method_name), _t18.state == 0) {
v__ast__Fn m = *(v__ast__Fn*)_t21.data; v__ast__Fn m = *(v__ast__Fn*)_t18.data;
method = m; method = m;
has_method = true; has_method = true;
is_generic = true; is_generic = true;
@ -59507,19 +59494,19 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
if (!has_method) { if (!has_method) {
has_method = true; has_method = true;
Array_v__ast__Type embed_types = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0); Array_v__ast__Type embed_types = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0);
Option_multi_return_v__ast__Fn_Array_v__ast__Type _t22 = v__ast__Table_find_method_from_embeds(c->table, left_sym, method_name); Option_multi_return_v__ast__Fn_Array_v__ast__Type _t19 = v__ast__Table_find_method_from_embeds(c->table, left_sym, method_name);
if (_t22.state != 0) { /*or block*/ if (_t19.state != 0) { /*or block*/
IError err = _t22.err; IError err = _t19.err;
if ((IError_name_table[err._typ]._method_msg(err._object)).len != 0) { if ((IError_name_table[err._typ]._method_msg(err._object)).len != 0) {
v__checker__Checker_error(c, IError_name_table[err._typ]._method_msg(err._object), node->pos); v__checker__Checker_error(c, IError_name_table[err._typ]._method_msg(err._object), node->pos);
} }
has_method = false; has_method = false;
*(multi_return_v__ast__Fn_Array_v__ast__Type*) _t22.data = (multi_return_v__ast__Fn_Array_v__ast__Type){.arg0=((v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.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,.usages = 0,.ctdefine_idx = 0,.source_fn = 0,.language = 0,.file_mode = 0,.is_variadic = 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,.is_conditional = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; *(multi_return_v__ast__Fn_Array_v__ast__Type*) _t19.data = (multi_return_v__ast__Fn_Array_v__ast__Type){.arg0=((v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.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,.usages = 0,.ctdefine_idx = 0,.source_fn = 0,.language = 0,.file_mode = 0,.is_variadic = 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,.is_conditional = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)};
} }
multi_return_v__ast__Fn_Array_v__ast__Type mr_42797 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t22.data); multi_return_v__ast__Fn_Array_v__ast__Type mr_42435 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t19.data);
method = mr_42797.arg0; method = mr_42435.arg0;
embed_types = mr_42797.arg1; embed_types = mr_42435.arg1;
if (embed_types.len != 0) { if (embed_types.len != 0) {
is_method_from_embed = true; is_method_from_embed = true;
node->from_embed_types = embed_types; node->from_embed_types = embed_types;
@ -59530,6 +59517,31 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
} }
} }
if (has_method) { if (has_method) {
v__ast__TypeSymbol* rec_sym = v__ast__Table_sym(c->table, node->left_type);
bool rec_is_generic = v__ast__Type_has_flag(left_type, v__ast__TypeFlag__generic);
if ((rec_sym->info)._typ == 417 /* v.ast.Struct */) {
if (rec_is_generic && node->concrete_types.len == 0) {
node->concrete_types = (*rec_sym->info._v__ast__Struct).generic_types;
} else if (!rec_is_generic && (*rec_sym->info._v__ast__Struct).concrete_types.len > 0 && node->concrete_types.len > 0 && (*rec_sym->info._v__ast__Struct).concrete_types.len + node->concrete_types.len == method.generic_names.len) {
Array_v__ast__Type t_concrete_types = array_clone_to_depth(&node->concrete_types, 0);
node->concrete_types = (*rec_sym->info._v__ast__Struct).concrete_types;
_PUSH_MANY(&node->concrete_types, (t_concrete_types), _t20, Array_v__ast__Type);
}
}
Array_v__ast__Type concrete_types = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0);
for (int _t21 = 0; _t21 < node->concrete_types.len; ++_t21) {
v__ast__Type concrete_type = ((v__ast__Type*)node->concrete_types.data)[_t21];
if (v__ast__Type_has_flag(concrete_type, v__ast__TypeFlag__generic)) {
array_push((array*)&concrete_types, _MOV((v__ast__Type[]){ v__checker__Checker_unwrap_generic(c, concrete_type) }));
} else {
array_push((array*)&concrete_types, _MOV((v__ast__Type[]){ concrete_type }));
}
}
if (concrete_types.len > 0) {
if (v__ast__Table_register_fn_concrete_types(c->table, v__ast__CallExpr_fkey(node), concrete_types)) {
c->need_recheck_generic_fns = true;
}
}
node->is_noreturn = method.is_noreturn; node->is_noreturn = method.is_noreturn;
node->is_ctor_new = method.is_ctor_new; node->is_ctor_new = method.is_ctor_new;
if (!method.is_pub && !c->pref->is_test && !string__eq(method.mod, c->mod)) { if (!method.is_pub && !c->pref->is_test && !string__eq(method.mod, c->mod)) {
@ -59540,9 +59552,9 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
v__checker__Checker_error(c, _SLIT("method with `shared` receiver cannot be called inside `lock`/`rlock` block"), node->pos); v__checker__Checker_error(c, _SLIT("method with `shared` receiver cannot be called inside `lock`/`rlock` block"), node->pos);
} }
if ((*(v__ast__Param*)/*ee elem_sym */array_get(method.params, 0)).is_mut) { if ((*(v__ast__Param*)/*ee elem_sym */array_get(method.params, 0)).is_mut) {
multi_return_string_v__token__Pos mr_43928 = v__checker__Checker_fail_if_immutable(c, node->left); multi_return_string_v__token__Pos mr_44578 = v__checker__Checker_fail_if_immutable(c, node->left);
string to_lock = mr_43928.arg0; string to_lock = mr_44578.arg0;
v__token__Pos pos = mr_43928.arg1; v__token__Pos pos = mr_44578.arg1;
if (!v__ast__Expr_is_lvalue(node->left)) { if (!v__ast__Expr_is_lvalue(node->left)) {
v__checker__Checker_error(c, _SLIT("cannot pass expression as `mut`"), v__ast__Expr_pos(node->left)); v__checker__Checker_error(c, _SLIT("cannot pass expression as `mut`"), v__ast__Expr_pos(node->left));
} }
@ -59559,11 +59571,11 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
string plural = (method.generic_names.len == 1 ? (_SLIT("")) : (_SLIT("s"))); string plural = (method.generic_names.len == 1 ? (_SLIT("")) : (_SLIT("s")));
v__checker__Checker_error(c, str_intp(4, _MOV((StrIntpData[]){{_SLIT("expected "), /*100 &int*/0xfe07, {.d_i32 = method.generic_names.len}}, {_SLIT(" generic parameter"), /*115 &string*/0xfe10, {.d_s = plural}}, {_SLIT(", got "), /*100 &int*/0xfe07, {.d_i32 = node->concrete_types.len}}, {_SLIT0, 0, { .d_c = 0 }}})), node->concrete_list_pos); v__checker__Checker_error(c, str_intp(4, _MOV((StrIntpData[]){{_SLIT("expected "), /*100 &int*/0xfe07, {.d_i32 = method.generic_names.len}}, {_SLIT(" generic parameter"), /*115 &string*/0xfe10, {.d_s = plural}}, {_SLIT(", got "), /*100 &int*/0xfe07, {.d_i32 = node->concrete_types.len}}, {_SLIT0, 0, { .d_c = 0 }}})), node->concrete_list_pos);
} }
for (int _t23 = 0; _t23 < node->concrete_types.len; ++_t23) { for (int _t24 = 0; _t24 < node->concrete_types.len; ++_t24) {
v__ast__Type concrete_type = ((v__ast__Type*)node->concrete_types.data)[_t23]; v__ast__Type concrete_type = ((v__ast__Type*)node->concrete_types.data)[_t24];
Option_void _t24 = v__checker__Checker_ensure_type_exists(c, concrete_type, node->concrete_list_pos); Option_void _t25 = v__checker__Checker_ensure_type_exists(c, concrete_type, node->concrete_list_pos);
if (_t24.state != 0 && _t24.err._typ != _IError_None___index) { if (_t25.state != 0 && _t25.err._typ != _IError_None___index) {
IError err = _t24.err; IError err = _t25.err;
} }
; ;
@ -59571,11 +59583,11 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
if (v__ast__Type_alias_eq(method.return_type, _const_v__ast__void_type) && method.is_conditional && method.ctdefine_idx != _const_v__ast__invalid_type_idx) { if (v__ast__Type_alias_eq(method.return_type, _const_v__ast__void_type) && method.is_conditional && method.ctdefine_idx != _const_v__ast__invalid_type_idx) {
node->should_be_skipped = v__checker__Checker_evaluate_once_comptime_if_attribute(c, (voidptr)&/*qq*/(*(v__ast__Attr*)/*ee elem_sym */array_get(method.attrs, method.ctdefine_idx))); node->should_be_skipped = v__checker__Checker_evaluate_once_comptime_if_attribute(c, (voidptr)&/*qq*/(*(v__ast__Attr*)/*ee elem_sym */array_get(method.attrs, method.ctdefine_idx)));
} }
Option_void _t25 = v__checker__Checker_check_expected_arg_count(c, node, (voidptr)&/*qq*/method); Option_void _t26 = v__checker__Checker_check_expected_arg_count(c, node, (voidptr)&/*qq*/method);
if (_t25.state != 0 && _t25.err._typ != _IError_None___index) { if (_t26.state != 0 && _t26.err._typ != _IError_None___index) {
IError err = _t25.err; IError err = _t26.err;
v__ast__Type _t26 = method.return_type; v__ast__Type _t27 = method.return_type;
return _t26; return _t27;
} }
; ;
@ -59618,21 +59630,21 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
final_arg_sym = v__ast__Table_sym(c->table, final_arg_typ); final_arg_sym = v__ast__Table_sym(c->table, final_arg_typ);
} }
if (v__ast__Type_has_flag(exp_arg_typ, v__ast__TypeFlag__generic)) { if (v__ast__Type_has_flag(exp_arg_typ, v__ast__TypeFlag__generic)) {
Option_v__ast__Type _t27; Option_v__ast__Type _t28;
if (_t27 = v__ast__Table_resolve_generic_to_concrete(c->table, exp_arg_typ, method.generic_names, concrete_types), _t27.state == 0) { if (_t28 = v__ast__Table_resolve_generic_to_concrete(c->table, exp_arg_typ, method.generic_names, concrete_types), _t28.state == 0) {
v__ast__Type exp_utyp = *(v__ast__Type*)_t27.data; v__ast__Type exp_utyp = *(v__ast__Type*)_t28.data;
exp_arg_typ = exp_utyp; exp_arg_typ = exp_utyp;
} else { } else {
IError err = _t27.err; IError err = _t28.err;
continue; continue;
} }
if (v__ast__Type_has_flag(got_arg_typ, v__ast__TypeFlag__generic)) { if (v__ast__Type_has_flag(got_arg_typ, v__ast__TypeFlag__generic)) {
Option_v__ast__Type _t28; Option_v__ast__Type _t29;
if (_t28 = v__ast__Table_resolve_generic_to_concrete(c->table, got_arg_typ, method.generic_names, concrete_types), _t28.state == 0) { if (_t29 = v__ast__Table_resolve_generic_to_concrete(c->table, got_arg_typ, method.generic_names, concrete_types), _t29.state == 0) {
v__ast__Type got_utyp = *(v__ast__Type*)_t28.data; v__ast__Type got_utyp = *(v__ast__Type*)_t29.data;
got_arg_typ = got_utyp; got_arg_typ = got_utyp;
} else { } else {
IError err = _t28.err; IError err = _t29.err;
continue; continue;
} }
} }
@ -59644,9 +59656,9 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
v__checker__Checker_error(c, _SLIT("method with `shared` arguments cannot be called inside `lock`/`rlock` block"), arg->pos); v__checker__Checker_error(c, _SLIT("method with `shared` arguments cannot be called inside `lock`/`rlock` block"), arg->pos);
} }
if (arg->is_mut) { if (arg->is_mut) {
multi_return_string_v__token__Pos mr_47897 = v__checker__Checker_fail_if_immutable(c, arg->expr); multi_return_string_v__token__Pos mr_48547 = v__checker__Checker_fail_if_immutable(c, arg->expr);
string to_lock = mr_47897.arg0; string to_lock = mr_48547.arg0;
v__token__Pos pos = mr_47897.arg1; v__token__Pos pos = mr_48547.arg1;
if (!param_is_mut) { if (!param_is_mut) {
string tok = v__ast__ShareType_str(arg->share); string tok = v__ast__ShareType_str(arg->share);
v__checker__Checker_error(c, str_intp(5, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = node->name}}, {_SLIT("` parameter `"), /*115 &string*/0xfe10, {.d_s = param.name}}, {_SLIT("` is not `"), /*115 &string*/0xfe10, {.d_s = tok}}, {_SLIT("`, `"), /*115 &string*/0xfe10, {.d_s = tok}}, {_SLIT("` is not needed`"), 0, { .d_c = 0 }}})), v__ast__Expr_pos(arg->expr)); v__checker__Checker_error(c, str_intp(5, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = node->name}}, {_SLIT("` parameter `"), /*115 &string*/0xfe10, {.d_s = param.name}}, {_SLIT("` is not `"), /*115 &string*/0xfe10, {.d_s = tok}}, {_SLIT("`, `"), /*115 &string*/0xfe10, {.d_s = tok}}, {_SLIT("` is not needed`"), 0, { .d_c = 0 }}})), v__ast__Expr_pos(arg->expr));
@ -59697,9 +59709,9 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
} }
continue; continue;
} }
Option_void _t29 = v__checker__Checker_check_expected_call_arg(c, got_arg_typ, exp_arg_typ, node->language, *arg); Option_void _t30 = v__checker__Checker_check_expected_call_arg(c, got_arg_typ, exp_arg_typ, node->language, *arg);
if (_t29.state != 0 && _t29.err._typ != _IError_None___index) { if (_t30.state != 0 && _t30.err._typ != _IError_None___index) {
IError err = _t29.err; IError err = _t30.err;
v__ast__TypeSymbol* param_typ_sym = v__ast__Table_sym(c->table, exp_arg_typ); v__ast__TypeSymbol* param_typ_sym = v__ast__Table_sym(c->table, exp_arg_typ);
v__ast__TypeSymbol* arg_typ_sym = v__ast__Table_sym(c->table, got_arg_typ); v__ast__TypeSymbol* arg_typ_sym = v__ast__Table_sym(c->table, got_arg_typ);
if (param_typ_sym->kind == v__ast__Kind__array && arg_typ_sym->kind == v__ast__Kind__array) { if (param_typ_sym->kind == v__ast__Kind__array && arg_typ_sym->kind == v__ast__Kind__array) {
@ -59751,12 +59763,12 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
node->return_type = method.return_type; node->return_type = method.return_type;
} }
if (node->concrete_types.len > 0 && method.return_type != 0 && c->table->cur_fn->generic_names.len == 0) { if (node->concrete_types.len > 0 && method.return_type != 0 && c->table->cur_fn->generic_names.len == 0) {
Option_v__ast__Type _t31; Option_v__ast__Type _t32;
if (_t31 = v__ast__Table_resolve_generic_to_concrete(c->table, method.return_type, method.generic_names, concrete_types), _t31.state == 0) { if (_t32 = v__ast__Table_resolve_generic_to_concrete(c->table, method.return_type, method.generic_names, concrete_types), _t32.state == 0) {
v__ast__Type typ = *(v__ast__Type*)_t31.data; v__ast__Type typ = *(v__ast__Type*)_t32.data;
node->return_type = typ; node->return_type = typ;
v__ast__Type _t32 = typ; v__ast__Type _t33 = typ;
return _t32; return _t33;
} }
} }
if (node->concrete_types.len > 0 && method.generic_names.len == 0) { if (node->concrete_types.len > 0 && method.generic_names.len == 0) {
@ -59770,12 +59782,12 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
} }
} }
} }
v__ast__Type _t33 = node->return_type; v__ast__Type _t34 = node->return_type;
return _t33;
}
v__ast__Type _t34 = method.return_type;
return _t34; return _t34;
} }
v__ast__Type _t35 = method.return_type;
return _t35;
}
if (string__eq(method_name, _SLIT("str"))) { if (string__eq(method_name, _SLIT("str"))) {
if (left_sym->kind == v__ast__Kind__interface_) { if (left_sym->kind == v__ast__Kind__interface_) {
string iname = left_sym->name; string iname = left_sym->name;
@ -59787,25 +59799,25 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
v__checker__Checker_error(c, _SLIT(".str() method calls should have no arguments"), node->pos); v__checker__Checker_error(c, _SLIT(".str() method calls should have no arguments"), node->pos);
} }
v__checker__Checker_fail_if_unreadable(c, node->left, left_type, _SLIT("receiver")); v__checker__Checker_fail_if_unreadable(c, node->left, left_type, _SLIT("receiver"));
v__ast__Type _t35 = _const_v__ast__string_type; v__ast__Type _t36 = _const_v__ast__string_type;
return _t35;
} else if (string__eq(method_name, _SLIT("free"))) {
v__ast__Type _t36 = _const_v__ast__void_type;
return _t36; return _t36;
} else if (string__eq(method_name, _SLIT("free"))) {
v__ast__Type _t37 = _const_v__ast__void_type;
return _t37;
} }
Option_v__ast__StructField _t37; Option_v__ast__StructField _t38;
if (_t37 = v__ast__Table_find_field_with_embeds(c->table, left_sym, method_name), _t37.state == 0) { if (_t38 = v__ast__Table_find_field_with_embeds(c->table, left_sym, method_name), _t38.state == 0) {
v__ast__StructField field = *(v__ast__StructField*)_t37.data; v__ast__StructField field = *(v__ast__StructField*)_t38.data;
v__ast__TypeSymbol* field_sym = v__ast__Table_sym(c->table, v__checker__Checker_unwrap_generic(c, field.typ)); v__ast__TypeSymbol* field_sym = v__ast__Table_sym(c->table, v__checker__Checker_unwrap_generic(c, field.typ));
if (field_sym->kind == v__ast__Kind__function) { if (field_sym->kind == v__ast__Kind__function) {
node->is_method = false; node->is_method = false;
node->is_field = true; node->is_field = true;
v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((field_sym->info)._v__ast__FnType,(field_sym->info)._typ, 444) /*expected idx: 444, name: v.ast.FnType */ ; v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((field_sym->info)._v__ast__FnType,(field_sym->info)._typ, 444) /*expected idx: 444, name: v.ast.FnType */ ;
Option_void _t38 = v__checker__Checker_check_expected_arg_count(c, node, (voidptr)&/*qq*/info.func); Option_void _t39 = v__checker__Checker_check_expected_arg_count(c, node, (voidptr)&/*qq*/info.func);
if (_t38.state != 0 && _t38.err._typ != _IError_None___index) { if (_t39.state != 0 && _t39.err._typ != _IError_None___index) {
IError err = _t38.err; IError err = _t39.err;
v__ast__Type _t39 = info.func.return_type; v__ast__Type _t40 = info.func.return_type;
return _t39; return _t40;
} }
; ;
@ -59818,9 +59830,9 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
array_push((array*)&earg_types, _MOV((v__ast__Type[]){ targ })); array_push((array*)&earg_types, _MOV((v__ast__Type[]){ targ }));
if (i < info.func.params.len) { if (i < info.func.params.len) {
v__ast__Type exp_arg_typ = (*(v__ast__Param*)/*ee elem_sym */array_get(info.func.params, i)).typ; v__ast__Type exp_arg_typ = (*(v__ast__Param*)/*ee elem_sym */array_get(info.func.params, i)).typ;
Option_void _t41 = v__checker__Checker_check_expected_call_arg(c, targ, v__checker__Checker_unwrap_generic(c, exp_arg_typ), node->language, *arg); Option_void _t42 = v__checker__Checker_check_expected_call_arg(c, targ, v__checker__Checker_unwrap_generic(c, exp_arg_typ), node->language, *arg);
if (_t41.state != 0 && _t41.err._typ != _IError_None___index) { if (_t42.state != 0 && _t42.err._typ != _IError_None___index) {
IError err = _t41.err; IError err = _t42.err;
if (!v__ast__Type_alias_eq(targ, _const_v__ast__void_type)) { if (!v__ast__Type_alias_eq(targ, _const_v__ast__void_type)) {
v__checker__Checker_error(c, str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = IError_name_table[err._typ]._method_msg(err._object)}}, {_SLIT(" in argument "), /*100 &int*/0xfe07, {.d_i32 = i + 1}}, {_SLIT(" to `"), /*115 &string*/0xfe10, {.d_s = left_sym->name}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = method_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), arg->pos); v__checker__Checker_error(c, str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = IError_name_table[err._typ]._method_msg(err._object)}}, {_SLIT(" in argument "), /*100 &int*/0xfe07, {.d_i32 = i + 1}}, {_SLIT(" to `"), /*115 &string*/0xfe10, {.d_s = left_sym->name}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = method_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), arg->pos);
} }
@ -59832,35 +59844,35 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
} }
node->expected_arg_types = earg_types; node->expected_arg_types = earg_types;
node->is_method = true; node->is_method = true;
Option_multi_return_v__ast__StructField_Array_v__ast__Type _t42 = v__ast__Table_find_field_from_embeds(c->table, left_sym, method_name); Option_multi_return_v__ast__StructField_Array_v__ast__Type _t43 = v__ast__Table_find_field_from_embeds(c->table, left_sym, method_name);
if (_t42.state != 0) { /*or block*/ if (_t43.state != 0) { /*or block*/
IError err = _t42.err; IError err = _t43.err;
v__ast__Type _t43 = info.func.return_type;
return _t43;
}
multi_return_v__ast__StructField_Array_v__ast__Type mr_55362 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t42.data);
node->from_embed_types = mr_55362.arg1;
v__ast__Type _t44 = info.func.return_type; v__ast__Type _t44 = info.func.return_type;
return _t44; return _t44;
} }
multi_return_v__ast__StructField_Array_v__ast__Type mr_56012 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t43.data);
node->from_embed_types = mr_56012.arg1;
v__ast__Type _t45 = info.func.return_type;
return _t45;
}
} }
if (!v__ast__Type_alias_eq(left_type, _const_v__ast__void_type)) { if (!v__ast__Type_alias_eq(left_type, _const_v__ast__void_type)) {
Array_string _t45 = {0}; Array_string _t46 = {0};
Array_v__ast__Fn _t45_orig = left_sym->methods; Array_v__ast__Fn _t46_orig = left_sym->methods;
int _t45_len = _t45_orig.len; int _t46_len = _t46_orig.len;
_t45 = __new_array(0, _t45_len, sizeof(string)); _t46 = __new_array(0, _t46_len, sizeof(string));
for (int _t46 = 0; _t46 < _t45_len; ++_t46) { for (int _t47 = 0; _t47 < _t46_len; ++_t47) {
v__ast__Fn it = ((v__ast__Fn*) _t45_orig.data)[_t46]; v__ast__Fn it = ((v__ast__Fn*) _t46_orig.data)[_t47];
string ti = it.name; string ti = it.name;
array_push((array*)&_t45, &ti); array_push((array*)&_t46, &ti);
} }
v__util__Suggestion suggestion = v__util__new_suggestion(method_name,_t45); v__util__Suggestion suggestion = v__util__new_suggestion(method_name,_t46);
v__checker__Checker_error(c, v__util__Suggestion_say(suggestion, unknown_method_msg), node->pos); v__checker__Checker_error(c, v__util__Suggestion_say(suggestion, unknown_method_msg), node->pos);
} }
v__ast__Type _t47 = _const_v__ast__void_type; v__ast__Type _t48 = _const_v__ast__void_type;
return _t47; return _t48;
} }
VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_go_expr(v__checker__Checker* c, v__ast__GoExpr* node) { VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_go_expr(v__checker__Checker* c, v__ast__GoExpr* node) {
@ -62639,7 +62651,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str
Array_v__ast__StructField info_fields_sorted = __new_array_with_default(0, 0, sizeof(v__ast__StructField), 0); Array_v__ast__StructField info_fields_sorted = __new_array_with_default(0, 0, sizeof(v__ast__StructField), 0);
if (node->is_short) { if (node->is_short) {
info_fields_sorted = array_clone_to_depth(&info.fields, 0); info_fields_sorted = array_clone_to_depth(&info.fields, 0);
qsort(info_fields_sorted.data, info_fields_sorted.len, info_fields_sorted.element_size, (int (*)(const void *, const void *))&compare_2892273012681280244_v__ast__StructField_by_i); qsort(info_fields_sorted.data, info_fields_sorted.len, info_fields_sorted.element_size, (int (*)(const void *, const void *))&compare_5995660241070764127_v__ast__StructField_by_i);
} }
Array_string inited_fields = __new_array_with_default(0, 0, sizeof(string), 0); Array_string inited_fields = __new_array_with_default(0, 0, sizeof(string), 0);
for (int i = 0; i < node->fields.len; ++i) { for (int i = 0; i < node->fields.len; ++i) {
@ -87835,6 +87847,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) {
if (is_method && v__ast__Type_has_flag(rec.typ, v__ast__TypeFlag__generic)) { if (is_method && v__ast__Type_has_flag(rec.typ, v__ast__TypeFlag__generic)) {
v__ast__TypeSymbol* sym = v__ast__Table_sym(p->table, rec.typ); v__ast__TypeSymbol* sym = v__ast__Table_sym(p->table, rec.typ);
if ((sym->info)._typ == 417 /* v.ast.Struct */) { if ((sym->info)._typ == 417 /* v.ast.Struct */) {
Array_string fn_generic_names = array_clone_to_depth(&generic_names, 0);
Array_string _t11 = {0}; Array_string _t11 = {0};
Array_v__ast__Type _t11_orig = (*sym->info._v__ast__Struct).generic_types; Array_v__ast__Type _t11_orig = (*sym->info._v__ast__Struct).generic_types;
int _t11_len = _t11_orig.len; int _t11_len = _t11_orig.len;
@ -87845,19 +87858,19 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) {
string ti = v__ast__Table_sym(p->table, it)->name; string ti = v__ast__Table_sym(p->table, it)->name;
array_push((array*)&_t11, &ti); array_push((array*)&_t11, &ti);
} }
Array_string rec_generic_names =_t11; generic_names =_t11;
for (int _t13 = 0; _t13 < rec_generic_names.len; ++_t13) { for (int _t13 = 0; _t13 < fn_generic_names.len; ++_t13) {
string gname = ((string*)rec_generic_names.data)[_t13]; string gname = ((string*)fn_generic_names.data)[_t13];
if (!Array_string_contains(generic_names, gname)) { if (!Array_string_contains(generic_names, gname)) {
array_push((array*)&generic_names, _MOV((string[]){ string_clone(gname) })); array_push((array*)&generic_names, _MOV((string[]){ string_clone(gname) }));
} }
} }
} }
} }
multi_return_Array_v__ast__Param_bool_bool mr_9325 = v__parser__Parser_fn_args(p); multi_return_Array_v__ast__Param_bool_bool mr_9364 = v__parser__Parser_fn_args(p);
Array_v__ast__Param args2 = mr_9325.arg0; Array_v__ast__Param args2 = mr_9364.arg0;
bool are_args_type_only = mr_9325.arg1; bool are_args_type_only = mr_9364.arg1;
bool is_variadic = mr_9325.arg2; bool is_variadic = mr_9364.arg2;
if (is_c2v_variadic) { if (is_c2v_variadic) {
is_variadic = true; is_variadic = true;
} }
@ -88198,9 +88211,9 @@ bool v__parser__Parser_anon_fn_defer_0 = false;
v__parser__Parser_anon_fn_defer_0 = true; v__parser__Parser_anon_fn_defer_0 = true;
p->scope->detached_from_parent = true; p->scope->detached_from_parent = true;
Array_v__ast__Param inherited_vars = (p->tok.kind == v__token__Kind__lsbr ? (v__parser__Parser_closure_vars(p)) : (__new_array_with_default(0, 0, sizeof(v__ast__Param), 0))); Array_v__ast__Param inherited_vars = (p->tok.kind == v__token__Kind__lsbr ? (v__parser__Parser_closure_vars(p)) : (__new_array_with_default(0, 0, sizeof(v__ast__Param), 0)));
multi_return_Array_v__ast__Param_bool_bool mr_18790 = v__parser__Parser_fn_args(p); multi_return_Array_v__ast__Param_bool_bool mr_18829 = v__parser__Parser_fn_args(p);
Array_v__ast__Param args = mr_18790.arg0; Array_v__ast__Param args = mr_18829.arg0;
bool is_variadic = mr_18790.arg2; bool is_variadic = mr_18829.arg2;
for (int _t2 = 0; _t2 < args.len; ++_t2) { for (int _t2 = 0; _t2 < args.len; ++_t2) {
v__ast__Param arg = ((v__ast__Param*)args.data)[_t2]; v__ast__Param arg = ((v__ast__Param*)args.data)[_t2];
if (arg.name.len == 0 && v__ast__Table_sym(p->table, arg.typ)->kind != v__ast__Kind__placeholder) { if (arg.name.len == 0 && v__ast__Table_sym(p->table, arg.typ)->kind != v__ast__Kind__placeholder) {
@ -89759,7 +89772,7 @@ v__ast__Type v__parser__Parser_parse_inline_sum_type(v__parser__Parser* p) {
array_push((array*)&_t1, &ti); array_push((array*)&_t1, &ti);
} }
Array_string variant_names =_t1; Array_string variant_names =_t1;
qsort(variant_names.data, variant_names.len, variant_names.element_size, (int (*)(const void *, const void *))&compare_7932637671395545435_string); qsort(variant_names.data, variant_names.len, variant_names.element_size, (int (*)(const void *, const void *))&compare_14364895672131222426_string);
string name = str_intp(2, _MOV((StrIntpData[]){{_SLIT("_v_anon_sum_type_"), /*115 &string*/0xfe10, {.d_s = Array_string_join(variant_names, _SLIT("_"))}}, {_SLIT0, 0, { .d_c = 0 }}})); string name = str_intp(2, _MOV((StrIntpData[]){{_SLIT("_v_anon_sum_type_"), /*115 &string*/0xfe10, {.d_s = Array_string_join(variant_names, _SLIT("_"))}}, {_SLIT0, 0, { .d_c = 0 }}}));
Array_v__ast__Type _t3 = {0}; Array_v__ast__Type _t3 = {0};
Array_v__ast__TypeNode _t3_orig = variants; Array_v__ast__TypeNode _t3_orig = variants;
@ -96610,7 +96623,7 @@ void v__builder__Builder_cc(v__builder__Builder* v) {
v__builder__Builder_build_thirdparty_obj_files(v); v__builder__Builder_build_thirdparty_obj_files(v);
v__builder__Builder_setup_output_name(v); v__builder__Builder_setup_output_name(v);
if (v->pref->os != v__pref__OS__windows && string_contains(ccompiler, _SLIT("++"))) { if (v->pref->os != v__pref__OS__windows && string_contains(ccompiler, _SLIT("++"))) {
string cpp_atomic_h_path = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("/woodpecker/src/git.rustybever.be/Chewing_Bever/v")}}, {_SLIT("/thirdparty/stdatomic/nix/cpp/atomic.h"), 0, { .d_c = 0 }}})); string cpp_atomic_h_path = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("/woodpecker/src/git.rustybever.be/vieter/v")}}, {_SLIT("/thirdparty/stdatomic/nix/cpp/atomic.h"), 0, { .d_c = 0 }}}));
if (!os__exists(cpp_atomic_h_path)) { if (!os__exists(cpp_atomic_h_path)) {
for (int _t4 = 0; _t4 < v->parsed_files.len; ++_t4) { for (int _t4 = 0; _t4 < v->parsed_files.len; ++_t4) {
v__ast__File* file = ((v__ast__File**)v->parsed_files.data)[_t4]; v__ast__File* file = ((v__ast__File**)v->parsed_files.data)[_t4];
@ -96630,7 +96643,7 @@ void v__builder__Builder_cc(v__builder__Builder* v) {
eprintln( str_intp(2, _MOV((StrIntpData[]){{_SLIT("> creating "), /*115 &string*/0xfe10, {.d_s = cpp_atomic_h_path}}, {_SLIT(" ..."), 0, { .d_c = 0 }}}))); eprintln( str_intp(2, _MOV((StrIntpData[]){{_SLIT("> creating "), /*115 &string*/0xfe10, {.d_s = cpp_atomic_h_path}}, {_SLIT(" ..."), 0, { .d_c = 0 }}})));
} }
#endif #endif
string cppgenv = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("/woodpecker/src/git.rustybever.be/Chewing_Bever/v")}}, {_SLIT("/thirdparty/stdatomic/nix/cpp/gen.v"), 0, { .d_c = 0 }}})); string cppgenv = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("/woodpecker/src/git.rustybever.be/vieter/v")}}, {_SLIT("/thirdparty/stdatomic/nix/cpp/gen.v"), 0, { .d_c = 0 }}}));
os__execute( str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = os__quoted_path(vexe)}}, {_SLIT(" run "), /*115 &string*/0xfe10, {.d_s = os__quoted_path(cppgenv)}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = os__quoted_path(ccompiler)}}, {_SLIT0, 0, { .d_c = 0 }}}))); os__execute( str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = os__quoted_path(vexe)}}, {_SLIT(" run "), /*115 &string*/0xfe10, {.d_s = os__quoted_path(cppgenv)}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = os__quoted_path(ccompiler)}}, {_SLIT0, 0, { .d_c = 0 }}})));
break; break;
} }

449
v_win.c
View File

@ -1,11 +1,11 @@
#define V_COMMIT_HASH "c405c1916" #define V_COMMIT_HASH "3afb88c4e"
#ifndef V_COMMIT_HASH #ifndef V_COMMIT_HASH
#define V_COMMIT_HASH "41857b0ac" #define V_COMMIT_HASH "c405c1916"
#endif #endif
#ifndef V_CURRENT_COMMIT_HASH #ifndef V_CURRENT_COMMIT_HASH
#define V_CURRENT_COMMIT_HASH "c405c19" #define V_CURRENT_COMMIT_HASH "3afb88c"
#endif #endif
// V comptime_definitions: // V comptime_definitions:
@ -7386,7 +7386,7 @@ string string_clone(string a);
string string_replace_once(string s, string rep, string with); string string_replace_once(string s, string rep, string with);
string string_replace(string s, string rep, string with); string string_replace(string s, string rep, string with);
string string_replace_each(string s, Array_string vals); string string_replace_each(string s, Array_string vals);
VV_LOCAL_SYMBOL int compare_11653268393309465375_RepIndex_by_idx(RepIndex* a, RepIndex* b) { VV_LOCAL_SYMBOL int compare_3079424758118292824_RepIndex_by_idx(RepIndex* a, RepIndex* b) {
if (a->idx < b->idx) return -1; if (a->idx < b->idx) return -1;
else return 1; else return 1;
} }
@ -7563,7 +7563,7 @@ Array_string os__cmdline__only_non_options(Array_string args);
Array_string os__cmdline__only_options(Array_string args); Array_string os__cmdline__only_options(Array_string args);
#define _const_v__token__max_keyword_len 20 #define _const_v__token__max_keyword_len 20
v__token__KeywordsMatcher v__token__new_keywords_matcher_T_v__token__Kind(Map_string_v__token__Kind kw_map); v__token__KeywordsMatcher v__token__new_keywords_matcher_T_v__token__Kind(Map_string_v__token__Kind kw_map);
VV_LOCAL_SYMBOL int compare_186646746980636166_v__token__WIndex_by_word(v__token__WIndex* a, v__token__WIndex* b) { VV_LOCAL_SYMBOL int compare_5690199065019732925_v__token__WIndex_by_word(v__token__WIndex* a, v__token__WIndex* b) {
if (string__lt(a->word, b->word)) return -1; if (string__lt(a->word, b->word)) return -1;
else return 1; else return 1;
} }
@ -7605,7 +7605,7 @@ Option_v__token__Kind v__token__kind_from_string(string s);
int v__mathutil__min_T_int(int a, int b); int v__mathutil__min_T_int(int a, int b);
int v__mathutil__max_T_int(int a, int b); int v__mathutil__max_T_int(int a, int b);
void v__dotgraph__start_digraph(void); void v__dotgraph__start_digraph(void);
VV_LOCAL_SYMBOL void anon_fn_eb34f0b759dade77__82(void); VV_LOCAL_SYMBOL void anon_fn_6b9593b3d6ef610a__82(void);
v__dotgraph__DotGraph* v__dotgraph__new(string name, string label, string color); v__dotgraph__DotGraph* v__dotgraph__new(string name, string label, string color);
void v__dotgraph__DotGraph_writeln(v__dotgraph__DotGraph* d, string line); void v__dotgraph__DotGraph_writeln(v__dotgraph__DotGraph* d, string line);
void v__dotgraph__DotGraph_finish(v__dotgraph__DotGraph* d); void v__dotgraph__DotGraph_finish(v__dotgraph__DotGraph* d);
@ -7996,7 +7996,7 @@ Option_void os__execve(string cmdpath, Array_string cmdargs, Array_string envs);
int os__is_atty(int fd); int os__is_atty(int fd);
Option_void os__write_file_array(string path, array buffer); Option_void os__write_file_array(string path, array buffer);
Option_Array_string os__glob(Array_string patterns); Option_Array_string os__glob(Array_string patterns);
VV_LOCAL_SYMBOL int compare_3075544183021293552_string(string* a, string* b) { VV_LOCAL_SYMBOL int compare_3677745349018262865_string(string* a, string* b) {
if (string__lt(*a, *b)) return -1; if (string__lt(*a, *b)) return -1;
else return 1; else return 1;
} }
@ -8669,7 +8669,7 @@ Array_string Array_v__cflag__CFlag_c_options_only_object_files(Array_v__cflag__C
multi_return_Array_string_Array_string_Array_string Array_v__cflag__CFlag_defines_others_libs(Array_v__cflag__CFlag cflags); multi_return_Array_string_Array_string_Array_string Array_v__cflag__CFlag_defines_others_libs(Array_v__cflag__CFlag cflags);
VV_LOCAL_SYMBOL Option_string v__pkgconfig__desc(string mod); VV_LOCAL_SYMBOL Option_string v__pkgconfig__desc(string mod);
Option_v__pkgconfig__Main_ptr v__pkgconfig__main(Array_string args); Option_v__pkgconfig__Main_ptr v__pkgconfig__main(Array_string args);
VV_LOCAL_SYMBOL int compare_16330786295575367509_string(string* a, string* b) { VV_LOCAL_SYMBOL int compare_10129308118656229290_string(string* a, string* b) {
if (string__lt(*a, *b)) return -1; if (string__lt(*a, *b)) return -1;
else return 1; else return 1;
} }
@ -8823,7 +8823,7 @@ v__pref__CompilerType v__pref__cc_from_string(string cc_str);
v__pref__Arch v__pref__get_host_arch(void); v__pref__Arch v__pref__get_host_arch(void);
VV_LOCAL_SYMBOL void v__pref__Preferences_parse_define(v__pref__Preferences* prefs, string define); VV_LOCAL_SYMBOL void v__pref__Preferences_parse_define(v__pref__Preferences* prefs, string define);
Array_string v__pref__Preferences_should_compile_filtered_files(v__pref__Preferences* prefs, string dir, Array_string files_); Array_string v__pref__Preferences_should_compile_filtered_files(v__pref__Preferences* prefs, string dir, Array_string files_);
VV_LOCAL_SYMBOL int compare_13661271458656804876_string(string* a, string* b) { VV_LOCAL_SYMBOL int compare_11540237029762306605_string(string* a, string* b) {
if (string__lt(*a, *b)) return -1; if (string__lt(*a, *b)) return -1;
else return 1; else return 1;
} }
@ -8885,7 +8885,7 @@ void sync__WaitGroup_wait(sync__WaitGroup* wg);
string _const_help__unknown_topic; // a string literal, inited later string _const_help__unknown_topic; // a string literal, inited later
void help__print_and_exit(string topic); void help__print_and_exit(string topic);
VV_LOCAL_SYMBOL string help__known_topics(string topicdir); VV_LOCAL_SYMBOL string help__known_topics(string topicdir);
VV_LOCAL_SYMBOL int compare_10452767129756656329_string(string* a, string* b) { VV_LOCAL_SYMBOL int compare_1468091262560489642_string(string* a, string* b) {
if (string__lt(*a, *b)) return -1; if (string__lt(*a, *b)) return -1;
else return 1; else return 1;
} }
@ -8928,13 +8928,13 @@ v__util__Suggestion v__util__new_suggestion(string wanted, Array_string possibil
void v__util__Suggestion_add(v__util__Suggestion* s, string val); void v__util__Suggestion_add(v__util__Suggestion* s, string val);
void v__util__Suggestion_add_many(v__util__Suggestion* s, Array_string many); void v__util__Suggestion_add_many(v__util__Suggestion* s, Array_string many);
void v__util__Suggestion_sort(v__util__Suggestion* s); void v__util__Suggestion_sort(v__util__Suggestion* s);
VV_LOCAL_SYMBOL int compare_6907021362050549619_v__util__Possibility_by_similarity(v__util__Possibility* a, v__util__Possibility* b) { VV_LOCAL_SYMBOL int compare_15123029833316296960_v__util__Possibility_by_similarity(v__util__Possibility* a, v__util__Possibility* b) {
if (a->similarity < b->similarity) return -1; if (a->similarity < b->similarity) return -1;
else return 1; else return 1;
} }
string v__util__Suggestion_say(v__util__Suggestion s, string msg); string v__util__Suggestion_say(v__util__Suggestion s, string msg);
VV_LOCAL_SYMBOL int compare_6907021362050549619_string(string* a, string* b) { VV_LOCAL_SYMBOL int compare_15123029833316296960_string(string* a, string* b) {
if (string__lt(*a, *b)) return -1; if (string__lt(*a, *b)) return -1;
else return 1; else return 1;
} }
@ -9519,7 +9519,7 @@ v__ast__Type v__checker__Checker_int_lit(v__checker__Checker* c, v__ast__Integer
void v__checker__Checker_struct_decl(v__checker__Checker* c, v__ast__StructDecl* node); void v__checker__Checker_struct_decl(v__checker__Checker* c, v__ast__StructDecl* node);
VV_LOCAL_SYMBOL int v__checker__minify_sort_fn(v__ast__StructField* a, v__ast__StructField* b); VV_LOCAL_SYMBOL int v__checker__minify_sort_fn(v__ast__StructField* a, v__ast__StructField* b);
v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__StructInit* node); v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__StructInit* node);
VV_LOCAL_SYMBOL int compare_2892273012681280244_v__ast__StructField_by_i(v__ast__StructField* a, v__ast__StructField* b) { VV_LOCAL_SYMBOL int compare_5995660241070764127_v__ast__StructField_by_i(v__ast__StructField* a, v__ast__StructField* b) {
if (a->i < b->i) return -1; if (a->i < b->i) return -1;
else return 1; else return 1;
} }
@ -10040,7 +10040,7 @@ v__ast__Type v__parser__Parser_parse_fn_type(v__parser__Parser* p, string name);
v__ast__Type v__parser__Parser_parse_type_with_mut(v__parser__Parser* p, bool is_mut); v__ast__Type v__parser__Parser_parse_type_with_mut(v__parser__Parser* p, bool is_mut);
v__ast__Language v__parser__Parser_parse_language(v__parser__Parser* p); v__ast__Language v__parser__Parser_parse_language(v__parser__Parser* p);
v__ast__Type v__parser__Parser_parse_inline_sum_type(v__parser__Parser* p); v__ast__Type v__parser__Parser_parse_inline_sum_type(v__parser__Parser* p);
VV_LOCAL_SYMBOL int compare_7932637671395545435_string(string* a, string* b) { VV_LOCAL_SYMBOL int compare_14364895672131222426_string(string* a, string* b) {
if (string__lt(*a, *b)) return -1; if (string__lt(*a, *b)) return -1;
else return 1; else return 1;
} }
@ -12702,7 +12702,7 @@ void v__ast__TypeSymbol_free(v__ast__TypeSymbol* it) {
string_free(&(it->mod)); string_free(&(it->mod));
} }
VV_LOCAL_SYMBOL void anon_fn_eb34f0b759dade77__82(void) { VV_LOCAL_SYMBOL void anon_fn_6b9593b3d6ef610a__82(void) {
println(_SLIT("}")); println(_SLIT("}"));
} }
@ -20379,7 +20379,7 @@ string string_replace_each(string s, Array_string vals) {
if (idxs.len == 0) { if (idxs.len == 0) {
return string_clone(s); return string_clone(s);
} }
qsort(idxs.data, idxs.len, idxs.element_size, (int (*)(const void *, const void *))&compare_11653268393309465375_RepIndex_by_idx); qsort(idxs.data, idxs.len, idxs.element_size, (int (*)(const void *, const void *))&compare_3079424758118292824_RepIndex_by_idx);
u8* b = malloc_noscan(new_len + 1); u8* b = malloc_noscan(new_len + 1);
int idx_pos = 0; int idx_pos = 0;
RepIndex cur_idx = ((RepIndex*)idxs.data)[idx_pos]; RepIndex cur_idx = ((RepIndex*)idxs.data)[idx_pos];
@ -23093,7 +23093,7 @@ v__token__KeywordsMatcher v__token__new_keywords_matcher_T_v__token__Kind(Map_st
} }
for (int i = 0; i < _const_v__token__max_keyword_len; ++i) { for (int i = 0; i < _const_v__token__max_keyword_len; ++i) {
if (km.words[v_fixed_index(i, 20)].len > 0) { if (km.words[v_fixed_index(i, 20)].len > 0) {
qsort(km.words[v_fixed_index(i, 20)].data, km.words[v_fixed_index(i, 20)].len, km.words[v_fixed_index(i, 20)].element_size, (int (*)(const void *, const void *))&compare_186646746980636166_v__token__WIndex_by_word); qsort(km.words[v_fixed_index(i, 20)].data, km.words[v_fixed_index(i, 20)].len, km.words[v_fixed_index(i, 20)].element_size, (int (*)(const void *, const void *))&compare_5690199065019732925_v__token__WIndex_by_word);
} }
} }
v__token__KeywordsMatcher _t4 = km; v__token__KeywordsMatcher _t4 = km;
@ -23120,7 +23120,7 @@ v__token__KeywordsMatcher v__token__new_keywords_matcher_T_int(Map_string_int kw
} }
for (int i = 0; i < _const_v__token__max_keyword_len; ++i) { for (int i = 0; i < _const_v__token__max_keyword_len; ++i) {
if (km.words[v_fixed_index(i, 20)].len > 0) { if (km.words[v_fixed_index(i, 20)].len > 0) {
qsort(km.words[v_fixed_index(i, 20)].data, km.words[v_fixed_index(i, 20)].len, km.words[v_fixed_index(i, 20)].element_size, (int (*)(const void *, const void *))&compare_186646746980636166_v__token__WIndex_by_word); qsort(km.words[v_fixed_index(i, 20)].data, km.words[v_fixed_index(i, 20)].len, km.words[v_fixed_index(i, 20)].element_size, (int (*)(const void *, const void *))&compare_5690199065019732925_v__token__WIndex_by_word);
} }
} }
v__token__KeywordsMatcher _t4 = km; v__token__KeywordsMatcher _t4 = km;
@ -24434,7 +24434,7 @@ inline int v__mathutil__max_T_int(int a, int b) {
void v__dotgraph__start_digraph(void) { void v__dotgraph__start_digraph(void) {
println(_SLIT("digraph G {")); println(_SLIT("digraph G {"));
atexit((voidptr) anon_fn_eb34f0b759dade77__82); atexit((voidptr) anon_fn_6b9593b3d6ef610a__82);
} }
v__dotgraph__DotGraph* v__dotgraph__new(string name, string label, string color) { v__dotgraph__DotGraph* v__dotgraph__new(string name, string label, string color) {
@ -27746,7 +27746,7 @@ Option_Array_string os__glob(Array_string patterns) {
; ;
} }
qsort(matches.data, matches.len, matches.element_size, (int (*)(const void *, const void *))&compare_3075544183021293552_string); qsort(matches.data, matches.len, matches.element_size, (int (*)(const void *, const void *))&compare_3677745349018262865_string);
Option_Array_string _t4; Option_Array_string _t4;
opt_ok(&(Array_string[]) { matches }, (Option*)(&_t4), sizeof(Array_string)); opt_ok(&(Array_string[]) { matches }, (Option*)(&_t4), sizeof(Array_string));
return _t4; return _t4;
@ -34838,7 +34838,7 @@ Option_v__pkgconfig__Main_ptr v__pkgconfig__main(Array_string args) {
m->res = _const_v__pkgconfig__version; m->res = _const_v__pkgconfig__version;
} else if (opt->listall) { } else if (opt->listall) {
Array_string modules = v__pkgconfig__list(); Array_string modules = v__pkgconfig__list();
qsort(modules.data, modules.len, modules.element_size, (int (*)(const void *, const void *))&compare_16330786295575367509_string); qsort(modules.data, modules.len, modules.element_size, (int (*)(const void *, const void *))&compare_10129308118656229290_string);
if (opt->description) { if (opt->description) {
for (int _t1 = 0; _t1 < modules.len; ++_t1) { for (int _t1 = 0; _t1 < modules.len; ++_t1) {
string mod = ((string*)modules.data)[_t1]; string mod = ((string*)modules.data)[_t1];
@ -36387,7 +36387,7 @@ void v__pref__Preferences_fill_with_defaults(v__pref__Preferences* p) {
if ((p->third_party_option).len == 0) { if ((p->third_party_option).len == 0) {
p->third_party_option = p->cflags; p->third_party_option = p->cflags;
} }
string vhash = _SLIT("41857b0ac"); string vhash = _SLIT("c405c1916");
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))}))); 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"))) { if (string__eq(os__user_os(), _SLIT("windows"))) {
p->use_cache = false; p->use_cache = false;
@ -37647,7 +37647,7 @@ VV_LOCAL_SYMBOL void v__pref__Preferences_parse_define(v__pref__Preferences* pre
Array_string v__pref__Preferences_should_compile_filtered_files(v__pref__Preferences* prefs, string dir, Array_string files_) { Array_string v__pref__Preferences_should_compile_filtered_files(v__pref__Preferences* prefs, string dir, Array_string files_) {
Array_string res = __new_array_with_default(0, 0, sizeof(string), 0); Array_string res = __new_array_with_default(0, 0, sizeof(string), 0);
Array_string files = array_clone_to_depth(&files_, 0); Array_string files = array_clone_to_depth(&files_, 0);
qsort(files.data, files.len, files.element_size, (int (*)(const void *, const void *))&compare_13661271458656804876_string); qsort(files.data, files.len, files.element_size, (int (*)(const void *, const void *))&compare_11540237029762306605_string);
Array_string all_v_files = __new_array_with_default(0, 0, sizeof(string), 0); Array_string all_v_files = __new_array_with_default(0, 0, sizeof(string), 0);
for (int _t1 = 0; _t1 < files.len; ++_t1) { for (int _t1 = 0; _t1 < files.len; ++_t1) {
string file = ((string*)files.data)[_t1]; string file = ((string*)files.data)[_t1];
@ -38845,7 +38845,7 @@ VV_LOCAL_SYMBOL string help__known_topics(string topicdir) {
array_push((array*)&_t3, &ti); array_push((array*)&_t3, &ti);
} }
Array_string topics =_t3; Array_string topics =_t3;
qsort(topics.data, topics.len, topics.element_size, (int (*)(const void *, const void *))&compare_10452767129756656329_string); qsort(topics.data, topics.len, topics.element_size, (int (*)(const void *, const void *))&compare_1468091262560489642_string);
array_push((array*)&res, _MOV((string[]){ string_clone(Array_string_join(topics, _SLIT(", "))) })); array_push((array*)&res, _MOV((string[]){ string_clone(Array_string_join(topics, _SLIT(", "))) }));
array_push((array*)&res, _MOV((string[]){ string_clone(_SLIT(".")) })); array_push((array*)&res, _MOV((string[]){ string_clone(_SLIT(".")) }));
string _t7 = Array_string_join(res, _SLIT("")); string _t7 = Array_string_join(res, _SLIT(""));
@ -39342,7 +39342,7 @@ void v__util__Suggestion_add_many(v__util__Suggestion* s, Array_string many) {
} }
void v__util__Suggestion_sort(v__util__Suggestion* s) { void v__util__Suggestion_sort(v__util__Suggestion* s) {
qsort(s->known.data, s->known.len, s->known.element_size, (int (*)(const void *, const void *))&compare_6907021362050549619_v__util__Possibility_by_similarity); qsort(s->known.data, s->known.len, s->known.element_size, (int (*)(const void *, const void *))&compare_15123029833316296960_v__util__Possibility_by_similarity);
} }
string v__util__Suggestion_say(v__util__Suggestion s, string msg) { string v__util__Suggestion_say(v__util__Suggestion s, string msg) {
@ -39371,7 +39371,7 @@ string v__util__Suggestion_say(v__util__Suggestion s, string msg) {
array_push((array*)&_t1, &ti); array_push((array*)&_t1, &ti);
} }
Array_string values =_t1; Array_string values =_t1;
qsort(values.data, values.len, values.element_size, (int (*)(const void *, const void *))&compare_6907021362050549619_string); qsort(values.data, values.len, values.element_size, (int (*)(const void *, const void *))&compare_15123029833316296960_string);
if (values.len == 1) { if (values.len == 1) {
res = /*f*/string__plus(res, str_intp(2, _MOV((StrIntpData[]){{_SLIT(".\n1 possibility: "), /*115 &string*/0xfe10, {.d_s = (*(string*)/*ee elem_sym */array_get(values, 0))}}, {_SLIT("."), 0, { .d_c = 0 }}}))); res = /*f*/string__plus(res, str_intp(2, _MOV((StrIntpData[]){{_SLIT(".\n1 possibility: "), /*115 &string*/0xfe10, {.d_s = (*(string*)/*ee elem_sym */array_get(values, 0))}}, {_SLIT("."), 0, { .d_c = 0 }}})));
} else if (values.len < 25) { } else if (values.len < 25) {
@ -48606,137 +48606,141 @@ bool v__checker__Checker_check_types(v__checker__Checker* c, v__ast__Type got, v
bool got_is_ptr = v__ast__Type_is_ptr(got); bool got_is_ptr = v__ast__Type_is_ptr(got);
bool exp_is_ptr = v__ast__Type_is_ptr(expected); bool exp_is_ptr = v__ast__Type_is_ptr(expected);
if (c->pref->translated) { if (c->pref->translated) {
if (v__ast__Type_alias_eq(expected, _const_v__ast__byteptr_type)) { if (v__ast__Type_is_int(expected) && v__ast__Type_is_int(got)) {
bool _t2 = true; bool _t2 = true;
return _t2; return _t2;
} }
if (v__ast__Type_alias_eq(expected, _const_v__ast__voidptr_type)) { if (v__ast__Type_alias_eq(expected, _const_v__ast__byteptr_type)) {
bool _t3 = true; bool _t3 = true;
return _t3; return _t3;
} }
if (v__ast__Type_alias_eq(expected, _const_v__ast__bool_type) && (v__ast__Type_is_any_kind_of_pointer(got) || v__ast__Type_is_int(got))) { if (v__ast__Type_alias_eq(expected, _const_v__ast__voidptr_type)) {
bool _t4 = true; bool _t4 = true;
return _t4; return _t4;
} }
if (v__ast__Type_alias_eq(expected, _const_v__ast__bool_type) && (v__ast__Type_is_any_kind_of_pointer(got) || v__ast__Type_is_int(got))) {
bool _t5 = true;
return _t5;
}
if (v__ast__Type_is_any_kind_of_pointer(expected)) { if (v__ast__Type_is_any_kind_of_pointer(expected)) {
v__ast__Type deref = v__ast__Type_deref(expected); v__ast__Type deref = v__ast__Type_deref(expected);
v__ast__TypeSymbol* got_sym = v__ast__Table_sym(c->table, got); v__ast__TypeSymbol* got_sym = v__ast__Table_sym(c->table, got);
if (v__ast__Type_is_number(deref) && (v__ast__TypeSymbol_is_number(got_sym) || got_sym->kind == v__ast__Kind__enum_)) { if (v__ast__Type_is_number(deref) && (v__ast__TypeSymbol_is_number(got_sym) || got_sym->kind == v__ast__Kind__enum_)) {
bool _t5 = true; bool _t6 = true;
return _t5; return _t6;
} }
} }
if ((v__ast__Type_alias_eq(expected, _const_v__ast__rune_type) && v__ast__Type_is_int(got)) || (v__ast__Type_alias_eq(got, _const_v__ast__rune_type) && v__ast__Type_is_int(expected))) { if ((v__ast__Type_alias_eq(expected, _const_v__ast__rune_type) && v__ast__Type_is_int(got)) || (v__ast__Type_alias_eq(got, _const_v__ast__rune_type) && v__ast__Type_is_int(expected))) {
bool _t6 = true; bool _t7 = true;
return _t6; return _t7;
} }
v__ast__TypeSymbol* got_sym = v__ast__Table_sym(c->table, got); v__ast__TypeSymbol* got_sym = v__ast__Table_sym(c->table, got);
v__ast__TypeSymbol* expected_sym = v__ast__Table_sym(c->table, expected); v__ast__TypeSymbol* expected_sym = v__ast__Table_sym(c->table, expected);
if (got_sym->kind == v__ast__Kind__enum_) { if (got_sym->kind == v__ast__Kind__enum_) {
if (v__ast__TypeSymbol_is_number(expected_sym)) { if (v__ast__TypeSymbol_is_number(expected_sym)) {
bool _t7 = true; bool _t8 = true;
return _t7; return _t8;
} }
} else if (got_sym->kind == v__ast__Kind__array_fixed) { } else if (got_sym->kind == v__ast__Kind__array_fixed) {
if (v__ast__TypeSymbol_is_number(expected_sym)) { if (v__ast__TypeSymbol_is_number(expected_sym)) {
bool _t8 = true;
return _t8;
} else if (v__ast__Type_is_any_kind_of_pointer(expected)) {
bool _t9 = true; bool _t9 = true;
return _t9; return _t9;
} else if (v__ast__Type_is_any_kind_of_pointer(expected)) {
bool _t10 = true;
return _t10;
} }
} else if (expected_sym->kind == v__ast__Kind__array_fixed) { } 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 (v__ast__TypeSymbol_is_number(got_sym) && v__ast__Type_is_any_kind_of_pointer(got)) {
bool _t10 = true; bool _t11 = true;
return _t10; return _t11;
} else if (got_sym->kind == v__ast__Kind__array) { } 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, 479) /*expected idx: 479, name: v.ast.ArrayFixed */ ; v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 479) /*expected idx: 479, name: v.ast.ArrayFixed */ ;
v__ast__Array info2 = /* as */ *(v__ast__Array*)__as_cast((got_sym->info)._v__ast__Array,(got_sym->info)._typ, 451) /*expected idx: 451, name: v.ast.Array */ ; v__ast__Array info2 = /* as */ *(v__ast__Array*)__as_cast((got_sym->info)._v__ast__Array,(got_sym->info)._typ, 451) /*expected idx: 451, name: v.ast.Array */ ;
if (v__checker__Checker_check_types(c, info.elem_type, info2.elem_type)) { if (v__checker__Checker_check_types(c, info.elem_type, info2.elem_type)) {
bool _t11 = true; bool _t12 = true;
return _t11; return _t12;
} }
} }
} }
if (expected_sym->kind == v__ast__Kind__enum_ && v__ast__TypeSymbol_is_number(got_sym)) { if (expected_sym->kind == v__ast__Kind__enum_ && v__ast__TypeSymbol_is_number(got_sym)) {
bool _t12 = true; bool _t13 = true;
return _t12; return _t13;
} }
if (got_is_ptr && exp_is_ptr) { if (got_is_ptr && exp_is_ptr) {
if (v__ast__TypeSymbol_is_number(expected_sym) && v__ast__TypeSymbol_is_number(got_sym)) { if (v__ast__TypeSymbol_is_number(expected_sym) && v__ast__TypeSymbol_is_number(got_sym)) {
bool _t13 = true; bool _t14 = true;
return _t13; return _t14;
} }
} }
} }
if (got_is_ptr && exp_is_ptr) { if (got_is_ptr && exp_is_ptr) {
if (v__ast__Type_nr_muls(got) != v__ast__Type_nr_muls(expected)) { if (v__ast__Type_nr_muls(got) != v__ast__Type_nr_muls(expected)) {
bool _t14 = false; bool _t15 = false;
return _t14; return _t15;
} }
} }
int exp_idx = v__ast__Type_idx(expected); int exp_idx = v__ast__Type_idx(expected);
int got_idx = v__ast__Type_idx(got); int got_idx = v__ast__Type_idx(got);
if (exp_idx == got_idx) { if (exp_idx == got_idx) {
bool _t15 = true;
return _t15;
}
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 _t16 = true; bool _t16 = true;
return _t16; return _t16;
} }
} 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_real_pointer(expected)) { if (v__ast__Type_is_ptr(got) || v__ast__Type_is_pointer(got)) {
if (v__ast__Type_alias_eq(got, _const_v__ast__int_literal_type)) {
bool _t17 = true; bool _t17 = true;
return _t17; return _t17;
} }
} }
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_real_pointer(expected)) {
if (v__ast__Type_is_ptr(expected) || v__ast__Type_is_pointer(expected)) { if (v__ast__Type_alias_eq(got, _const_v__ast__int_literal_type)) {
bool _t18 = true; bool _t18 = true;
return _t18; return _t18;
} }
} }
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))) { 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 _t19 = true; bool _t19 = true;
return _t19; return _t19;
} }
}
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 _t20 = true;
return _t20;
}
if (v__ast__Type_has_flag(expected, v__ast__TypeFlag__optional) || v__ast__Type_has_flag(expected, v__ast__TypeFlag__result)) { 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); 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))) { 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 _t20 = true; bool _t21 = true;
return _t20;
} 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 _t21 = false;
return _t21; return _t21;
} } 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))) {
}
if (!v__checker__Checker_check_basic(c, got, expected)) {
bool _t22 = false; bool _t22 = false;
return _t22; return _t22;
} }
}
if (!v__checker__Checker_check_basic(c, got, expected)) {
bool _t23 = false;
return _t23;
}
if (v__ast__Type_is_number(got) && v__ast__Type_is_number(expected)) { 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)) { if (v__ast__Type_alias_eq(got, _const_v__ast__rune_type) && v__ast__Type_alias_eq(expected, _const_v__ast__byte_type)) {
bool _t23 = true;
return _t23;
} 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 _t24 = true; bool _t24 = true;
return _t24; return _t24;
} } else if (v__ast__Type_alias_eq(expected, _const_v__ast__rune_type) && v__ast__Type_alias_eq(got, _const_v__ast__byte_type)) {
if (!v__ast__Type_alias_eq(v__checker__Checker_promote_num(c, expected, got), expected)) { bool _t25 = true;
bool _t25 = false;
return _t25; return _t25;
} }
} if (!v__ast__Type_alias_eq(v__checker__Checker_promote_num(c, expected, got), expected)) {
if (v__ast__Type_has_flag(expected, v__ast__TypeFlag__generic)) {
bool _t26 = false; bool _t26 = false;
return _t26; return _t26;
} }
bool _t27 = true; }
if (v__ast__Type_has_flag(expected, v__ast__TypeFlag__generic)) {
bool _t27 = false;
return _t27; return _t27;
} }
bool _t28 = true;
return _t28;
}
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) { 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) {
if (got == 0) { if (got == 0) {
@ -49083,10 +49087,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_hi = left_type;
v__ast__Type type_lo = right_type; v__ast__Type type_lo = right_type;
if (v__ast__Type_idx(type_hi) < v__ast__Type_idx(type_lo)) { if (v__ast__Type_idx(type_hi) < v__ast__Type_idx(type_lo)) {
v__ast__Type _var_17710 = type_hi; v__ast__Type _var_17770 = type_hi;
v__ast__Type _var_17719 = type_lo; v__ast__Type _var_17779 = type_lo;
type_hi = _var_17719; type_hi = _var_17779;
type_lo = _var_17710; type_lo = _var_17770;
} }
int idx_hi = v__ast__Type_idx(type_hi); int idx_hi = v__ast__Type_idx(type_hi);
int idx_lo = v__ast__Type_idx(type_lo); int idx_lo = v__ast__Type_idx(type_lo);
@ -57259,6 +57263,9 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp
if (v__ast__Type_alias_eq(arg_typ, _const_v__ast__int_type) && param_typ_sym->kind == v__ast__Kind__enum_) { if (v__ast__Type_alias_eq(arg_typ, _const_v__ast__int_type) && param_typ_sym->kind == v__ast__Kind__enum_) {
continue; continue;
} }
if ((v__ast__Type_alias_eq(arg_typ, _const_v__ast__bool_type) && v__ast__Type_is_int(param.typ)) || (v__ast__Type_is_int(arg_typ) && v__ast__Type_alias_eq(param.typ, _const_v__ast__bool_type))) {
continue;
}
bool param_is_number = v__ast__Type_is_number(param.typ); bool param_is_number = v__ast__Type_is_number(param.typ);
if (v__ast__Type_is_ptr(param.typ)) { if (v__ast__Type_is_ptr(param.typ)) {
param_is_number = v__ast__Type_is_number(v__ast__Type_deref(param.typ)); param_is_number = v__ast__Type_is_number(v__ast__Type_deref(param.typ));
@ -57273,7 +57280,7 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp
if (param.typ == _const_v__ast__voidptr_type_idx || arg_typ == _const_v__ast__voidptr_type_idx) { if (param.typ == _const_v__ast__voidptr_type_idx || arg_typ == _const_v__ast__voidptr_type_idx) {
continue; continue;
} }
if ((arg_typ_sym->kind == v__ast__Kind__array_fixed && param_is_number) || (param_typ_sym->kind == v__ast__Kind__array_fixed && typ_is_number)) { if ((arg_typ_sym->kind == v__ast__Kind__array_fixed && (param_is_number || v__ast__Type_is_any_kind_of_pointer(param.typ))) || (param_typ_sym->kind == v__ast__Kind__array_fixed && (typ_is_number || v__ast__Type_is_any_kind_of_pointer(arg_typ)))) {
continue; continue;
} }
if (v__ast__Type_is_any_kind_of_pointer(param.typ) && typ_is_number) { if (v__ast__Type_is_any_kind_of_pointer(param.typ) && typ_is_number) {
@ -57375,12 +57382,6 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
v__ast__Type left_type = v__checker__Checker_expr(c, node->left); v__ast__Type left_type = v__checker__Checker_expr(c, node->left);
c->expected_type = left_type; c->expected_type = left_type;
bool is_generic = v__ast__Type_has_flag(left_type, v__ast__TypeFlag__generic); bool is_generic = v__ast__Type_has_flag(left_type, v__ast__TypeFlag__generic);
if (is_generic && node->concrete_types.len == 0) {
v__ast__TypeSymbol* rec_sym = v__ast__Table_sym(c->table, left_type);
if ((rec_sym->info)._typ == 456 /* v.ast.Struct */) {
node->concrete_types = (*rec_sym->info._v__ast__Struct).generic_types;
}
}
node->left_type = left_type; node->left_type = left_type;
node->return_type = left_type; node->return_type = left_type;
node->receiver_type = left_type; node->receiver_type = left_type;
@ -57420,51 +57421,37 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
v__ast__Type _t6 = _const_v__ast__void_type; v__ast__Type _t6 = _const_v__ast__void_type;
return _t6; return _t6;
} }
Array_v__ast__Type concrete_types = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0);
for (int _t7 = 0; _t7 < node->concrete_types.len; ++_t7) {
v__ast__Type concrete_type = ((v__ast__Type*)node->concrete_types.data)[_t7];
if (v__ast__Type_has_flag(concrete_type, v__ast__TypeFlag__generic)) {
array_push((array*)&concrete_types, _MOV((v__ast__Type[]){ v__checker__Checker_unwrap_generic(c, concrete_type) }));
} else {
array_push((array*)&concrete_types, _MOV((v__ast__Type[]){ concrete_type }));
}
}
if (concrete_types.len > 0) {
if (v__ast__Table_register_fn_concrete_types(c->table, v__ast__CallExpr_fkey(node), concrete_types)) {
c->need_recheck_generic_fns = true;
}
}
if (left_sym->kind == v__ast__Kind__array && Array_string_contains(_const_v__checker__array_builtin_methods, method_name)) { if (left_sym->kind == v__ast__Kind__array && Array_string_contains(_const_v__checker__array_builtin_methods, method_name)) {
v__ast__Type _t10 = v__checker__Checker_array_builtin_method_call(c, node, left_type, *v__ast__Table_sym(c->table, left_type)); v__ast__Type _t7 = v__checker__Checker_array_builtin_method_call(c, node, left_type, *v__ast__Table_sym(c->table, left_type));
return _t10; return _t7;
} else if ((left_sym->kind == v__ast__Kind__map || final_left_sym->kind == v__ast__Kind__map) && (string__eq(method_name, _SLIT("clone")) || string__eq(method_name, _SLIT("keys")) || string__eq(method_name, _SLIT("move")) || string__eq(method_name, _SLIT("delete")))) { } else if ((left_sym->kind == v__ast__Kind__map || final_left_sym->kind == v__ast__Kind__map) && (string__eq(method_name, _SLIT("clone")) || string__eq(method_name, _SLIT("keys")) || string__eq(method_name, _SLIT("move")) || string__eq(method_name, _SLIT("delete")))) {
if (left_sym->kind == v__ast__Kind__map) { if (left_sym->kind == v__ast__Kind__map) {
v__ast__Type _t11 = v__checker__Checker_map_builtin_method_call(c, node, left_type, *left_sym); v__ast__Type _t8 = v__checker__Checker_map_builtin_method_call(c, node, left_type, *left_sym);
return _t11; return _t8;
} else { } else {
v__ast__Type parent_type = (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 471) /*expected idx: 471, name: v.ast.Alias */ ).parent_type; v__ast__Type parent_type = (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 471) /*expected idx: 471, name: v.ast.Alias */ ).parent_type;
v__ast__Type _t12 = v__checker__Checker_map_builtin_method_call(c, node, parent_type, *final_left_sym); v__ast__Type _t9 = v__checker__Checker_map_builtin_method_call(c, node, parent_type, *final_left_sym);
return _t12; return _t9;
} }
} else if (left_sym->kind == v__ast__Kind__array && (string__eq(method_name, _SLIT("insert")) || string__eq(method_name, _SLIT("prepend")))) { } else if (left_sym->kind == v__ast__Kind__array && (string__eq(method_name, _SLIT("insert")) || string__eq(method_name, _SLIT("prepend")))) {
if (string__eq(method_name, _SLIT("insert"))) { if (string__eq(method_name, _SLIT("insert"))) {
if (node->args.len != 2) { if (node->args.len != 2) {
v__checker__Checker_error(c, _SLIT("`array.insert()` should have 2 arguments, e.g. `insert(1, val)`"), node->pos); v__checker__Checker_error(c, _SLIT("`array.insert()` should have 2 arguments, e.g. `insert(1, val)`"), node->pos);
v__ast__Type _t13 = _const_v__ast__void_type; v__ast__Type _t10 = _const_v__ast__void_type;
return _t13; return _t10;
} else { } else {
v__ast__Type arg_type = v__checker__Checker_expr(c, (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr); v__ast__Type arg_type = v__checker__Checker_expr(c, (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr);
if (!(v__ast__Type_alias_eq(arg_type, _const_v__ast__int_type) || v__ast__Type_alias_eq(arg_type, _const_v__ast__int_literal_type))) { if (!(v__ast__Type_alias_eq(arg_type, _const_v__ast__int_type) || v__ast__Type_alias_eq(arg_type, _const_v__ast__int_literal_type))) {
v__checker__Checker_error(c, _SLIT("the first argument of `array.insert()` should be integer"), v__ast__Expr_pos((*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr)); v__checker__Checker_error(c, _SLIT("the first argument of `array.insert()` should be integer"), v__ast__Expr_pos((*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr));
v__ast__Type _t14 = _const_v__ast__void_type; v__ast__Type _t11 = _const_v__ast__void_type;
return _t14; return _t11;
} }
} }
} else { } else {
if (node->args.len != 1) { if (node->args.len != 1) {
v__checker__Checker_error(c, _SLIT("`array.prepend()` should have 1 argument, e.g. `prepend(val)`"), node->pos); v__checker__Checker_error(c, _SLIT("`array.prepend()` should have 1 argument, e.g. `prepend(val)`"), node->pos);
v__ast__Type _t15 = _const_v__ast__void_type; v__ast__Type _t12 = _const_v__ast__void_type;
return _t15; return _t12;
} }
} }
v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((left_sym->info)._v__ast__Array,(left_sym->info)._typ, 451) /*expected idx: 451, name: v.ast.Array */ ; v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((left_sym->info)._v__ast__Array,(left_sym->info)._typ, 451) /*expected idx: 451, name: v.ast.Array */ ;
@ -57477,8 +57464,8 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
} else if (final_left_sym->kind == v__ast__Kind__array && (string__eq(method_name, _SLIT("first")) || string__eq(method_name, _SLIT("last")) || string__eq(method_name, _SLIT("pop")))) { } else if (final_left_sym->kind == v__ast__Kind__array && (string__eq(method_name, _SLIT("first")) || string__eq(method_name, _SLIT("last")) || string__eq(method_name, _SLIT("pop")))) {
if ((final_left_sym->info)._typ == 451 /* v.ast.Array */) { if ((final_left_sym->info)._typ == 451 /* v.ast.Array */) {
node->return_type = (*final_left_sym->info._v__ast__Array).elem_type; node->return_type = (*final_left_sym->info._v__ast__Array).elem_type;
v__ast__Type _t16 = node->return_type; v__ast__Type _t13 = node->return_type;
return _t16; return _t13;
} }
} else if (v__pref__Backend_is_js(c->pref->backend) && string_starts_with(left_sym->name, _SLIT("Promise<")) && string__eq(method_name, _SLIT("wait"))) { } else if (v__pref__Backend_is_js(c->pref->backend) && string_starts_with(left_sym->name, _SLIT("Promise<")) && string__eq(method_name, _SLIT("wait"))) {
v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((left_sym->info)._v__ast__Struct,(left_sym->info)._typ, 456) /*expected idx: 456, name: v.ast.Struct */ ; v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((left_sym->info)._v__ast__Struct,(left_sym->info)._typ, 456) /*expected idx: 456, name: v.ast.Struct */ ;
@ -57488,31 +57475,31 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
c->table->cur_fn->has_await = true; c->table->cur_fn->has_await = true;
node->return_type = (*(v__ast__Type*)/*ee elem_sym */array_get(info.concrete_types, 0)); node->return_type = (*(v__ast__Type*)/*ee elem_sym */array_get(info.concrete_types, 0));
v__ast__Type_set_flag(node->return_type, v__ast__TypeFlag__optional); v__ast__Type_set_flag(node->return_type, v__ast__TypeFlag__optional);
v__ast__Type _t17 = node->return_type; v__ast__Type _t14 = node->return_type;
return _t17; return _t14;
} else if (left_sym->kind == v__ast__Kind__thread && string__eq(method_name, _SLIT("wait"))) { } else if (left_sym->kind == v__ast__Kind__thread && string__eq(method_name, _SLIT("wait"))) {
v__ast__Thread info = /* as */ *(v__ast__Thread*)__as_cast((left_sym->info)._v__ast__Thread,(left_sym->info)._typ, 481) /*expected idx: 481, name: v.ast.Thread */ ; v__ast__Thread info = /* as */ *(v__ast__Thread*)__as_cast((left_sym->info)._v__ast__Thread,(left_sym->info)._typ, 481) /*expected idx: 481, name: v.ast.Thread */ ;
if (node->args.len > 0) { if (node->args.len > 0) {
v__checker__Checker_error(c, _SLIT("wait() does not have any arguments"), (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).pos); v__checker__Checker_error(c, _SLIT("wait() does not have any arguments"), (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).pos);
} }
node->return_type = info.return_type; node->return_type = info.return_type;
v__ast__Type _t18 = info.return_type; v__ast__Type _t15 = info.return_type;
return _t18; return _t15;
} else if (left_sym->kind == v__ast__Kind__char && v__ast__Type_nr_muls(left_type) == 0 && string__eq(method_name, _SLIT("str"))) { } else if (left_sym->kind == v__ast__Kind__char && v__ast__Type_nr_muls(left_type) == 0 && string__eq(method_name, _SLIT("str"))) {
v__checker__Checker_error(c, _SLIT("calling `.str()` on type `char` is not allowed, use its address or cast it to an integer instead"), v__token__Pos_extend(v__ast__Expr_pos(node->left), node->pos)); v__checker__Checker_error(c, _SLIT("calling `.str()` on type `char` is not allowed, use its address or cast it to an integer instead"), v__token__Pos_extend(v__ast__Expr_pos(node->left), node->pos));
v__ast__Type _t19 = _const_v__ast__void_type; v__ast__Type _t16 = _const_v__ast__void_type;
return _t19; return _t16;
} }
v__ast__Fn method = ((v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.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,.usages = 0,.ctdefine_idx = 0,.source_fn = 0,.language = 0,.file_mode = 0,.is_variadic = 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,.is_conditional = 0,}); v__ast__Fn method = ((v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.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,.usages = 0,.ctdefine_idx = 0,.source_fn = 0,.language = 0,.file_mode = 0,.is_variadic = 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,.is_conditional = 0,});
bool has_method = false; bool has_method = false;
bool is_method_from_embed = false; bool is_method_from_embed = false;
Option_v__ast__Fn _t20; Option_v__ast__Fn _t17;
if (_t20 = v__ast__Table_find_method(c->table, left_sym, method_name), _t20.state == 0) { if (_t17 = v__ast__Table_find_method(c->table, left_sym, method_name), _t17.state == 0) {
v__ast__Fn m = *(v__ast__Fn*)_t20.data; v__ast__Fn m = *(v__ast__Fn*)_t17.data;
method = m; method = m;
has_method = true; has_method = true;
} else { } else {
IError err = _t20.err; IError err = _t17.err;
if (left_sym->kind == v__ast__Kind__struct_ || left_sym->kind == v__ast__Kind__sum_type || left_sym->kind == v__ast__Kind__interface_) { if (left_sym->kind == v__ast__Kind__struct_ || left_sym->kind == v__ast__Kind__sum_type || left_sym->kind == v__ast__Kind__interface_) {
v__ast__Type parent_type = _const_v__ast__void_type; v__ast__Type parent_type = _const_v__ast__void_type;
if ((left_sym->info)._typ == 456 /* v.ast.Struct */) { if ((left_sym->info)._typ == 456 /* v.ast.Struct */) {
@ -57524,9 +57511,9 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
} }
if (parent_type != 0) { if (parent_type != 0) {
v__ast__TypeSymbol* type_sym = v__ast__Table_sym(c->table, parent_type); v__ast__TypeSymbol* type_sym = v__ast__Table_sym(c->table, parent_type);
Option_v__ast__Fn _t21; Option_v__ast__Fn _t18;
if (_t21 = v__ast__Table_find_method(c->table, type_sym, method_name), _t21.state == 0) { if (_t18 = v__ast__Table_find_method(c->table, type_sym, method_name), _t18.state == 0) {
v__ast__Fn m = *(v__ast__Fn*)_t21.data; v__ast__Fn m = *(v__ast__Fn*)_t18.data;
method = m; method = m;
has_method = true; has_method = true;
is_generic = true; is_generic = true;
@ -57536,19 +57523,19 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
if (!has_method) { if (!has_method) {
has_method = true; has_method = true;
Array_v__ast__Type embed_types = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0); Array_v__ast__Type embed_types = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0);
Option_multi_return_v__ast__Fn_Array_v__ast__Type _t22 = v__ast__Table_find_method_from_embeds(c->table, left_sym, method_name); Option_multi_return_v__ast__Fn_Array_v__ast__Type _t19 = v__ast__Table_find_method_from_embeds(c->table, left_sym, method_name);
if (_t22.state != 0) { /*or block*/ if (_t19.state != 0) { /*or block*/
IError err = _t22.err; IError err = _t19.err;
if ((IError_name_table[err._typ]._method_msg(err._object)).len != 0) { if ((IError_name_table[err._typ]._method_msg(err._object)).len != 0) {
v__checker__Checker_error(c, IError_name_table[err._typ]._method_msg(err._object), node->pos); v__checker__Checker_error(c, IError_name_table[err._typ]._method_msg(err._object), node->pos);
} }
has_method = false; has_method = false;
*(multi_return_v__ast__Fn_Array_v__ast__Type*) _t22.data = (multi_return_v__ast__Fn_Array_v__ast__Type){.arg0=((v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.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,.usages = 0,.ctdefine_idx = 0,.source_fn = 0,.language = 0,.file_mode = 0,.is_variadic = 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,.is_conditional = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; *(multi_return_v__ast__Fn_Array_v__ast__Type*) _t19.data = (multi_return_v__ast__Fn_Array_v__ast__Type){.arg0=((v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.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,.usages = 0,.ctdefine_idx = 0,.source_fn = 0,.language = 0,.file_mode = 0,.is_variadic = 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,.is_conditional = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)};
} }
multi_return_v__ast__Fn_Array_v__ast__Type mr_42797 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t22.data); multi_return_v__ast__Fn_Array_v__ast__Type mr_42435 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t19.data);
method = mr_42797.arg0; method = mr_42435.arg0;
embed_types = mr_42797.arg1; embed_types = mr_42435.arg1;
if (embed_types.len != 0) { if (embed_types.len != 0) {
is_method_from_embed = true; is_method_from_embed = true;
node->from_embed_types = embed_types; node->from_embed_types = embed_types;
@ -57559,6 +57546,31 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
} }
} }
if (has_method) { if (has_method) {
v__ast__TypeSymbol* rec_sym = v__ast__Table_sym(c->table, node->left_type);
bool rec_is_generic = v__ast__Type_has_flag(left_type, v__ast__TypeFlag__generic);
if ((rec_sym->info)._typ == 456 /* v.ast.Struct */) {
if (rec_is_generic && node->concrete_types.len == 0) {
node->concrete_types = (*rec_sym->info._v__ast__Struct).generic_types;
} else if (!rec_is_generic && (*rec_sym->info._v__ast__Struct).concrete_types.len > 0 && node->concrete_types.len > 0 && (*rec_sym->info._v__ast__Struct).concrete_types.len + node->concrete_types.len == method.generic_names.len) {
Array_v__ast__Type t_concrete_types = array_clone_to_depth(&node->concrete_types, 0);
node->concrete_types = (*rec_sym->info._v__ast__Struct).concrete_types;
_PUSH_MANY(&node->concrete_types, (t_concrete_types), _t20, Array_v__ast__Type);
}
}
Array_v__ast__Type concrete_types = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0);
for (int _t21 = 0; _t21 < node->concrete_types.len; ++_t21) {
v__ast__Type concrete_type = ((v__ast__Type*)node->concrete_types.data)[_t21];
if (v__ast__Type_has_flag(concrete_type, v__ast__TypeFlag__generic)) {
array_push((array*)&concrete_types, _MOV((v__ast__Type[]){ v__checker__Checker_unwrap_generic(c, concrete_type) }));
} else {
array_push((array*)&concrete_types, _MOV((v__ast__Type[]){ concrete_type }));
}
}
if (concrete_types.len > 0) {
if (v__ast__Table_register_fn_concrete_types(c->table, v__ast__CallExpr_fkey(node), concrete_types)) {
c->need_recheck_generic_fns = true;
}
}
node->is_noreturn = method.is_noreturn; node->is_noreturn = method.is_noreturn;
node->is_ctor_new = method.is_ctor_new; node->is_ctor_new = method.is_ctor_new;
if (!method.is_pub && !c->pref->is_test && !string__eq(method.mod, c->mod)) { if (!method.is_pub && !c->pref->is_test && !string__eq(method.mod, c->mod)) {
@ -57569,9 +57581,9 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
v__checker__Checker_error(c, _SLIT("method with `shared` receiver cannot be called inside `lock`/`rlock` block"), node->pos); v__checker__Checker_error(c, _SLIT("method with `shared` receiver cannot be called inside `lock`/`rlock` block"), node->pos);
} }
if ((*(v__ast__Param*)/*ee elem_sym */array_get(method.params, 0)).is_mut) { if ((*(v__ast__Param*)/*ee elem_sym */array_get(method.params, 0)).is_mut) {
multi_return_string_v__token__Pos mr_43928 = v__checker__Checker_fail_if_immutable(c, node->left); multi_return_string_v__token__Pos mr_44578 = v__checker__Checker_fail_if_immutable(c, node->left);
string to_lock = mr_43928.arg0; string to_lock = mr_44578.arg0;
v__token__Pos pos = mr_43928.arg1; v__token__Pos pos = mr_44578.arg1;
if (!v__ast__Expr_is_lvalue(node->left)) { if (!v__ast__Expr_is_lvalue(node->left)) {
v__checker__Checker_error(c, _SLIT("cannot pass expression as `mut`"), v__ast__Expr_pos(node->left)); v__checker__Checker_error(c, _SLIT("cannot pass expression as `mut`"), v__ast__Expr_pos(node->left));
} }
@ -57588,11 +57600,11 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
string plural = (method.generic_names.len == 1 ? (_SLIT("")) : (_SLIT("s"))); string plural = (method.generic_names.len == 1 ? (_SLIT("")) : (_SLIT("s")));
v__checker__Checker_error(c, str_intp(4, _MOV((StrIntpData[]){{_SLIT("expected "), /*100 &int*/0xfe07, {.d_i32 = method.generic_names.len}}, {_SLIT(" generic parameter"), /*115 &string*/0xfe10, {.d_s = plural}}, {_SLIT(", got "), /*100 &int*/0xfe07, {.d_i32 = node->concrete_types.len}}, {_SLIT0, 0, { .d_c = 0 }}})), node->concrete_list_pos); v__checker__Checker_error(c, str_intp(4, _MOV((StrIntpData[]){{_SLIT("expected "), /*100 &int*/0xfe07, {.d_i32 = method.generic_names.len}}, {_SLIT(" generic parameter"), /*115 &string*/0xfe10, {.d_s = plural}}, {_SLIT(", got "), /*100 &int*/0xfe07, {.d_i32 = node->concrete_types.len}}, {_SLIT0, 0, { .d_c = 0 }}})), node->concrete_list_pos);
} }
for (int _t23 = 0; _t23 < node->concrete_types.len; ++_t23) { for (int _t24 = 0; _t24 < node->concrete_types.len; ++_t24) {
v__ast__Type concrete_type = ((v__ast__Type*)node->concrete_types.data)[_t23]; v__ast__Type concrete_type = ((v__ast__Type*)node->concrete_types.data)[_t24];
Option_void _t24 = v__checker__Checker_ensure_type_exists(c, concrete_type, node->concrete_list_pos); Option_void _t25 = v__checker__Checker_ensure_type_exists(c, concrete_type, node->concrete_list_pos);
if (_t24.state != 0 && _t24.err._typ != _IError_None___index) { if (_t25.state != 0 && _t25.err._typ != _IError_None___index) {
IError err = _t24.err; IError err = _t25.err;
} }
; ;
@ -57600,11 +57612,11 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
if (v__ast__Type_alias_eq(method.return_type, _const_v__ast__void_type) && method.is_conditional && method.ctdefine_idx != _const_v__ast__invalid_type_idx) { if (v__ast__Type_alias_eq(method.return_type, _const_v__ast__void_type) && method.is_conditional && method.ctdefine_idx != _const_v__ast__invalid_type_idx) {
node->should_be_skipped = v__checker__Checker_evaluate_once_comptime_if_attribute(c, (voidptr)&/*qq*/(*(v__ast__Attr*)/*ee elem_sym */array_get(method.attrs, method.ctdefine_idx))); node->should_be_skipped = v__checker__Checker_evaluate_once_comptime_if_attribute(c, (voidptr)&/*qq*/(*(v__ast__Attr*)/*ee elem_sym */array_get(method.attrs, method.ctdefine_idx)));
} }
Option_void _t25 = v__checker__Checker_check_expected_arg_count(c, node, (voidptr)&/*qq*/method); Option_void _t26 = v__checker__Checker_check_expected_arg_count(c, node, (voidptr)&/*qq*/method);
if (_t25.state != 0 && _t25.err._typ != _IError_None___index) { if (_t26.state != 0 && _t26.err._typ != _IError_None___index) {
IError err = _t25.err; IError err = _t26.err;
v__ast__Type _t26 = method.return_type; v__ast__Type _t27 = method.return_type;
return _t26; return _t27;
} }
; ;
@ -57647,21 +57659,21 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
final_arg_sym = v__ast__Table_sym(c->table, final_arg_typ); final_arg_sym = v__ast__Table_sym(c->table, final_arg_typ);
} }
if (v__ast__Type_has_flag(exp_arg_typ, v__ast__TypeFlag__generic)) { if (v__ast__Type_has_flag(exp_arg_typ, v__ast__TypeFlag__generic)) {
Option_v__ast__Type _t27; Option_v__ast__Type _t28;
if (_t27 = v__ast__Table_resolve_generic_to_concrete(c->table, exp_arg_typ, method.generic_names, concrete_types), _t27.state == 0) { if (_t28 = v__ast__Table_resolve_generic_to_concrete(c->table, exp_arg_typ, method.generic_names, concrete_types), _t28.state == 0) {
v__ast__Type exp_utyp = *(v__ast__Type*)_t27.data; v__ast__Type exp_utyp = *(v__ast__Type*)_t28.data;
exp_arg_typ = exp_utyp; exp_arg_typ = exp_utyp;
} else { } else {
IError err = _t27.err; IError err = _t28.err;
continue; continue;
} }
if (v__ast__Type_has_flag(got_arg_typ, v__ast__TypeFlag__generic)) { if (v__ast__Type_has_flag(got_arg_typ, v__ast__TypeFlag__generic)) {
Option_v__ast__Type _t28; Option_v__ast__Type _t29;
if (_t28 = v__ast__Table_resolve_generic_to_concrete(c->table, got_arg_typ, method.generic_names, concrete_types), _t28.state == 0) { if (_t29 = v__ast__Table_resolve_generic_to_concrete(c->table, got_arg_typ, method.generic_names, concrete_types), _t29.state == 0) {
v__ast__Type got_utyp = *(v__ast__Type*)_t28.data; v__ast__Type got_utyp = *(v__ast__Type*)_t29.data;
got_arg_typ = got_utyp; got_arg_typ = got_utyp;
} else { } else {
IError err = _t28.err; IError err = _t29.err;
continue; continue;
} }
} }
@ -57673,9 +57685,9 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
v__checker__Checker_error(c, _SLIT("method with `shared` arguments cannot be called inside `lock`/`rlock` block"), arg->pos); v__checker__Checker_error(c, _SLIT("method with `shared` arguments cannot be called inside `lock`/`rlock` block"), arg->pos);
} }
if (arg->is_mut) { if (arg->is_mut) {
multi_return_string_v__token__Pos mr_47897 = v__checker__Checker_fail_if_immutable(c, arg->expr); multi_return_string_v__token__Pos mr_48547 = v__checker__Checker_fail_if_immutable(c, arg->expr);
string to_lock = mr_47897.arg0; string to_lock = mr_48547.arg0;
v__token__Pos pos = mr_47897.arg1; v__token__Pos pos = mr_48547.arg1;
if (!param_is_mut) { if (!param_is_mut) {
string tok = v__ast__ShareType_str(arg->share); string tok = v__ast__ShareType_str(arg->share);
v__checker__Checker_error(c, str_intp(5, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = node->name}}, {_SLIT("` parameter `"), /*115 &string*/0xfe10, {.d_s = param.name}}, {_SLIT("` is not `"), /*115 &string*/0xfe10, {.d_s = tok}}, {_SLIT("`, `"), /*115 &string*/0xfe10, {.d_s = tok}}, {_SLIT("` is not needed`"), 0, { .d_c = 0 }}})), v__ast__Expr_pos(arg->expr)); v__checker__Checker_error(c, str_intp(5, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = node->name}}, {_SLIT("` parameter `"), /*115 &string*/0xfe10, {.d_s = param.name}}, {_SLIT("` is not `"), /*115 &string*/0xfe10, {.d_s = tok}}, {_SLIT("`, `"), /*115 &string*/0xfe10, {.d_s = tok}}, {_SLIT("` is not needed`"), 0, { .d_c = 0 }}})), v__ast__Expr_pos(arg->expr));
@ -57726,9 +57738,9 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
} }
continue; continue;
} }
Option_void _t29 = v__checker__Checker_check_expected_call_arg(c, got_arg_typ, exp_arg_typ, node->language, *arg); Option_void _t30 = v__checker__Checker_check_expected_call_arg(c, got_arg_typ, exp_arg_typ, node->language, *arg);
if (_t29.state != 0 && _t29.err._typ != _IError_None___index) { if (_t30.state != 0 && _t30.err._typ != _IError_None___index) {
IError err = _t29.err; IError err = _t30.err;
v__ast__TypeSymbol* param_typ_sym = v__ast__Table_sym(c->table, exp_arg_typ); v__ast__TypeSymbol* param_typ_sym = v__ast__Table_sym(c->table, exp_arg_typ);
v__ast__TypeSymbol* arg_typ_sym = v__ast__Table_sym(c->table, got_arg_typ); v__ast__TypeSymbol* arg_typ_sym = v__ast__Table_sym(c->table, got_arg_typ);
if (param_typ_sym->kind == v__ast__Kind__array && arg_typ_sym->kind == v__ast__Kind__array) { if (param_typ_sym->kind == v__ast__Kind__array && arg_typ_sym->kind == v__ast__Kind__array) {
@ -57780,12 +57792,12 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
node->return_type = method.return_type; node->return_type = method.return_type;
} }
if (node->concrete_types.len > 0 && method.return_type != 0 && c->table->cur_fn->generic_names.len == 0) { if (node->concrete_types.len > 0 && method.return_type != 0 && c->table->cur_fn->generic_names.len == 0) {
Option_v__ast__Type _t31; Option_v__ast__Type _t32;
if (_t31 = v__ast__Table_resolve_generic_to_concrete(c->table, method.return_type, method.generic_names, concrete_types), _t31.state == 0) { if (_t32 = v__ast__Table_resolve_generic_to_concrete(c->table, method.return_type, method.generic_names, concrete_types), _t32.state == 0) {
v__ast__Type typ = *(v__ast__Type*)_t31.data; v__ast__Type typ = *(v__ast__Type*)_t32.data;
node->return_type = typ; node->return_type = typ;
v__ast__Type _t32 = typ; v__ast__Type _t33 = typ;
return _t32; return _t33;
} }
} }
if (node->concrete_types.len > 0 && method.generic_names.len == 0) { if (node->concrete_types.len > 0 && method.generic_names.len == 0) {
@ -57799,12 +57811,12 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
} }
} }
} }
v__ast__Type _t33 = node->return_type; v__ast__Type _t34 = node->return_type;
return _t33;
}
v__ast__Type _t34 = method.return_type;
return _t34; return _t34;
} }
v__ast__Type _t35 = method.return_type;
return _t35;
}
if (string__eq(method_name, _SLIT("str"))) { if (string__eq(method_name, _SLIT("str"))) {
if (left_sym->kind == v__ast__Kind__interface_) { if (left_sym->kind == v__ast__Kind__interface_) {
string iname = left_sym->name; string iname = left_sym->name;
@ -57816,25 +57828,25 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
v__checker__Checker_error(c, _SLIT(".str() method calls should have no arguments"), node->pos); v__checker__Checker_error(c, _SLIT(".str() method calls should have no arguments"), node->pos);
} }
v__checker__Checker_fail_if_unreadable(c, node->left, left_type, _SLIT("receiver")); v__checker__Checker_fail_if_unreadable(c, node->left, left_type, _SLIT("receiver"));
v__ast__Type _t35 = _const_v__ast__string_type; v__ast__Type _t36 = _const_v__ast__string_type;
return _t35;
} else if (string__eq(method_name, _SLIT("free"))) {
v__ast__Type _t36 = _const_v__ast__void_type;
return _t36; return _t36;
} else if (string__eq(method_name, _SLIT("free"))) {
v__ast__Type _t37 = _const_v__ast__void_type;
return _t37;
} }
Option_v__ast__StructField _t37; Option_v__ast__StructField _t38;
if (_t37 = v__ast__Table_find_field_with_embeds(c->table, left_sym, method_name), _t37.state == 0) { if (_t38 = v__ast__Table_find_field_with_embeds(c->table, left_sym, method_name), _t38.state == 0) {
v__ast__StructField field = *(v__ast__StructField*)_t37.data; v__ast__StructField field = *(v__ast__StructField*)_t38.data;
v__ast__TypeSymbol* field_sym = v__ast__Table_sym(c->table, v__checker__Checker_unwrap_generic(c, field.typ)); v__ast__TypeSymbol* field_sym = v__ast__Table_sym(c->table, v__checker__Checker_unwrap_generic(c, field.typ));
if (field_sym->kind == v__ast__Kind__function) { if (field_sym->kind == v__ast__Kind__function) {
node->is_method = false; node->is_method = false;
node->is_field = true; node->is_field = true;
v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((field_sym->info)._v__ast__FnType,(field_sym->info)._typ, 483) /*expected idx: 483, name: v.ast.FnType */ ; v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((field_sym->info)._v__ast__FnType,(field_sym->info)._typ, 483) /*expected idx: 483, name: v.ast.FnType */ ;
Option_void _t38 = v__checker__Checker_check_expected_arg_count(c, node, (voidptr)&/*qq*/info.func); Option_void _t39 = v__checker__Checker_check_expected_arg_count(c, node, (voidptr)&/*qq*/info.func);
if (_t38.state != 0 && _t38.err._typ != _IError_None___index) { if (_t39.state != 0 && _t39.err._typ != _IError_None___index) {
IError err = _t38.err; IError err = _t39.err;
v__ast__Type _t39 = info.func.return_type; v__ast__Type _t40 = info.func.return_type;
return _t39; return _t40;
} }
; ;
@ -57847,9 +57859,9 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
array_push((array*)&earg_types, _MOV((v__ast__Type[]){ targ })); array_push((array*)&earg_types, _MOV((v__ast__Type[]){ targ }));
if (i < info.func.params.len) { if (i < info.func.params.len) {
v__ast__Type exp_arg_typ = (*(v__ast__Param*)/*ee elem_sym */array_get(info.func.params, i)).typ; v__ast__Type exp_arg_typ = (*(v__ast__Param*)/*ee elem_sym */array_get(info.func.params, i)).typ;
Option_void _t41 = v__checker__Checker_check_expected_call_arg(c, targ, v__checker__Checker_unwrap_generic(c, exp_arg_typ), node->language, *arg); Option_void _t42 = v__checker__Checker_check_expected_call_arg(c, targ, v__checker__Checker_unwrap_generic(c, exp_arg_typ), node->language, *arg);
if (_t41.state != 0 && _t41.err._typ != _IError_None___index) { if (_t42.state != 0 && _t42.err._typ != _IError_None___index) {
IError err = _t41.err; IError err = _t42.err;
if (!v__ast__Type_alias_eq(targ, _const_v__ast__void_type)) { if (!v__ast__Type_alias_eq(targ, _const_v__ast__void_type)) {
v__checker__Checker_error(c, str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = IError_name_table[err._typ]._method_msg(err._object)}}, {_SLIT(" in argument "), /*100 &int*/0xfe07, {.d_i32 = i + 1}}, {_SLIT(" to `"), /*115 &string*/0xfe10, {.d_s = left_sym->name}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = method_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), arg->pos); v__checker__Checker_error(c, str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = IError_name_table[err._typ]._method_msg(err._object)}}, {_SLIT(" in argument "), /*100 &int*/0xfe07, {.d_i32 = i + 1}}, {_SLIT(" to `"), /*115 &string*/0xfe10, {.d_s = left_sym->name}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = method_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), arg->pos);
} }
@ -57861,35 +57873,35 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal
} }
node->expected_arg_types = earg_types; node->expected_arg_types = earg_types;
node->is_method = true; node->is_method = true;
Option_multi_return_v__ast__StructField_Array_v__ast__Type _t42 = v__ast__Table_find_field_from_embeds(c->table, left_sym, method_name); Option_multi_return_v__ast__StructField_Array_v__ast__Type _t43 = v__ast__Table_find_field_from_embeds(c->table, left_sym, method_name);
if (_t42.state != 0) { /*or block*/ if (_t43.state != 0) { /*or block*/
IError err = _t42.err; IError err = _t43.err;
v__ast__Type _t43 = info.func.return_type;
return _t43;
}
multi_return_v__ast__StructField_Array_v__ast__Type mr_55362 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t42.data);
node->from_embed_types = mr_55362.arg1;
v__ast__Type _t44 = info.func.return_type; v__ast__Type _t44 = info.func.return_type;
return _t44; return _t44;
} }
multi_return_v__ast__StructField_Array_v__ast__Type mr_56012 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t43.data);
node->from_embed_types = mr_56012.arg1;
v__ast__Type _t45 = info.func.return_type;
return _t45;
}
} }
if (!v__ast__Type_alias_eq(left_type, _const_v__ast__void_type)) { if (!v__ast__Type_alias_eq(left_type, _const_v__ast__void_type)) {
Array_string _t45 = {0}; Array_string _t46 = {0};
Array_v__ast__Fn _t45_orig = left_sym->methods; Array_v__ast__Fn _t46_orig = left_sym->methods;
int _t45_len = _t45_orig.len; int _t46_len = _t46_orig.len;
_t45 = __new_array(0, _t45_len, sizeof(string)); _t46 = __new_array(0, _t46_len, sizeof(string));
for (int _t46 = 0; _t46 < _t45_len; ++_t46) { for (int _t47 = 0; _t47 < _t46_len; ++_t47) {
v__ast__Fn it = ((v__ast__Fn*) _t45_orig.data)[_t46]; v__ast__Fn it = ((v__ast__Fn*) _t46_orig.data)[_t47];
string ti = it.name; string ti = it.name;
array_push((array*)&_t45, &ti); array_push((array*)&_t46, &ti);
} }
v__util__Suggestion suggestion = v__util__new_suggestion(method_name,_t45); v__util__Suggestion suggestion = v__util__new_suggestion(method_name,_t46);
v__checker__Checker_error(c, v__util__Suggestion_say(suggestion, unknown_method_msg), node->pos); v__checker__Checker_error(c, v__util__Suggestion_say(suggestion, unknown_method_msg), node->pos);
} }
v__ast__Type _t47 = _const_v__ast__void_type; v__ast__Type _t48 = _const_v__ast__void_type;
return _t47; return _t48;
} }
VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_go_expr(v__checker__Checker* c, v__ast__GoExpr* node) { VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_go_expr(v__checker__Checker* c, v__ast__GoExpr* node) {
@ -60630,7 +60642,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str
Array_v__ast__StructField info_fields_sorted = __new_array_with_default(0, 0, sizeof(v__ast__StructField), 0); Array_v__ast__StructField info_fields_sorted = __new_array_with_default(0, 0, sizeof(v__ast__StructField), 0);
if (node->is_short) { if (node->is_short) {
info_fields_sorted = array_clone_to_depth(&info.fields, 0); info_fields_sorted = array_clone_to_depth(&info.fields, 0);
qsort(info_fields_sorted.data, info_fields_sorted.len, info_fields_sorted.element_size, (int (*)(const void *, const void *))&compare_2892273012681280244_v__ast__StructField_by_i); qsort(info_fields_sorted.data, info_fields_sorted.len, info_fields_sorted.element_size, (int (*)(const void *, const void *))&compare_5995660241070764127_v__ast__StructField_by_i);
} }
Array_string inited_fields = __new_array_with_default(0, 0, sizeof(string), 0); Array_string inited_fields = __new_array_with_default(0, 0, sizeof(string), 0);
for (int i = 0; i < node->fields.len; ++i) { for (int i = 0; i < node->fields.len; ++i) {
@ -85498,6 +85510,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) {
if (is_method && v__ast__Type_has_flag(rec.typ, v__ast__TypeFlag__generic)) { if (is_method && v__ast__Type_has_flag(rec.typ, v__ast__TypeFlag__generic)) {
v__ast__TypeSymbol* sym = v__ast__Table_sym(p->table, rec.typ); v__ast__TypeSymbol* sym = v__ast__Table_sym(p->table, rec.typ);
if ((sym->info)._typ == 456 /* v.ast.Struct */) { if ((sym->info)._typ == 456 /* v.ast.Struct */) {
Array_string fn_generic_names = array_clone_to_depth(&generic_names, 0);
Array_string _t11 = {0}; Array_string _t11 = {0};
Array_v__ast__Type _t11_orig = (*sym->info._v__ast__Struct).generic_types; Array_v__ast__Type _t11_orig = (*sym->info._v__ast__Struct).generic_types;
int _t11_len = _t11_orig.len; int _t11_len = _t11_orig.len;
@ -85508,19 +85521,19 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) {
string ti = v__ast__Table_sym(p->table, it)->name; string ti = v__ast__Table_sym(p->table, it)->name;
array_push((array*)&_t11, &ti); array_push((array*)&_t11, &ti);
} }
Array_string rec_generic_names =_t11; generic_names =_t11;
for (int _t13 = 0; _t13 < rec_generic_names.len; ++_t13) { for (int _t13 = 0; _t13 < fn_generic_names.len; ++_t13) {
string gname = ((string*)rec_generic_names.data)[_t13]; string gname = ((string*)fn_generic_names.data)[_t13];
if (!Array_string_contains(generic_names, gname)) { if (!Array_string_contains(generic_names, gname)) {
array_push((array*)&generic_names, _MOV((string[]){ string_clone(gname) })); array_push((array*)&generic_names, _MOV((string[]){ string_clone(gname) }));
} }
} }
} }
} }
multi_return_Array_v__ast__Param_bool_bool mr_9325 = v__parser__Parser_fn_args(p); multi_return_Array_v__ast__Param_bool_bool mr_9364 = v__parser__Parser_fn_args(p);
Array_v__ast__Param args2 = mr_9325.arg0; Array_v__ast__Param args2 = mr_9364.arg0;
bool are_args_type_only = mr_9325.arg1; bool are_args_type_only = mr_9364.arg1;
bool is_variadic = mr_9325.arg2; bool is_variadic = mr_9364.arg2;
if (is_c2v_variadic) { if (is_c2v_variadic) {
is_variadic = true; is_variadic = true;
} }
@ -85861,9 +85874,9 @@ bool v__parser__Parser_anon_fn_defer_0 = false;
v__parser__Parser_anon_fn_defer_0 = true; v__parser__Parser_anon_fn_defer_0 = true;
p->scope->detached_from_parent = true; p->scope->detached_from_parent = true;
Array_v__ast__Param inherited_vars = (p->tok.kind == v__token__Kind__lsbr ? (v__parser__Parser_closure_vars(p)) : (__new_array_with_default(0, 0, sizeof(v__ast__Param), 0))); Array_v__ast__Param inherited_vars = (p->tok.kind == v__token__Kind__lsbr ? (v__parser__Parser_closure_vars(p)) : (__new_array_with_default(0, 0, sizeof(v__ast__Param), 0)));
multi_return_Array_v__ast__Param_bool_bool mr_18790 = v__parser__Parser_fn_args(p); multi_return_Array_v__ast__Param_bool_bool mr_18829 = v__parser__Parser_fn_args(p);
Array_v__ast__Param args = mr_18790.arg0; Array_v__ast__Param args = mr_18829.arg0;
bool is_variadic = mr_18790.arg2; bool is_variadic = mr_18829.arg2;
for (int _t2 = 0; _t2 < args.len; ++_t2) { for (int _t2 = 0; _t2 < args.len; ++_t2) {
v__ast__Param arg = ((v__ast__Param*)args.data)[_t2]; v__ast__Param arg = ((v__ast__Param*)args.data)[_t2];
if (arg.name.len == 0 && v__ast__Table_sym(p->table, arg.typ)->kind != v__ast__Kind__placeholder) { if (arg.name.len == 0 && v__ast__Table_sym(p->table, arg.typ)->kind != v__ast__Kind__placeholder) {
@ -87422,7 +87435,7 @@ v__ast__Type v__parser__Parser_parse_inline_sum_type(v__parser__Parser* p) {
array_push((array*)&_t1, &ti); array_push((array*)&_t1, &ti);
} }
Array_string variant_names =_t1; Array_string variant_names =_t1;
qsort(variant_names.data, variant_names.len, variant_names.element_size, (int (*)(const void *, const void *))&compare_7932637671395545435_string); qsort(variant_names.data, variant_names.len, variant_names.element_size, (int (*)(const void *, const void *))&compare_14364895672131222426_string);
string name = str_intp(2, _MOV((StrIntpData[]){{_SLIT("_v_anon_sum_type_"), /*115 &string*/0xfe10, {.d_s = Array_string_join(variant_names, _SLIT("_"))}}, {_SLIT0, 0, { .d_c = 0 }}})); string name = str_intp(2, _MOV((StrIntpData[]){{_SLIT("_v_anon_sum_type_"), /*115 &string*/0xfe10, {.d_s = Array_string_join(variant_names, _SLIT("_"))}}, {_SLIT0, 0, { .d_c = 0 }}}));
Array_v__ast__Type _t3 = {0}; Array_v__ast__Type _t3 = {0};
Array_v__ast__TypeNode _t3_orig = variants; Array_v__ast__TypeNode _t3_orig = variants;
@ -94169,7 +94182,7 @@ void v__builder__Builder_cc(v__builder__Builder* v) {
v__builder__Builder_build_thirdparty_obj_files(v); v__builder__Builder_build_thirdparty_obj_files(v);
v__builder__Builder_setup_output_name(v); v__builder__Builder_setup_output_name(v);
if (v->pref->os != v__pref__OS__windows && string_contains(ccompiler, _SLIT("++"))) { if (v->pref->os != v__pref__OS__windows && string_contains(ccompiler, _SLIT("++"))) {
string cpp_atomic_h_path = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("/woodpecker/src/git.rustybever.be/Chewing_Bever/v")}}, {_SLIT("/thirdparty/stdatomic/nix/cpp/atomic.h"), 0, { .d_c = 0 }}})); string cpp_atomic_h_path = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("/woodpecker/src/git.rustybever.be/vieter/v")}}, {_SLIT("/thirdparty/stdatomic/nix/cpp/atomic.h"), 0, { .d_c = 0 }}}));
if (!os__exists(cpp_atomic_h_path)) { if (!os__exists(cpp_atomic_h_path)) {
for (int _t4 = 0; _t4 < v->parsed_files.len; ++_t4) { for (int _t4 = 0; _t4 < v->parsed_files.len; ++_t4) {
v__ast__File* file = ((v__ast__File**)v->parsed_files.data)[_t4]; v__ast__File* file = ((v__ast__File**)v->parsed_files.data)[_t4];
@ -94184,7 +94197,7 @@ void v__builder__Builder_cc(v__builder__Builder* v) {
} }
} }
if (_t5) { if (_t5) {
string cppgenv = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("/woodpecker/src/git.rustybever.be/Chewing_Bever/v")}}, {_SLIT("/thirdparty/stdatomic/nix/cpp/gen.v"), 0, { .d_c = 0 }}})); string cppgenv = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("/woodpecker/src/git.rustybever.be/vieter/v")}}, {_SLIT("/thirdparty/stdatomic/nix/cpp/gen.v"), 0, { .d_c = 0 }}}));
os__execute( str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = os__quoted_path(vexe)}}, {_SLIT(" run "), /*115 &string*/0xfe10, {.d_s = os__quoted_path(cppgenv)}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = os__quoted_path(ccompiler)}}, {_SLIT0, 0, { .d_c = 0 }}}))); os__execute( str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = os__quoted_path(vexe)}}, {_SLIT(" run "), /*115 &string*/0xfe10, {.d_s = os__quoted_path(cppgenv)}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = os__quoted_path(ccompiler)}}, {_SLIT0, 0, { .d_c = 0 }}})));
break; break;
} }