Commit Graph

9831 Commits (9c9b50933cd3653da4e58af0028738e38be7db13)

Author SHA1 Message Date
yuyi 473bc0254d
checker: check error for array of generic struct init (#13987) 2022-04-09 21:50:34 +03:00
Delyan Angelov 89d64b21ea
ci: remove manual free(f) in an autofree test, after 58febe46, which does it automatically now 2022-04-09 20:06:27 +03:00
Delyan Angelov df30b79971
checker: allow for `arr.any(opt_fn()?)`, add test 2022-04-09 19:50:10 +03:00
Daniel Oberhoff 58febe4607
cgen: fix autofree of heap variables (#13823) 2022-04-09 17:37:39 +03:00
yuyi 704e3c6e72
cgen: fix error for fn with fixed array argument (fix #13976) (#13982) 2022-04-09 15:57:27 +03:00
Delyan Angelov 60e718e7c6 test: save removing the nonexistent binary output for v fmt and v vet tests 2022-04-09 13:04:52 +03:00
Vincenzo Palazzo 2d867a2766
ast: fix reported errors, when arrays of types defined in modules are involved (#13952) 2022-04-08 17:38:34 +03:00
yuyi 2a88b313d4
cgen: format json encode/decode generated c codes (#13972) 2022-04-08 17:27:05 +03:00
yuyi 617608b23d
cgen: fix optional struct declarations for empty structs (#13970) 2022-04-08 14:51:37 +03:00
Larpon 45a427e68b
clipboard: fix segfault when pasting to some X11 apps. Fixes #13891 (#13971) 2022-04-08 13:32:38 +03:00
Larpon 52f1c615a6
fontstash: document all functions (#13969) 2022-04-08 13:22:23 +03:00
Joe Conigliaro a0c07454b1
checker: remove debug code from previous commit 2022-04-08 18:27:14 +10:00
Joe Conigliaro 426e9d1734
checker: fix condition for checking if tmpl var is inherited 2022-04-08 18:25:08 +10:00
Joe Conigliaro e1c8b07fa5
checker/tests: format test added in prev commit & rename chekcer prop 2022-04-08 17:41:23 +10:00
Joe Conigliaro 8dc2601080
all: comptime_call - simplify tmpl scoping, solves many issues. 2022-04-08 17:33:24 +10:00
Delyan Angelov 5a695c81dc
ci: fix the recorded output for compare_structs.c.must_have after eea46c4 2022-04-07 18:08:56 +03:00
crthpl b232a3b0d1
cgen: fix `.filter()` and `.map()` on shared arrays (#13954) 2022-04-07 18:05:11 +03:00
Delyan Angelov eea46c4e1a
cgen: fix error, when a struct with over 8 fields, is used as a method receiver directly. 2022-04-07 17:20:14 +03:00
Subhomoy Haldar 022fae1e7f
rand: make mt19937 automatically seeded, add seed_len to wyrand (#13966) 2022-04-07 16:00:30 +03:00
playX 6a820c2845
checker: allow all binary operations when translating code produced by c2v (#13964) 2022-04-07 12:22:24 +03:00
yuyi e7fd8c4e7c
cgen: fix error for dereference mut interface in loop (fix #13913) (#13941) 2022-04-07 12:01:54 +03:00
yuyi a58dde48f8
cgen: fix error for optional multi return (#13959) 2022-04-07 09:12:23 +03:00
yuyi c9dcdf6744
cgen: fix json decode with optional argument (fix #13943) (#13958) 2022-04-06 19:34:22 +03:00
Larpon 56e6fd01c5
gg: document pub functions in text_rendering and m4/vector (#13961) 2022-04-06 19:34:02 +03:00
Delyan Angelov c5d8d27b90 ci: fix -cstrict failures for vweb_test.v etc. 2022-04-06 08:54:01 +03:00
Vincenzo Palazzo 6412f8ba0b
checker: add a known error on alias cast with generics (#13946) 2022-04-05 19:09:46 +03:00
Larpon 1482db6d1a
gg: add missing doc strings to android, recorder and gg.c.v (#13936) 2022-04-05 18:42:01 +03:00
Vincenzo Palazzo 359f16fdfd
parser: fixed parsing prototype function with recursive type (#13922) 2022-04-05 18:39:49 +03:00
yuyi 0cba579a7b
cgen: simplify codegen for optional consts (#13948) 2022-04-05 17:54:23 +03:00
Delyan Angelov 2ecfd1b351
ci: fix clang sanitize errors for json_decode 2022-04-05 17:52:10 +03:00
Larpon 11ccf06441
time: add missing doc string to parse.v (#13933) 2022-04-05 13:21:37 +03:00
Larpon 2350dbbd57
gg: add missing doc strings to pub fns in image.* (#13934) 2022-04-05 13:21:03 +03:00
Larpon 0b046c14a8
clipboard: add doc strings to all implementations (#13932) 2022-04-05 13:06:32 +03:00
Delyan Angelov f5e4d17cf3
json: return errors with more context, on failed json.decode() calls. 2022-04-05 12:06:08 +03:00
yuyi f6b8e1e13f
cgen: fix error for const using nested optionals (#13939) 2022-04-05 05:58:11 +03:00
Delyan Angelov 0bd8fbc9a8 term, term.ui: fix a panic on !=linux unixes when running examples/term.ui/ 2022-04-04 19:25:25 +03:00
Nick Treleaven 2cd9c91e98
vdoc: highlight terminal examples for `-comments -color` (#13937) 2022-04-04 18:13:24 +03:00
Larpon aa9e2ebb25
gg: document all draw functions (#13931) 2022-04-04 18:09:19 +03:00
pancake 5369379738
repl: handle exit(n) (#13930) 2022-04-04 16:22:34 +03:00
Alexander Medvednikov 92bfd9b353 cgen: fixed array index for translated code 2022-04-04 12:09:29 +03:00
StunxFS 725b472d37
checker: fix typos (#13929) 2022-04-04 10:07:53 +03:00
Nick Treleaven 91b40304b7
vdoc: highlight `..`, `...` as punctuation & postfix ops as operators (#13924) 2022-04-04 09:21:54 +03:00
Alexander Medvednikov 719a3b5de3 cgen: fix fixed arrays assignment in translated code 2022-04-04 06:20:54 +03:00
Alexander Medvednikov a55e930c00 checker: fix pointer checks in translated code 2022-04-04 05:35:15 +03:00
Alexander Medvednikov cc227d8520 checker: fix non-numeric type check for translated code 2022-04-04 04:59:14 +03:00
Nick Treleaven d10135e2c4
vdoc: HTML highlight generic function as function, not name (#13923) 2022-04-03 23:41:02 +03:00
Delyan Angelov 44603f8e59
checker: add suggestions for misspelled `mod.func_name()` calls 2022-04-03 20:07:52 +03:00
Vincenzo Palazzo 51c1d666c2
checker: fix operator overloads (for large structs with > 8 fields, the method receiver is normally auto converted to a reference) (#13889) 2022-04-03 19:30:29 +03:00
StunxFS 38853568b4
encoding.csv: allow passing a custom delimiter to the `new_reader` function (#13910) 2022-04-03 19:13:43 +03:00
Nick Treleaven 782d5374c9
builtin: add an `array.drop(n)` method (#13907) 2022-04-03 17:05:50 +03:00
Delyan Angelov a1e9cae5d2
tests: add a vlib/v/tests/known_errors/known_errors_test.v test runner 2022-04-03 12:54:22 +03:00
yuyi 0497b885dc
checker: minor cleanup in find_unreachable_statements_after_noreturn_calls() (#13903) 2022-04-03 11:19:19 +03:00
yuyi 8c55a9ecd3
builtin: minor optimization of array.push() and array.push_noscan() (#13904) 2022-04-03 11:04:18 +03:00
Cameron Katri 340543dfc0
cli: add automatic manpage generation with -man (#13911) 2022-04-03 10:12:47 +03:00
Delyan Angelov 71dc6c224a
tests: make vlib/net/udp_test.v more stable, and less noisy on the tests-sanitize-address-gcc job 2022-04-02 20:00:26 +03:00
Cameron Katri d585fbea8a
time: implement Time.strftime(fmt string) as a wrapper for strftime(3) (#13898) 2022-04-02 18:33:37 +03:00
Nick Treleaven 42f92db0ab
v.doc: parse multi-line examples (so they get highlighted) (#13894) 2022-04-02 18:29:12 +03:00
yuyi faa55b46de
cgen: fix array of fixed array (fix #13895) (#13901) 2022-04-02 18:00:59 +03:00
yuyi 0bf0c73a49
checker: fix error for returning optional (#13902) 2022-04-02 17:25:01 +03:00
pancake af79c1e6ef
os: implement os.config_dir() like in Go's UserConfigDir (#13893) 2022-04-01 22:04:43 +03:00
Vincenzo Palazzo d7817863c6
checker: type inference over a generic type should compile (#13824) 2022-04-01 19:31:27 +03:00
Delyan Angelov 9d2529b611
ci: reduce repetitions in test_global_mutex in init_global_test.v
With the old number of repetitions (2500000), that test alone could take over
30 seconds, in the CI environment.
2022-04-01 19:23:15 +03:00
yuyi 6987f2c087
time: fix error for time.local() on windows (#13892) 2022-04-01 17:16:46 +03:00
Vincenzo Palazzo 02c80bd445
time: fix repetitive time.now().local().local().local() offsetting the time further and further (#13861) 2022-04-01 00:11:17 +03:00
yuyi bc98c11d9d
parser, checker, cgen: minor cleanup of go_expr() (#13875) 2022-03-31 19:58:04 +03:00
yuyi db3bbb58cf
cgen: fix error for cross assign of the reserved name variable (#13884) 2022-03-31 19:55:21 +03:00
Nick Treleaven a87cd9663e
vdoc: highlight inline examples for `-f html` (#13879) 2022-03-31 19:32:32 +03:00
R cqls 5c43493183
sokol: add support for compiling with `-d darwin_sokol_glcore33` on macos (#13885) 2022-03-31 16:52:21 +03:00
Cameron Katri b15240185e
builder,cgen: iOS fixes (#13883) 2022-03-31 11:51:13 +03:00
kylepritchard 6137ce23c0
math: allow `acos(0)` (fix #13876) (#13877) 2022-03-30 21:36:50 +03:00
yuyi ae1cb5697e
cgen: minor cleanup in ref_or_deref_arg() (#13874) 2022-03-30 21:06:38 +03:00
yuyi d40a502981
checker: minor cleanup in fn_call() (#13873) 2022-03-30 21:05:17 +03:00
Subhomoy Haldar 7ef7188f4b
math.big: add bit_len, optimize gcd, add documentation (#13872) 2022-03-30 15:52:09 +03:00
Delyan Angelov 8121a8ada0 ci,cgen: comment out including stdbool.h for now
Fails tcc tests on windows, see: https://github.com/vlang/v/runs/5749951315?check_suite_focus=true
and vlib/v/checker/tests/globals_run/function_stored_in_global.vv
2022-03-30 14:26:20 +03:00
Delyan Angelov 566735b298 cgen: add `nil` to c_reserved (it is a macro defined in MacTypes.h on macos) 2022-03-30 13:33:03 +03:00
Cameron Katri 093994655c
v.builder: fix iOS compilation from non-macOS, allow -cc to override the default cross compiler (#13866) 2022-03-30 10:26:13 +03:00
Cameron Katri 3e69d3813b
v.builder: fix linker flags for systems with Procursus (#13865) 2022-03-30 10:15:52 +03:00
Delyan Angelov cc637e5ee8
checker: make the misssing shared/mut modifer in fn and method calls error clearer 2022-03-30 01:45:40 +03:00
yuyi 55d9464890
checker: fix error for marking as referenced (#13859) 2022-03-30 01:33:10 +03:00
yuyi 42a67831bf
parser: fix printing slice of multiline raw string (#13856) 2022-03-29 18:06:11 +03:00
yuyi c71770d9c5
checker: fix error for array of anon fn call (#13858) 2022-03-29 18:04:30 +03:00
Delyan Angelov 04cc037955
ci: fix -cstrict compilation of term.ui tests 2022-03-29 18:03:05 +03:00
Delyan Angelov 7ee93c8a20
docs: show the full information for deprecated functions 2022-03-29 15:17:55 +03:00
yuyi fd34ebd84e
checker: check the count of generics in fn arguments (#13855) 2022-03-29 10:04:19 +03:00
Delyan Angelov 4f551d76c0 term.ui: fix conflicting C struct declarations when compiling programs, importing term.ui before term, on windows 2022-03-29 09:31:24 +03:00
yuyi 509367b293
cgen: minor cleanup in expr_is_multi_return_call() (#13846) 2022-03-28 20:38:23 +03:00
yuyi dd1a8cbadc
parser: check error for struct field type using 'mut' (#13847) 2022-03-28 18:13:38 +03:00
yuyi 62553dcc2e
cgen: fix crash for casting bool to int (fix #13825) (#13844) 2022-03-28 12:20:47 +03:00
Subhomoy Haldar f75ce9dd82
rand: move functions from rand.util to the main module (#13840) 2022-03-27 17:38:59 +03:00
yuyi 875ad1f6ea
ast: minor cleanup in ast.v (#13839) 2022-03-27 16:21:40 +03:00
Nick Treleaven 02f72c8230
builtin: improve docs for array methods that take an `it` expression, like .map, .filter etc (#13836)
Move explanation about boolean `it` expressions to `filter`, as `sort`
doesn't take a boolean expression. Also move `any` example.
Add 2 filter examples.
Add map example from docs.md.
2022-03-27 14:28:15 +03:00
Delyan Angelov 0e496a8de2
tests: add an autofree regression test before return value ownership changes 2022-03-27 09:50:37 +03:00
Delyan Angelov bea0d500d0
parser: ignore upper letter case restriction for `fn C.xyz` declarations 2022-03-26 21:20:28 +02:00
Nick Treleaven fcb57312b9
parser: error if parameter name starts with a capital (#13827) 2022-03-26 19:56:34 +02:00
Delyan Angelov 8c396356bb
context: make the examples in the vlib/context/README.md immediately runnable 2022-03-26 13:25:45 +02:00
Delyan Angelov 7f28d91190 ci: fix again -usecache regression on macos 2022-03-26 09:47:44 +02:00
Alexander Medvednikov 0248349e7c cgen: global/const fixes 2022-03-25 23:33:01 +03:00
Nick Treleaven ea4410cdb5
builtin: document the rune.length_in_bytes method (#13826) 2022-03-25 20:09:39 +02:00
Delyan Angelov 347db755c8
tests: sort the test files before further processing in valgrind_test.v 2022-03-25 09:41:45 +02:00
Delyan Angelov ddc2c49365
cgen: autofree out of scope variables in reverse order of their creation 2022-03-25 09:39:12 +02:00
Delyan Angelov d6c40865f9
strings: cleanup unsafe casts in some of strings.Builder ops (#13819) 2022-03-25 00:07:15 +02:00
Delyan Angelov 5b492e26dd
builtin: support a.flags.set(.noslices | .noshrink), use it in the particles example (#13818) 2022-03-24 23:37:13 +02:00
Nick Treleaven a4ab3c1f14
checker: disallow `mut_ptr = &immutable_var` (#13814) 2022-03-24 20:43:25 +02:00
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