Commit Graph

9678 Commits (340543dfc0f35c99afa734b62ac62c04abf95ed4)

Author SHA1 Message Date
Delyan Angelov 9bbb52e9cc
checker: add a check for `dump(c)`, where `typeof(c) == "char"` 2022-03-24 12:11:59 +02:00
yuyi 78d9975798
ast, cgen: restore Type.str() and fix error for it (#13815) 2022-03-24 11:45:06 +02:00
yuyi 1566f7f766
checker: minor cleanup in check_types.v (#13816) 2022-03-24 08:59:05 +02:00
Delyan Angelov 5b668dba2b
sync: document sync.thread_id() 2022-03-23 19:52:20 +02:00
Delyan Angelov ce576d01c4
sync: add `sync.thread_id() u64 {` (#13810) 2022-03-23 19:19:14 +03:00
Nick Treleaven 2e963e36ac
rand: add `pub fn shuffle<T>(mut a []T) {` function + tests (#13811) 2022-03-23 15:31:26 +02:00
yuyi 35cd8112a5
ast, checker, cgen: fix error for printing alias that has str method (#13809) 2022-03-23 11:52:48 +02:00
Vincenzo Palazzo 8b072aa962
checker: check if generic values have the same types (#13718) 2022-03-23 09:13:10 +02:00
yuyi dff39bac78
cgen: fix error for defining global anonymous functions (#13808) 2022-03-23 08:09:15 +02:00
yuyi e3dca82f9c
strconv: minor cleanup in f64_to_str_lnd1() (#13804) 2022-03-22 20:15:59 +02:00
yuyi 0337882240
checker: check redefine global 'main' function (#13803) 2022-03-22 17:39:12 +02:00
yuyi a9837ba95d
cgen: minor cleanup in go_expr() (#13801) 2022-03-22 12:07:46 +02:00
yuyi 56f5ed4789
strconv: fix error for string interpolation of float format (#13800) 2022-03-22 12:00:18 +02:00
Nick Treleaven afbccf79f7
builtin: don't memdup element for `array.pop` (depends on how cgen works) (#13789)
The voidptr returned is immediately dereferenced in cgen so the memory
is copied before the array can be appended to: `*(int*)array_pop(&a)`
2022-03-21 23:34:35 +02:00
yuyi f66d2f5d43
cgen: simplify in index_of_array() and add test (#13792) 2022-03-21 22:03:45 +02:00
Delyan Angelov 381cf4b61d
ci: bump retries to 3, for flaky vlib/v/tests/go_array_wait_test.v 2022-03-21 21:47:01 +02:00
yuyi c0437afbcd
cgen: fix error for casting int to interface (#13790) 2022-03-21 21:18:11 +02:00
Delyan Angelov 9ad64b0bd8
vweb: support `-d trace_request` and `-d trace_response` 2022-03-21 19:48:47 +02:00
Delyan Angelov 3bae489e35
examples: make the vweb_assets.v example more robust (always change work folder to the folder of the executable). Document the vweb.Context.handle_static behaviour. 2022-03-21 19:05:18 +02:00
yuyi 5815ab8d00
cgen: minor cleanup in index.v (#13788) 2022-03-21 13:10:10 +02:00
yuyi 81bb1ea71f
tests: cleanup go_anon_fn_variable_call_test.v (#13786) 2022-03-21 13:04:43 +02:00
El Koulali András f5036629ca
cgen: add `true` and `false` to C reserved words (#13781) 2022-03-21 11:00:30 +02:00
yuyi d9cca53bd0
checker: check error for index of optional (#13785) 2022-03-21 10:17:57 +02:00
Delyan Angelov 21e9b1deb0 ci: fix -usecache failure on macos 2022-03-21 08:52:25 +02:00
Alexander Medvednikov 80c94ea73e cgen: fix c2v consts in .o files 2022-03-21 04:56:37 +03:00
yuyi c4b424717c
cgen: fix error for map get anon fn value (#13782) 2022-03-21 00:20:55 +02:00
Delyan Angelov caa0e25939
cgen: fix struct type dependency sorting, when struct field types, are aliases to struct types from other modules (#13779) 2022-03-20 20:23:48 +02:00
Delyan Angelov 71edaa071a
builtin: use malloc, instead of calloc in array.ensure_cap/1 2022-03-20 15:08:42 +02:00
yuyi 0a78847782
checker: check error for unknown type in anon fn field of struct (#13778) 2022-03-20 13:28:35 +02:00
yuyi 8c3687aa10
checker: check error for struct field init with nobody anon fn (#13777) 2022-03-20 13:04:31 +02:00
Delyan Angelov 8ab0bcb6aa
Revert "builtin: improve performance for common array ops, based on VTune analysis"
This reverts commit 57db261538.
2022-03-20 12:57:27 +02:00
Delyan Angelov 57db261538
builtin: improve performance for common array ops, based on VTune analysis 2022-03-20 12:42:04 +02:00
yuyi 3e40cd5baa
ast, checker, cgen: fix error for go anon fn variable call (#13776) 2022-03-20 07:45:23 +02:00
Delyan Angelov c05634ebd1
ci: fix sanitize job failures after 02b889d 2022-03-19 21:45:58 +02:00
Delyan Angelov 02b889dac3
cgen: generate smaller switch statements for sumtypes/enums with else{} 2022-03-19 21:12:27 +02:00
Delyan Angelov eb7c9cec3d
parser: short circuit if conditions in Parser.name_expr 2022-03-19 20:31:03 +02:00
Delyan Angelov 4dd68d3965
ast: small cleanup of using simple string interpolation in a string builder .write_string/1 parameter 2022-03-19 17:25:53 +02:00
Delyan Angelov 0cc63107ff
cgen: fix duplicate auto generation of free methods, add test 2022-03-19 01:01:08 +02:00
Delyan Angelov ee6b23c2a7
toml: use toml.parse_text and toml.parse_file in the tests 2022-03-18 23:32:06 +02:00
yuyi 5237d1d446
cgen: fix error for empty interface (#13764) 2022-03-18 22:41:06 +02:00
Larpon 156efec278
toml: deprecate input.auto_config() and toml.parse() (#13770) 2022-03-18 22:33:51 +02:00
yuyi 3e41be1ff4
checker: minor cleanup in check_or_last_stmt() (#13763) 2022-03-18 22:27:53 +02:00
Delyan Angelov 1734e72638
v.vmod: make the v.mod parser more robust, show line numbers in errors, add tests 2022-03-18 22:23:11 +02:00
yuyi 5f79fa8a30
checker: handle invalid smartcast with if/match none ident or selector (fix #12317) (#13762) 2022-03-18 17:50:54 +03:00
Nick Treleaven f903ef24e8
cgen: simplify slicing fixed array (#13767) 2022-03-18 17:50:30 +03:00
yuyi bb2ddb98a3
parser: check if guard condition (#13765) 2022-03-18 17:49:20 +03:00
Delyan Angelov 54b0a2aa62
toml: fix toml.scanner.new_simple/1 to *always* create a scanner, based on text, not a file path 2022-03-18 16:14:44 +02:00
Delyan Angelov 0ca87ad09f
parser: fix small performance regression after 1d83ab6b (by avoiding needless interpolation in hot paths) 2022-03-18 12:52:03 +02:00
Delyan Angelov 817bedec5d
checker: show available sumtype variants in match branches on typos 2022-03-18 11:50:28 +02:00
Nick Treleaven 00563a130d
cgen: fix double evaluation of rvalue array expression in slice (#13737) 2022-03-18 11:43:15 +02:00
Hunam 8a2d3f6470
strings: add a `Builder.ensure_cap()` method (#13755) 2022-03-18 10:36:53 +02:00
yuyi 136f39a2d4
cgen: cleanup in if_expr() (#13754) 2022-03-17 01:09:49 +02:00
Delyan Angelov 7a4715288c
checker: make the errors for call expression shared/mut mismatches more detailed 2022-03-16 22:45:35 +02:00
yuyi 7f62346213
cgen: fix error for if expr returning sumtype (#13752) 2022-03-16 15:43:17 +02:00
yuyi 315e07abf6
checker: minor cleanup in match_expr() (#13753) 2022-03-16 15:39:57 +02:00
yuyi 33167960ed
checker: check the sumtype mismatch returned by match expr (#13751) 2022-03-16 09:31:38 +02:00
yuyi 57cba4d3f0
ast: minor cleanup in is_blank_ident() (#13748) 2022-03-16 09:30:37 +02:00
Delyan Angelov 089c93b613
x: add a mostly empty vlib/x/x.v file, to workaround a `v doc` bug
The bug is that `v doc` ignores README.md in a folder without .v files,
leading to tree nodes with empty # links and no content.
2022-03-15 20:19:39 +02:00
yuyi 49155ec312
parser: notice unnecessary parenthesis of reference (fix #11179) (#13739) 2022-03-15 16:11:53 +02:00
yuyi 92cafd8851
checker: check invalid 'mut' keyword in infix expr (#13742) 2022-03-15 14:50:17 +03:00
yuyi 1d83ab6be1
parser: check using invalid keyword with none ident (#13743) 2022-03-15 12:58:03 +02:00
playX 78b1cbefff
builtin.wasm_bare: fix malloc invocation (#13740) 2022-03-15 12:55:39 +02:00
Nick Treleaven 34dd4f34ab
checker: fix cgen error on sliced references (#13736) 2022-03-14 19:52:37 +02:00
yuyi ea3c0166c0
ast: fix error for typeof aggregate (#13735) 2022-03-14 18:42:47 +02:00
yuyi dbb18e3656
parser: fix error for match branch with array expression (#13733) 2022-03-14 16:19:05 +02:00
pancake a1d0db792e
native: initial support for typeof() expressions (#13730) 2022-03-14 15:15:06 +02:00
kylepritchard a8f6574471
math: allow i64 in digits function and add count_digits function (#13729) 2022-03-14 10:41:01 +02:00
playX c8b0f51c13
builtin.wasm_bare: use walloc as malloc/free implementation (#13731) 2022-03-14 09:20:20 +02:00
yuyi f7feb634d2
checker: fix error for if mut with immutable variable (#13728) 2022-03-13 16:33:50 +02:00
Mihai Galos 9495aacf3e
datatypes.fsm: add a fsm_graph.v tool (#13723) 2022-03-13 11:40:03 +02:00
Adam Oates 424ef0b2b8
stbi: fixed panic when trying to load JPG (#13724) 2022-03-13 09:57:34 +02:00
yuyi 27f9bc9ba0
checker: check error for match mut with immutable variable (fix #9704 #8976) (#13725) 2022-03-13 09:53:29 +02:00
Delyan Angelov 83762fa4a4
native: align the disassembly/comment column in the `-v -b native` output 2022-03-12 11:09:09 +02:00
Subhomoy Haldar 40504e8600
rand: further bridge gap b/w rand module and PRNG interface (#13719) 2022-03-12 09:41:12 +02:00
Delyan Angelov a3e9409196
strconv: fix a double free bug in v_sprintf/remove_tail_zeros_old, reduce leaks 2022-03-11 19:32:08 +02:00
yuyi 795fe5844c
strconv: fix strconv.v_printf() (#13716) 2022-03-11 17:00:57 +02:00
yuyi 10ab758aa7
ast: minor cleanup in pref_arch_to_table_language() (#13714) 2022-03-11 14:56:48 +02:00
Delyan Angelov 8dc4b1d9a3
builtin: use malloc_noscan more (for map metas and in []byte.hex()) 2022-03-11 11:26:22 +02:00
yuyi 1993bf2a12
parser: cleanup map syntax (#13713) 2022-03-11 12:15:52 +03:00
yuyi c1c3ae2a18
parser: minor cleanup in fn_args() (#13711) 2022-03-11 10:42:03 +02:00
yuyi 3f351036a2
parser: fix error for fn with type only argument (fix #13704) (#13709) 2022-03-10 22:52:06 +02:00
yuyi dd06698ee3
ast: rename TypeSymbol.is_public to TypeSymbol.is_pub (#13710) 2022-03-10 22:18:57 +02:00
Delyan Angelov f3388df577
ci: fix dump_expression.vv when v is actually vprod (-‸ლ) 2022-03-10 18:13:00 +02:00
Delyan Angelov e8c8f0e7c0
v.ast: fix `dump(os.real_path(Makefile))` printing `main.os.real_path` 2022-03-10 11:24:46 +02:00
Nick Treleaven 4bea35b028
vlib/arrays: fix `copy` to not use memcpy for array, map, string (#13703) 2022-03-10 01:30:51 +03:00
JalonSolov de2fc87995
os: handle trailing backslash on windows path when quoting (#13705) 2022-03-10 01:29:37 +03:00
Nick Treleaven 7231a3f135
vlib: add `mut` for the first parameter of builtin.copy, arrays.copy and crypto (#13702) 2022-03-09 20:26:00 +02:00
yuyi 4c33003f86
checker: check error for infix compare optional (#13701) 2022-03-09 20:20:21 +02:00
Nick Treleaven 54de04a916
arrays: improve fold/reduce docs (#13700) 2022-03-09 20:04:49 +02:00
yuyi 6c7243f2f7
checker: remove redundant 'c.expected_type = ast.void_type' (#13687) 2022-03-09 12:33:23 +02:00
Mihai Galos d5b087de10
vlib: add a datatypes.fsm module (#13668) 2022-03-09 12:14:54 +02:00
pancake 3f1e232c9b
native: support comparing two idents and avoid printing idents (#13686) 2022-03-08 19:52:30 +02:00
Delyan Angelov 10474f35f6
net.http: clarify error message in Request.ssl_do 2022-03-08 18:17:34 +02:00
yuyi 3fe8204062
checker: fix if expr with enum value (#13685) 2022-03-08 11:55:17 +02:00
Delyan Angelov f6aba9a3fe
util: make check_module_is_installed more robust to ~/.vmodules paths with spaces 2022-03-08 11:33:03 +02:00
yuyi cea3149369
checker: fix match expr with enum type value (#13683) 2022-03-08 09:50:17 +02:00
Nick Treleaven 17fcc788f2
arrays: add generic copy fn (#13677) 2022-03-08 09:44:04 +02:00
Delyan Angelov beb1b8ce1b
tools: add `v scan file.v` 2022-03-07 18:25:38 +02:00
pancake b20c911d3e
native: generate relocatable ELFs and support relative strings (#13671) 2022-03-07 18:24:01 +02:00
yuyi e6270b05dc
checker: check unsigned integer compared with negative value (#13670) 2022-03-07 10:26:40 +02:00