1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

Compare commits

...

3569 Commits

Author SHA1 Message Date
Spydr
1b721250e0 native: enable printing for all supported expressions (#16270) 2022-10-31 17:43:02 +02:00
yuyi
339bd0c4b5 checker: check fn type mismatch of return result type fn (#16269) 2022-10-31 14:05:43 +02:00
shove
c3e209a634 scanner: prevent resolving to nested interpolation (fix #16240) (#16259) 2022-10-31 10:47:32 +02:00
Delyan Angelov
4a7a4b9ec5 docs: improve the package related sections; describe VMODULES. 2022-10-31 10:13:18 +02:00
Mykhailo
cd4a999e80 examples: add custom_error.v, that shows how to match over possible errors (#16265) 2022-10-31 09:56:41 +02:00
yuyi
0390a7a988 cgen: fix return match expr of sumtype result (#16264) 2022-10-30 20:26:33 +02:00
yuyi
64cbadc6f1 scanner: fix new string interpolation println('{a}{b}{c}{d}') (#16258) 2022-10-30 20:18:31 +02:00
Delyan Angelov
914f03a1a2 doc: document the -no-bounds-checking option in v help build 2022-10-30 15:05:02 +02:00
Delyan Angelov
9edb48571f pref,cgen: support -no-bounds-checking, instead of -d no_bounds_checking, and make it enable direct_array_access for all fns/methods. 2022-10-30 14:39:45 +02:00
lemon
54b623743d native, checker: cast float_literal to f32 explicitly in code gen (#16254) 2022-10-30 10:31:18 +02:00
shove
93d765eeee cgen: fix dump() multi ptr (fix #16247) (#16251) 2022-10-29 10:07:28 +03:00
Swastik Baranwal
a988ef3474 checker: add check for mut ident but not if mut ident is for interfaces (#16214) 2022-10-29 06:36:44 +03:00
yuyi
ee782e9119 checker: fix return error with multi_return optional (#16250) 2022-10-29 06:34:45 +03:00
Hitalo Souza
78c4b9a7bb doc: one single file for vweb (#16248) 2022-10-29 06:33:48 +03:00
Delyan Angelov
02c3af2432 all: add support for enum Xyz as u64 { + tests (#16246) 2022-10-29 06:32:20 +03:00
Delyan Angelov
4564a47fbc .gitignore: ignore Visual Studio's .vs/ folder 2022-10-28 22:40:47 +03:00
Grantley Cullar
21d18b0792 doc: fix typos (#16239) 2022-10-28 22:27:38 +03:00
Delyan Angelov
a0a055cc4c ci: fix failures after c6158e4 2022-10-28 21:52:52 +03:00
Alexander Medvednikov
c6158e4519 all: remove unnecessary IError() casts 2022-10-28 19:08:30 +03:00
yuyi
daa2f90023 scanner: fix and resotre string interpolation tests (#16242) 2022-10-28 18:39:32 +03:00
shove
5daa38fdb1 util: fix smart_quote, so that v -cstrict file.v works with println('\\$') (fix #16230) (#16233) 2022-10-28 12:41:13 +03:00
StunxFS
ef1696b3e1 v.util: add path_styled_for_error_messages/1 (#16219) 2022-10-28 11:27:00 +03:00
shove
af56719f9d fmt: fix compiler_error('...') broken by fmt (fix #16218) (#16231) 2022-10-28 06:48:09 +03:00
StunxFS
219079e3a6 v.eval: consistency in commit hash shown on panic (#16227) 2022-10-28 06:47:50 +03:00
shove
c5ee33b7aa cgen: fix comparing struct with pointers to interface values (fix #16074) (#16215) 2022-10-28 06:47:31 +03:00
yuyi
992106c6f7 tests: fix ci errors temporary (#16237) 2022-10-28 06:46:20 +03:00
yuyi
0ca5b1f6ff cgen: fix $tmpl() in returning match expr (fix #16109, fix #16124) (#16229) 2022-10-27 18:03:27 +03:00
Alexander Medvednikov
e356a74a4c tests: disable a single string interpolation test for now 2022-10-27 18:02:25 +03:00
Alexander Medvednikov
cc58d6a919 all: string interpolation fixes 2022-10-27 17:52:30 +03:00
kahsa
d653716292 doc: add global variables link (#16228) 2022-10-27 13:09:05 +03:00
Alexander Medvednikov
098db89b85 encoding.csv: remove unnecessary IError() cast 2022-10-27 11:30:08 +03:00
Alexander Medvednikov
c9934672c4 http: fix request_test.v 2022-10-27 11:28:44 +03:00
Alexander Medvednikov
a134c09718 os: fix font.v compilation 2022-10-27 11:13:43 +03:00
Alexander Medvednikov
e1ffc76efd tests: fix some interpolation tests 2022-10-27 11:12:15 +03:00
Alexander Medvednikov
604f19adba scanner: : str inter fix 2022-10-27 11:08:32 +03:00
Alexander Medvednikov
18c7da9a5e all: new string interpolation "hello {name}!" 2022-10-27 11:01:01 +03:00
StunxFS
e6fad82b87 v.eval: support unsafe expr (#16224) 2022-10-27 10:38:57 +03:00
kahsa
ce2c732db8 doc: move the Attributes subsection at the start of its parent section (#16183) 2022-10-26 23:28:37 +03:00
Delyan Angelov
41c85661ef fix quadratic execution of VAUTOFIX=1 v check-md . when a long .md file has many examples, that have to be corrected. 2022-10-26 22:47:58 +03:00
Delyan Angelov
007430ef2b tools: support VAUTOFIX=1 v check-md vlib/term/README.md for fixing unformatted examples without manual edits 2022-10-26 21:51:10 +03:00
yuyi
064e35fbc4 parser: fix $tmpl with single quotes (fix #16154) (#16216) 2022-10-26 19:38:08 +03:00
boons
a19a4ba299 examples: add a tiny brainvuck interpreter (#16213) 2022-10-26 19:31:15 +03:00
yuyi
992b502198 db, json, time, term: change optional to result (#16201) 2022-10-26 11:26:28 +03:00
lemon
2a7420f572 native: add initial support for f32/f64 (#16210) 2022-10-26 10:37:46 +03:00
shove
fef4dd94e9 ast, checker, cgen: enable unsafe { nil } with reference to interface fields in structs (fix #16198) (#16199) 2022-10-26 09:39:23 +03:00
yuyi
53c6e46a51 parser: correct comptime path not found error position (fix #16189) (#16209) 2022-10-26 09:33:58 +03:00
Alexander Medvednikov
572e26204e changelog: some 0.3.2 features 2022-10-26 02:34:54 +03:00
Delyan Angelov
b2ab7a333b transformer: improve -trace-calls output, enable tracing of builtin fns, show elapsed ns and used stack size (#16205)
Make it easier to change later, by splitting the tracing call into its own `v.trace_calls` module, so that it can be iterated upon without changing the compiler itself.
2022-10-25 20:56:12 +03:00
yuyi
03bef24456 checker: fix returning embedded error result (#16208) 2022-10-25 18:17:48 +03:00
StunxFS
76606598c3 cleanup: delete database.db in project root folder (#16190) 2022-10-25 10:43:17 +03:00
kahsa
779cc33825 doc: rename module to package, when it comes to all VPM commands like v install etc (#16180) 2022-10-24 18:00:55 +03:00
kahsa
d3fcb6bca0 doc: add a subheading for creating new modules (#16188) 2022-10-24 17:56:34 +03:00
Delyan Angelov
00ec41e0a9 ci: small fix for docs.md 2022-10-24 17:32:01 +03:00
Alexander Medvednikov
690b2c0b9d doc: more Result fixes 2022-10-24 16:26:19 +03:00
Alexander Medvednikov
2c9e890c3d doc: document the Option/Result split 2022-10-24 16:11:20 +03:00
yuyi
4aa4af4afb cgen: fix vweb app route methods filtering (#16186) 2022-10-24 12:51:20 +03:00
kahsa
26c737b6db doc: move goto section under statements (#16179) 2022-10-24 12:09:14 +03:00
shove
701586fa84 checker, cgen: enable calls to methods of the parent element array, when an array element is an alias (fix #16169) (#16187) 2022-10-24 12:02:24 +03:00
Swastik Baranwal
f25dfa9d8c checker: add error for unwrapped result in infix expr (#16175) 2022-10-24 11:53:35 +03:00
yuyi
48f43f11ea all: change optional to result in vlib/v. (#16177) 2022-10-24 11:51:20 +03:00
Ikko Ashimine
26986104f9 cgen: fix typos (#16174) 2022-10-23 22:28:58 +03:00
yuyi
7b8044b8c4 cgen: fix using 'array' name variable in array_init (#16168) 2022-10-23 22:23:15 +03:00
Wertzui123
340611c298 net: add a net.tcp_socket_from_handle_raw function (#16167) 2022-10-23 22:21:46 +03:00
kahsa
158fd5c249 doc: TOC add missing h3 (#16170) 2022-10-23 22:17:20 +03:00
kahsa
235bd87db5 doc: improve TOC (#16166) 2022-10-23 17:31:50 +03:00
Delyan Angelov
9241b5572b net.http: skip network timeouts on socket accept in the main http.Server loop 2022-10-23 17:08:27 +03:00
kahsa
00bd7b621d doc: minor fix (#16164) 2022-10-23 14:30:59 +03:00
kahsa
2d08c7b629 doc: fix headings under Grobal Variables (#16162) 2022-10-23 14:21:25 +03:00
yuyi
3f035205b3 cgen: fix return result in or block (#16158) 2022-10-23 13:11:11 +03:00
kahsa
33b2b4c6a1 doc: add link to template.md (#16155) 2022-10-23 13:07:22 +03:00
shove
721dbec2e4 checker: fix missed check on the initialization of result struct fields (fix #16152) (#16153) 2022-10-22 20:02:11 +03:00
Spydr
83338e044a native: fix small issues with compile-time conditionals (#16149) 2022-10-22 19:56:19 +03:00
shove
b8b2b4ad0a checker: fix the pos information in the warning message, when the label is not used (fix #16146) (#16148) 2022-10-22 19:26:38 +03:00
Hitalo Souza
3d4ffe8f28 examples: unskip vweb_orm_jwt from building, since it is not working directly with mysql anymore (#15671) 2022-10-22 19:12:54 +03:00
Delyan Angelov
a23e06184d checker: fix taking a closure of x, where x may be coming from a non trivial parent scope, like for x in y { or x,y := multi() (fix #16141) (#16147) 2022-10-22 15:53:27 +03:00
l-m
a139bed785 builtin: add string.trim_indexes method, that can be used in string.trim, but also separately from it (#16144) 2022-10-22 12:56:05 +03:00
yuyi
b6faf82911 parser: minor optimization in sql_expr() (#16145) 2022-10-22 12:11:45 +03:00
yuyi
9288c75c94 parser: simplify and cleanup check_undefined_variable() (#16140) 2022-10-22 11:26:21 +03:00
shove
e863191ff6 checker: fix generic information is lost of the map built-in method call (fix #16077) (#16134) 2022-10-21 23:07:05 +03:00
yuyi
ab78d5a7ba parser: check undefined variable in if guard (#16138) 2022-10-21 22:48:59 +03:00
Delyan Angelov
b40f1828b2 ci: re-enable building VEX in v_apps_and_modules_compile.yml 2022-10-21 10:44:59 +03:00
Makhnev Petr
2e8b9e3b92 v fmt: fix extra space for anon struct (#16131) 2022-10-21 10:38:19 +03:00
bogen85
c684dd8c9b log: mark log.fatal as [noreturn] (#16129) 2022-10-21 10:33:49 +03:00
yuyi
51f4d99399 all: change optional to result in most of the libraries (#16123) 2022-10-20 22:14:33 +03:00
yuyi
0d368562f4 cgen: minor optimization and cleanup in match_expr_sumtype() (#16126) 2022-10-20 20:36:56 +03:00
locriacyber
a3b050aced vrepl: add support for Home and End keys (#16116) 2022-10-20 20:07:57 +03:00
yuyi
f8a28b5a5d checker: check generic method called with a variadic argument mismatch (fix #16106) (#16110) 2022-10-20 15:28:30 +03:00
shove
07310d850d ast, cgen: fix wrong name and cname, when array and fixed array elements have optional (fix #16099) (#16122) 2022-10-20 14:17:57 +03:00
Delyan Angelov
2083e6b04c os: cleanup APIs returning !bool to either return ! or bool (#16111) 2022-10-20 13:56:06 +03:00
Swastik Baranwal
ac63fa1b11 parser: improve error for fixed array, when it has len and cap attributes in the initialisation list (#16120) 2022-10-20 13:36:13 +03:00
Delyan Angelov
ffcdac4201 ci: fix v_tictactoe.out after 05a1c3e 2022-10-19 22:33:10 +03:00
Delyan Angelov
05a1c3e8a3 parser,ci: fix regression after eda65ad in the VLS tests 2022-10-19 22:29:08 +03:00
yuyi
612faac0f0 all: change index expr returning optional to result too (#16097) 2022-10-19 21:04:16 +03:00
Delyan Angelov
eda65ad660 parser,checker,builder: make the checker more robust with -check over files with syntax/parsing errors 2022-10-19 18:14:58 +03:00
Delyan Angelov
d7813965d5 tools: fix os.chmod call (use octal permissions) in v ls 2022-10-19 15:38:06 +03:00
Delyan Angelov
7f294c8278 tests: use _test.v for the postfix of some test files, that were missing it 2022-10-19 12:38:58 +03:00
Grantley Cullar
37b03e57b4 tutorials: fix typos (#16098) 2022-10-19 12:20:11 +03:00
Makhnev Petr
2f3c4c6d91 v fmt: fix extra space for lock/rlock without expressions (#16103) 2022-10-19 12:18:21 +03:00
yuyi
026fccd373 cgen: fix match expr with last aggregate branch (#16101) 2022-10-19 11:49:39 +03:00
yuyi
117c829a97 vtest-self: add skipping ssl tests on windows (#16107) 2022-10-19 11:03:29 +03:00
Alexander di Chiara
e3379bca97 datatypes: add quadtree, add its demo to examples/ (#16087) 2022-10-18 18:02:44 +03:00
StunxFS
cc9b754801 vlib: delete unused darwin module (#16093) 2022-10-18 18:01:25 +03:00
yuyi
9242d4b79b json2: minor cleanup in README.md (#16096) 2022-10-18 18:00:14 +03:00
Delyan Angelov
71bff213ef builtin: make the C. WIN32 API declarations more precise, to catch errors earlier (#16090) 2022-10-17 20:23:33 +03:00
yuyi
126c4c5751 builtin,math: fix math.min_i64.str() (fix #16086) (#16089) 2022-10-17 19:36:46 +03:00
yuyi
556244576d checker: check unused last expression in if (fix #16084) (#16088) 2022-10-17 18:15:01 +03:00
Subhomoy Haldar
43b9a716c5 builtin,strconv: append ".0", to float string representations, to ensure clarity (#16079) 2022-10-17 15:41:07 +03:00
Delyan Angelov
29b1796791 ci: add more skips for different CI jobs 2022-10-17 10:24:01 +03:00
Delyan Angelov
7fb2718609 ci: only run openssl_compiles_test.v on !windows 2022-10-16 23:15:00 +03:00
Delyan Angelov
7ff7e540b9 ci: more ? -> ! fixes 2022-10-16 22:57:38 +03:00
Delyan Angelov
7302d8c4a8 examples: improve the examples/call_v_from_python with Python showing the result of the calculation done on the V side 2022-10-16 22:48:00 +03:00
Delyan Angelov
409a4f33a1 tools: add report_v_module_folders_without_tests.v . Use it to discover other modules without _test.v files. Add simple ones, to ensure CI can find more breakage on future wide changes to vlib/ 2022-10-16 22:40:17 +03:00
Delyan Angelov
17800b4bca ci: fix net.openssl, ensure that it is at least compiled, to avoid future regressions on sweeping vlib changes 2022-10-16 20:59:04 +03:00
Delyan Angelov
603319e30b .gitignore: ignore vold/vnew (ensure that artefacts used for benchmarking before/after changes are not commited) 2022-10-16 20:44:07 +03:00
Delyan Angelov
95d2c58148 checker: produce more informative error messages on ~,!,-,<- operator type mismatches 2022-10-16 20:27:40 +03:00
Delyan Angelov
3d2e251bf2 transformer: fix precalculations of simple expressions involving floating literals, with -prod (fix VSL tests with -prod) 2022-10-16 20:23:41 +03:00
Delyan Angelov
d857e97d8c strconv: enable VTL compilation with -prod (remove deprecation for strconv.v_sprintf temporarily) 2022-10-16 17:43:52 +03:00
Delyan Angelov
78e9362d74 ci: workaround for a VLS failing test, that stops symbol registration after the first fn()! { 2022-10-16 13:38:20 +03:00
Delyan Angelov
c02974622f tests: add checks_for_operator_overrides_should_happen_on_the_concrete_types_when_using_generics_test.v 2022-10-16 12:57:34 +03:00
Delyan Angelov
710c2b22da parser: fix infinite loop for type Handler = fn (test string) string without newline at the end 2022-10-16 10:42:53 +03:00
yuyi
f6844e9766 all: change optional to result of io (#16075) 2022-10-16 09:28:57 +03:00
shove
6e46933c55 cgen: fix or {} handling, when waiting for a single go thread, of a function returning !Type (fix #16065) (#16073) 2022-10-14 19:54:13 +03:00
Delyan Angelov
49c12e4d1c cgen: fix ./tracev examples/hello_world.v 2022-10-14 19:27:40 +03:00
shove
6bf2ad1ff0 cgen: fix missing * of optional non-ref structs (fix: #16070) (#16071) 2022-10-14 10:34:42 +03:00
yuyi
39d2aa71df checker: check generic closure fn declaration (#16069) 2022-10-14 10:24:10 +03:00
zztkm
3e4cfc7343 os: add os.to_slash and os.from_slash functions (#16055) 2022-10-14 10:22:36 +03:00
Subhomoy Haldar
09e23e3ed6 rand: add rand.element and prng.element functions with unit test (#16068) 2022-10-14 06:54:02 +03:00
Swastik Baranwal
f7f0e0b5dc v doc: remove int_literal and float_literal from syntax highlighting, since they are internal types (#16066) 2022-10-13 20:49:34 +03:00
shove
aabda5a525 checker: allow get_ref() or { unsafe{nil} }, as well as fn get_ref() ?&Type { return unsafe { nil } } (fix: #16062) (#16063) 2022-10-13 19:49:10 +03:00
shove
51a9e89c4a ast: disallow threads << go fn()?{} and threads << go fn()!{} (fix #16061) (#16064) 2022-10-13 19:37:27 +03:00
yuyi
f0108323d1 cgen: fix generic closure fn direct call (#16057) 2022-10-13 18:06:34 +03:00
shove
e3e8bb2f88 cgen: remove spaces in the generated name for ?&C.struct (fix #16058) (#16059) 2022-10-13 18:05:16 +03:00
yuyi
bfbfe78366 cgen: fix assigning optional of multi_return with heap (#16049) 2022-10-13 13:07:52 +03:00
shove
213a094680 ast: fix missing 'optional' and 'result' in type name and cname of map (#16047) 2022-10-13 10:38:02 +03:00
Swastik Baranwal
3e33f4a11d checker: disallow nil assignment on non pointer struct fields (#16056) 2022-10-13 10:36:59 +03:00
yuyi
fb3d093e01 builtin: remove opt_ok2() (part 2) (#16054) 2022-10-13 10:35:41 +03:00
shove
4fbb29a2c0 checker: disallow x := fncallexpr() or { X{} } , when the fn result type is ?&X (fix #16050) (#16051) 2022-10-12 22:49:30 +03:00
yuyi
6bdd11e53b checker: check error for fn call with extra parenthesis (#16052) 2022-10-12 22:43:59 +03:00
yuyi
211cb2af7b cgen: remove opt_ok2() part 1 (#16048) 2022-10-12 17:20:41 +03:00
yuyi
c590c8250e cgen: fix fn with optional of multi_return (#16046) 2022-10-12 09:44:15 +03:00
Delyan Angelov
7f2d731d19 cgen: fix dump(c_struct), where c_struct has fields of type &&char 2022-10-12 09:00:16 +03:00
shove
9569c0504c cgen: fix map with optional or result on return (#16044) 2022-10-12 07:54:29 +03:00
Rasheed
12d3664a09 builtin: add a declaration for C.putchar (#16037) 2022-10-11 20:53:12 +03:00
shove
4c0ea67137 cgen: fix map with optional or result (fix #15972) (#16036) 2022-10-11 16:33:19 +03:00
Swastik Baranwal
05fc7d3a72 checker: disallow function cast outside unsafe (#16030) 2022-10-11 15:46:35 +03:00
Wertzui123
5047058595 stbi: fix memory leak from stbi.load/1 with GC (#16028) 2022-10-11 15:19:36 +03:00
yuyi
34f233c93f cgen: fix generic struct init with generic cast (#16035) 2022-10-11 15:00:02 +03:00
yuyi
dab1c8a71d all: clean up optional and result handling (#16034) 2022-10-11 09:23:57 +03:00
shove
34d115d883 cgen: fix wrong when string attributes with quotes (fix #15194) (#16020) 2022-10-11 07:48:26 +03:00
shove
eebc82d83a fmt: fix wrong processing of quotes, when formatting string literals (fix #16017) (#16018) 2022-10-10 21:19:34 +03:00
yuyi
8f3f717736 checker: check type mismatch of return match expr (#16019) 2022-10-10 19:41:55 +03:00
yuyi
89eb8358cf checker: fix fn returning ![]string called in main (#16023) 2022-10-10 19:41:24 +03:00
Thomas Peißl
0f229874a2 net.mbedtls: add explicit closing of the tcp connection in the shutdown method (#16027) 2022-10-10 19:30:58 +03:00
Delyan Angelov
82593338fa ci: fix v -usecache -o x cmd/v on macos 2022-10-10 16:01:04 +03:00
Delyan Angelov
14923123ad ci: skip const_fixed_array_containing_references_to_itself_test.v on windows-msvc 2022-10-10 13:30:35 +03:00
Delyan Angelov
d4e89de8fb ci: fix v -cstrict -cc gcc vlib/v/gen/native/macho_test.v 2022-10-10 13:28:18 +03:00
Delyan Angelov
2a4604b5f9 Revert "examples: fix viewer example (use the new stbi.load_from_memory_with_channels) (#16004)"
This reverts commit bce420c34d.
2022-10-10 11:37:36 +03:00
Delyan Angelov
fa20d797a5 Revert "examples: increase the window size of drag_n_drop.v a little (test CI)"
This reverts commit 8fc166d5a3.
2022-10-10 10:39:58 +03:00
Delyan Angelov
3c25f506ed Revert "stbi: fix loading image from memory (#15981); breaks UI's rectangle example on macos, probably others too"
This reverts commit 07d5612347.
2022-10-10 10:39:32 +03:00
Delyan Angelov
8fc166d5a3 examples: increase the window size of drag_n_drop.v a little (test CI) 2022-10-10 04:04:27 +03:00
Delyan Angelov
a7b2b3c70e ci: fix ci.yml (add the second missing required run: line to a task) 2022-10-10 03:48:20 +03:00
Delyan Angelov
ade8fdff69 vfmt: fix v -W ./cmd/tools/vfmt.v, (and v -W build-examples) 2022-10-10 03:44:11 +03:00
Delyan Angelov
a4e8b9cabe ci: fix ci.yml (add missing required run: line to a task) 2022-10-10 03:43:00 +03:00
Aftab Alam
345d4d60e5 readme: add hyperlink to the vlang.io site, to the logo image (#16014) 2022-10-10 02:53:33 +03:00
yuyi
32ab08287c checker: add a notice about skipping the generic route methods of vweb apps (#16013) 2022-10-10 02:50:10 +03:00
Niraj Kulkarni
553315b80c gx: add documentation for Color methods (#16010) 2022-10-10 02:47:55 +03:00
shove
8666ef43fd cgen: fix dependency order error between sumtype and fixed array type (fix #16003) (#16009) 2022-10-09 12:16:50 +03:00
ChAoS_UnItY
95f57e9206 builtin: deprecate array.reduce in favour of arrays.fold (#16001) 2022-10-09 10:29:50 +03:00
yuyi
fe6197fe2d fmt: remove comma inside map_init using multi_line (#16007) 2022-10-09 08:39:30 +03:00
shove
e2398cafd2 cgen: fix str() fails when the structure 'charptr' type field is nil (fix #15970) (#16002) 2022-10-09 08:33:45 +03:00
penguindark
bce420c34d examples: fix viewer example (use the new stbi.load_from_memory_with_channels) (#16004) 2022-10-09 08:30:02 +03:00
Delyan Angelov
54197121bc sokol.sapp: remove update_cursor from EventType, since it is no longer defined in Sokol, fixes examples/gg/drag_n_drop.v 2022-10-08 22:01:22 +03:00
shove
cd96a43030 fmt: fix unreasonable wrap after if in if very_long && condition { (fix #15635) (#15995) 2022-10-08 19:31:00 +03:00
yuyi
ce1ba2ad02 checker: check fn returning fn type mismatch (fix #15988) (#15997) 2022-10-08 19:28:41 +03:00
Swastik Baranwal
49aac93d87 checker: disallow literals on the left side of assignments (#15999) 2022-10-08 19:27:30 +03:00
yuyi
91e641a422 parser: fix map init with multi enum keys (fix #15965) (#15991) 2022-10-08 18:56:02 +03:00
Delyan Angelov
754c387d1b cgen,checker: support simple voidptr casts in consts, without delaying the initialisation to _vinit (#15996) 2022-10-08 13:14:26 +03:00
yuyi
272b3cf8c3 checker: check undefined operation of the generic infix expr (#15987) 2022-10-08 12:09:32 +03:00
yuyi
4eeb45b94e vpm: stop and output an error message after parsing the v.mod file failed (#15994) 2022-10-08 11:33:49 +03:00
Swastik Baranwal
267cd5569a vpm: replace println with eprintln, for printing error output (#15992) 2022-10-08 11:32:31 +03:00
locriacyber
07d5612347 stbi: fix loading image from memory (#15981) 2022-10-07 17:20:35 +03:00
yuyi
03f82d5f68 cgen: fix generic for_in using iteration (#15979) 2022-10-06 18:20:38 +03:00
yuyi
73e28ec523 checker: fix infering fn type using reference argument (#15978) 2022-10-06 17:25:02 +03:00
Delyan Angelov
88d69d7d54 cgen,pref,preludes: implement v -assert continues file_test.v (#15976) 2022-10-06 17:20:32 +03:00
Larpon
58bf2838c0 builder: exclude LDFLAGS in .o builds (#15977) 2022-10-06 17:18:48 +03:00
Joe Conigliaro
87a364ff24 cgen: remove condition no longer needed after #15944 2022-10-06 17:15:15 +11:00
Joe Conigliaro
3eff20c5fd checker,cgen: small optimizations for previous commit 2022-10-06 17:03:48 +11:00
Joe C
18f0040388 checker/gen/parser: varg with pointer type fix: #15943 (#15944) 2022-10-06 15:58:07 +11:00
yuyi
f0871b87a4 term: fix errors in input_windows.c.v (#15966) 2022-10-05 13:24:22 +03:00
yuyi
6ccdf89546 cgen: fix vweb using generic method (fix #15888) (#15963) 2022-10-05 13:23:47 +03:00
Alexander Medvednikov
46138a2841 cbuilder: more clear fn name 2022-10-05 08:51:52 +03:00
ChAoS_UnItY
acbfe88dd9 arrays, maps: cleanup comments and parameter names in function signatures (#15960) 2022-10-04 10:07:36 +03:00
kahsa
40cbd68272 sqlite: add a sqlite.is_error() helper (#15964) 2022-10-04 10:03:59 +03:00
Swastik Baranwal
267e26ba1d net: add unsafe block to int -> enum cast (#15961)
Fixes https://github.com/vlang/v/issues/15959
2022-10-03 21:56:06 +03:00
Spydr
6ac9552d39 native: support simple library calls (#15958) 2022-10-03 17:49:22 +03:00
Swastik Baranwal
9fc64de94b openssl: add unsafe blocks to int -> enum blocks (#15957) 2022-10-03 16:32:37 +03:00
shove
dc2ba1c33f ast, parser, fmt: fixed and optimized comments for 'for, for_c, for_in stmts' (fix: #15922) (#15950) 2022-10-03 10:45:11 +03:00
ChAoS_UnItY
ffaca82ff8 arrays, maps: add indexed variant of collection function and minor cleanup (#15948) 2022-10-03 10:42:36 +03:00
Spydr
5b59171a00 checker, native: Check arguments of native builtin functions (#15952) 2022-10-03 10:41:59 +03:00
Delyan Angelov
c655847dfb native: fix notices when building cmd/tools/builders/native_builder.v 2022-10-02 22:48:06 +03:00
Swastik Baranwal
b584e1df98 checker: allow EnumName(number) casts only inside unsafe{} blocks (#15932) 2022-10-02 22:39:11 +03:00
Spydr
7993f0bf39 native: support for compile-time conditionals (#15949) 2022-10-02 22:31:59 +03:00
Delyan Angelov
b83d0281e4 checker: make the "reference field must be initialised" warning more informative, fix clipboard (used by ui) 2022-10-02 16:24:15 +03:00
yuyi
b158da398b parser: fix checking for duplicate main functions (#15946) 2022-10-02 12:14:25 +03:00
Delyan Angelov
ed2960a20e sokol.sapp: fix compilation of gg apps with -prod (add typedef tags to Sokol's C struct declarations) 2022-10-02 12:10:35 +03:00
Delyan Angelov
35368b5721 checker: small cleanup in Checker.check_ref_fields_initialized 2022-10-02 12:10:35 +03:00
Delyan Angelov
eec126e26c vfmt: run v fmt -w vlib/v/gen/native/tests/ 2022-10-02 12:10:34 +03:00
ChAoS_UnItY
20f5eef2dc maps: add a maps module, with generic filter, flatten, invert, to_map, to_array, from_array functions (#15945) 2022-10-02 10:59:13 +03:00
Swastik Baranwal
8a38bc2324 fmt: keep volatile qualifier in global declarations (#15947) 2022-10-02 10:50:16 +03:00
lemon
a7ad64033e native: support assigning to struct fields (#15938) 2022-10-01 14:42:26 +03:00
shove
5dae5b2a92 checker: fix references for alias type, that could still be uninitalized (fix #15935) (#15940) 2022-10-01 14:40:55 +03:00
Delyan Angelov
17b07273aa cbuilder: remove forgotten dump(), simplify o_postfixes 2022-10-01 14:00:35 +03:00
Delyan Angelov
90599c7f85 cbuilder: fix hardcoded v_parallel for -parallel-cc, use a sync.pool for the compilation threads 2022-10-01 13:50:47 +03:00
yuyi
aa02a9cd3b checker: fix checking mismatch of the fn array decompose argument (#15934) 2022-10-01 13:25:24 +03:00
yuyi
f6a68003d3 ci,parser: fix error in v_parser_test.v (#15936) 2022-10-01 13:18:46 +03:00
ChAoS_UnItY
fe597b7172 encoding.utf8: add is_number (#15931) 2022-10-01 11:01:51 +03:00
Alexander Medvednikov
3d2588f101 cgen: parallel cc for much faster compilation using all CPU cores 2022-10-01 10:04:06 +03:00
yuyi
be7b0f1dc5 checker: check mismatch of the fn array decompose argument (#15929) 2022-10-01 06:50:28 +03:00
Spydr
43d0d0f322 native: skip linking when no library functions get called (#15930) 2022-10-01 06:47:16 +03:00
lemon
d78dfabfe0 native: support casting integer to/from enum values (#15928) 2022-09-30 15:53:17 +03:00
yuyi
d694a26f39 checker, cgen: fix go print (#15927) 2022-09-30 15:50:54 +03:00
shove
b6bbbcf2e7 cgen: fix error when defer inside comptime if {} else {} (fix #15891) (#15911) 2022-09-30 10:10:34 +03:00
yuyi
659bd1a428 ast, checker, cgen: fix generic fn/method with comptime for/if (fix #15905) (#15910) 2022-09-30 09:40:30 +10:00
shove
63578e63c6 fmt: fix comments between for and { is wrong (fix #15918) (#15919) 2022-09-29 15:26:27 +03:00
Tim Marston
711bb6def7 gg: rename Context.set_cfg() -> Context.set_text_cfg() (#15904) 2022-09-29 15:24:16 +03:00
Larpon
2d08950e4c changelog: add entry for #15912 no need for [console] on Windows (#15924) 2022-09-29 15:20:19 +03:00
Larpon
816e9319d7 cgen: remove the need for [console] for gg or ui programs on windows (#15912) 2022-09-29 15:02:50 +03:00
Mehmet Ali
79a473f8ec vweb: fix a typo in the README.md (#15913)
* Fix typo

* Update vlib/vweb/README.md

Co-authored-by: JalonSolov <JalonSolov@gmail.com>

Co-authored-by: Delyan Angelov <delian66@gmail.com>
Co-authored-by: JalonSolov <JalonSolov@gmail.com>
2022-09-29 14:29:02 +03:00
Delyan Angelov
6fcab013eb os.notify: fix sizeof(C.epoll_event) == 12 with tcc (was 16, while with gcc/clang it is 12) 2022-09-29 13:27:07 +03:00
Delyan Angelov
3b420a8d7f net.urllib: add a URL.debug() method, returning the values of all the URL's fields 2022-09-29 10:38:11 +03:00
shove
e2cf403ca1 fmt: fix error when comments inside if and condition. (fix #15914) (#15915) 2022-09-29 09:14:11 +03:00
Swastik Baranwal
1ff1f23d9a parser: disallow using attributes on embedded structs (#15901) 2022-09-28 17:15:33 +03:00
shove
1ac3f3d8dc parser: fix pos error when define reference array type (fix: #15907) (#15909) 2022-09-28 17:13:29 +03:00
TSURUTA Takumi
e72d259903 change Values struct to public (#15902) 2022-09-28 16:21:33 +03:00
yuyi
be6741195d parser: fix formating fn with variadic argument (#15900) 2022-09-28 10:55:36 +03:00
Tim Marston
66249b8c45 gg: radius_to_segments() should use Context.scale (#15906) 2022-09-28 10:40:40 +03:00
spaceface
b85a535bcd cgen: support closures on riscv (#15898) 2022-09-28 10:34:26 +03:00
yuyi
bdf4c679da cgen: minor cleanup in method_call() (#15894) 2022-09-27 20:05:04 +03:00
yuyi
57e4ba4cd0 checker: fix generics interface with generic sumtype (fix #15883) (#15892) 2022-09-27 16:33:34 +03:00
lemon
f1216090f7 native: support enum (#15895) 2022-09-27 13:31:54 +03:00
Joe Conigliaro
51a92d170f encoding.base32: vfmt code 2022-09-27 16:29:44 +10:00
Joe Conigliaro
5415c4f75e encoding.base32: initial implementation 2022-09-27 16:25:50 +10:00
yuyi
385acb448a cgen: fix dumping c structs (fix #15878) (#15885) 2022-09-26 10:53:21 +03:00
yuyi
959eeaf1f3 parser: check undefined variable in if guard (#15882) 2022-09-26 10:17:39 +03:00
kahsa
8623186d31 doc: add links to vlib doc - array and map (#15881) 2022-09-26 10:06:54 +03:00
Dominik Pytlewski
721328ef58 os: fix os.read_file and os.read_bytes for 0 sized /proc/ files on Linux (fix #15852) (#15853) 2022-09-25 22:54:46 +03:00
Nicolas VENTER
50820105a1 docs: call_v_from_c example (#15844) 2022-09-25 22:52:40 +03:00
Subhomoy Haldar
7f23abbf8c docs: document the [noinit] attribute with an example (#15876) 2022-09-25 19:36:01 +03:00
Spydr
3674baab23 native: support escape sequences in string literals (#15877) 2022-09-25 17:47:49 +03:00
Tim Marston
089e89f865 gg: improve arc/slice drawing (#15856) 2022-09-25 15:22:10 +03:00
shove
58f7342465 cgen: fix array appending when array is used as fn parameter (fix: #15855) (#15860) 2022-09-25 13:05:54 +03:00
Delyan Angelov
6637db2d6d tools: fix sporadic CI failures on the doom-regressions job due to v gret 2022-09-25 11:27:13 +03:00
yuyi
50fb5de926 checker: fix dumping match expr (#15869) 2022-09-25 11:21:14 +03:00
Delyan Angelov
5cc9d7b347 checker: remove too vague notice about signed expressions while returning unsigned number types 2022-09-25 11:03:23 +03:00
yuyi
c3548c9413 tests: omit testsuite_begin/end() optional (#15871) 2022-09-25 10:29:25 +03:00
Spydr
947a1f2c65 native: add printing support for boolean and string variables (#15868) 2022-09-25 10:28:26 +03:00
Delyan Angelov
f338dec5c6 ci: fix compilation on FreeBSD (C.feof is a macro there, that expands to direct field access) 2022-09-24 10:17:32 +00:00
yuyi
d624ad50a7 os: fix file.read() (#15861) 2022-09-24 08:58:55 +03:00
Alexander Medvednikov
91c6e1a65b changelog: 0.3.2 2022-09-24 02:13:10 +03:00
shove
13d7f7db8f parser: fix line number error of comptime atExpr in the last token of the line (fix: #15672) (#15851) 2022-09-24 00:06:07 +03:00
yuyi
c811b5343a cgen: minor cleanup in return_stmt() (#15854) 2022-09-23 23:46:15 +03:00
yuyi
41fd02496a cgen: fix const expr using optional or result (#15850) 2022-09-23 22:36:56 +03:00
Delyan Angelov
1f26e3fb1b datatypes: add a forward iterator for LinkedList<T>, add forward and backward iterators for DoublyLinkedList<T>. Add tests for both. 2022-09-23 22:29:13 +03:00
Delyan Angelov
a6576bec1d json: fix encoding of structs with pointers; add test 2022-09-23 14:07:53 +03:00
ChAoS_UnItY
ea8b30fd91 encoding.utf8: add is_space (#15847) 2022-09-23 10:34:45 +03:00
shove
6ec931c781 sync: fix C.pthread_mutex_t struct typedef is missing in darwin (fix: #15491) (#15845) 2022-09-23 09:48:05 +03:00
spaceface
5c716afb39 net.ssl: switch to mbedtls over openssl (#15841) 2022-09-22 16:50:34 +03:00
yuyi
44c3fcecd9 cgen: fix reference embed method call (#15842) 2022-09-22 13:53:11 +03:00
Carl Xiong
78f8b9eb28 v.scanner: fix an unicode string escape handling bug (#15834) 2022-09-22 13:44:55 +03:00
Alfie Ranstead
27305d1a5f net.websocket: swap unsafe use of nil for a safe default value (#15836) 2022-09-22 08:00:03 +03:00
yuyi
41dbd12bc4 tests: make error handling the same as the main function (#15825) 2022-09-21 19:45:43 +03:00
flopetautschnig
391ac12fe2 datatypes: adding ringbuffer (#15818) 2022-09-21 19:42:59 +03:00
Delyan Angelov
09411128af json.cjson: add a test case for more complex json object construction 2022-09-21 17:22:42 +03:00
Delyan Angelov
21c5cadc59 tools: fix v install https://some/url_with_underscores (make --git the default for URLs) 2022-09-21 15:44:49 +03:00
shove
0871eca177 tests: add test for using reference of map type as struct field (PR #15828) (#15830) 2022-09-21 12:20:19 +03:00
spaceface
201598e68a builtin: fix gc.o compilation on macos (#15832) 2022-09-21 12:19:02 +03:00
Delyan Angelov
d848311fe2 tests: add missing script_with_no_extension, add exception for /tmp.* files in .gitignore 2022-09-20 16:17:21 +03:00
Annie
8f7958273b compiler: add -raw-vsh-tmp-prefix tmp flag, to allow for executing scripts without .vsh extension (#15829) 2022-09-20 15:52:18 +03:00
spaceface
453cc41c32 builder: remove outdated tcc error (#15833)
This was introduced when we enabled the GC by default,as a suggestion
for resolving C errors caused by the user having an outdated TCC clone.
However, now that several months have passed, it is very unlikely that
people still have out-of-date copies of TCC, and instead it is more likely
that this error message is hiding the true cause of some C errors unrelated
to TCC or the GC.
2022-09-20 15:12:39 +03:00
shove
bbf1ba458e cgen: fix using reference of sumtype or map as struct field (fix: #15827) (#15828) 2022-09-20 13:22:08 +03:00
Wertzui123
a9d63d729e sokol.sapp,gg: add a tool_type field to gg.TouchPoint (differenciate different types of touch input) (#15822) 2022-09-20 13:15:38 +03:00
Delyan Angelov
993802f6a6 markused: fix compilation of gg programs with -skip-unused, add test to prevent regressions (#15821) 2022-09-20 08:03:03 +03:00
Swastik Baranwal
42059ee099 checker: disallow array append as expression in .map and `.filter methods (#15823) 2022-09-20 07:30:30 +03:00
Delyan Angelov
69c9d47a40 pref,os,sokol,cgen: ease compilation of 2048 with -os wasm32_emscripten (#15820) 2022-09-20 00:17:13 +03:00
yuyi
e6e3751980 checker: fix generics with pointer index (fix #15810) (#15815) 2022-09-19 22:02:49 +03:00
yuyi
a0d647d1e3 checker: clean up checking optional and result in checker.v (#15817) 2022-09-19 14:52:27 +03:00
shove
84bc170720 checker: optimize the position of the propagation error, where a fn needs to return an optional or result(fix #15780) (#15813) 2022-09-19 14:49:23 +03:00
Ikko Ashimine
0ff53d18c1 v.gen.js: fix typo in js.v (#15812) 2022-09-19 10:22:24 +03:00
Delyan Angelov
5c21b83044 cgen: skip generating typedef HANDLE __v_thread on windows, when -no-builtin is given 2022-09-19 09:14:25 +03:00
Delyan Angelov
d7758b2995 checker: fix slow compilation of vtl/nn/examples/mnist.v (reduce RAM usage) 2022-09-18 21:43:44 +03:00
Delyan Angelov
04f818fefc ci: cleanup paths-ignore: usage in ci_sanitized.yml and native_backend_tests.yml 2022-09-18 18:47:41 +03:00
shove
202585e175 checker, parser, fmt: fix visibility of anon struct in different modules.(fix #15763) (#15787) 2022-09-18 18:08:33 +03:00
yuyi
0ff74dae63 vrepl: simplify and cleanup vrepl (#15807) 2022-09-18 18:07:16 +03:00
yuyi
57d583d821 cgen: fix array insert in fn as mut receiver (#15806) 2022-09-18 14:55:28 +03:00
frittex
24ea6dfe14 docs: add note that clang is required (#15802) 2022-09-18 14:22:01 +03:00
yuyi
8d2b0d4afd parser: fix error for match expr with 'fn' (#15805) 2022-09-18 14:17:13 +03:00
yuyi
c78344ef04 vrepl: fix output errors (fix #15801) (#15804) 2022-09-18 14:09:31 +03:00
Delyan Angelov
d67aa8d76c checker: improve the wording of the mismatched range types error 2022-09-17 21:05:30 +03:00
shove
bd3c9e888d checker: fix missing checker error for fn abc() u64 { return -1 } (fix #15789) (#15795) 2022-09-17 20:59:52 +03:00
yuyi
085a09ebdb vrepl: fix output error of print and fn call (#15796) 2022-09-17 15:58:53 +03:00
Delyan Angelov
afe7166346 v.builder: add -Wno-write-strings for tcc on -cstrict 2022-09-17 15:38:06 +03:00
yuyi
de636dbb2b checker: check result type method call (#15794) 2022-09-17 11:45:13 +03:00
yuyi
26443cf9fa vrepl: fix array method call errors (fix #15769) (#15786) 2022-09-17 10:12:01 +03:00
Delyan Angelov
a3b60e6b55 checker: improve mismatched range types error messages 2022-09-17 09:15:55 +03:00
Delyan Angelov
fda39bfb82 docs: enhance the .vsh section, as well as the description of the V's script mode (no fn main(){}) (#15788) 2022-09-17 00:21:31 +03:00
shove
289f8f2f24 checker: fix nested struct ref field init check for embedded structs (fix #15768) (#15785) 2022-09-16 23:39:15 +03:00
Delyan Angelov
0992914bd6 ci: remove macos-10.15 runner (affected by a brownout, and scheduled to be removed in 12/1/2022)
See: https://github.com/actions/runner-images/issues/5583
The brownouts for this runner image, will get increasingly more frequent.
2022-09-16 21:01:52 +03:00
Carl Xiong
0b6924ebfb cgen: fix hardcoded app param name in code generated for vweb.html (#15766) 2022-09-16 17:27:58 +03:00
lemon
7f30519544 native: support method definition and call (#15736) 2022-09-16 16:31:05 +03:00
yuyi
0e49ce427e cgen: fix passing sumtype parameter in sumtype matching results (fix #15078) (#15767) 2022-09-16 10:16:40 +03:00
Delyan Angelov
f922ed0941 tests: unify all temporary files/folders under $VTMP/v, that can be cleaned by v wipe-cache (#15774) 2022-09-16 04:56:19 +03:00
Delyan Angelov
7e69619add builtin, compiler: replace isnil(x) calls with x == unsafe { nil } (a little faster without -prod) (#15759) 2022-09-15 14:59:37 +03:00
Swastik Baranwal
f09197b972 cgen: fix printing and dumping of struct having referenced interface as field (#15765) 2022-09-15 12:43:23 +03:00
shove
566a61b136 checker: fix check omission in cast string to char. (fix #15760) (#15764) 2022-09-15 09:33:38 +03:00
shove
8b962f8446 checker: fix nested struct reference type field initialized check. (fix: #15741) (#15752) 2022-09-15 07:59:31 +03:00
yuyi
5719344653 checker: fix struct init with update of mutable receiver (#15758) 2022-09-14 19:46:05 +03:00
yuyi
ea4152ee14 checker: add a test for fn call arg of fn pointer mismatch (#15757) 2022-09-14 17:46:07 +03:00
yuyi
fd1b3fc861 cgen: fix error of 'in array of sumtype' (#15756) 2022-09-14 17:43:16 +03:00
Larpon
0b2841d4ea docs: add nested map example. Closes #15751 (#15753) 2022-09-14 10:32:09 +03:00
yuyi
ac64318890 checker: check casting array to number (#15750) 2022-09-13 20:41:20 +03:00
yuyi
840370f345 cgen: minor optimization in if_expr() (#15748) 2022-09-13 14:56:09 +03:00
Swastik Baranwal
a3d6a9349d cgen: make go func with array type work (#15747) 2022-09-13 14:53:43 +03:00
shove
f51384c402 cgen: modify the temporary variable name of the previous pr 15744 (#15745) 2022-09-13 12:11:03 +03:00
shove
7cff7fb828 cgen: fix f as Fun, where f is type Expr = Fun | int, and struct Fun { f fn (int) int }. (fix #15730) (#15744) 2022-09-13 10:19:58 +03:00
yuyi
adc3b25f52 checker, cgen: fix nested if expr with optional or result (fix #15735) (#15743) 2022-09-13 10:09:12 +03:00
yuyi
e51f0be6db checker: check taking the address of map field outside unsafe block (#15737) 2022-09-13 10:04:21 +03:00
Sanath Kumar U
ac6167565e docs:Update docs.md to include instructions on upgrading V (#15733)
* Updated docs.md to include instructions on upgrading V

Updated docs.md to include instructions on upgrading V to latest version.

* changes to fix the error message "./doc/docs.md:27:116: error: must be less than 100 characters"
2022-09-12 18:26:10 +03:00
yuyi
17b54cde97 checker: fix match with complex sumtype exprs that adding print (#15728) 2022-09-12 13:55:34 +03:00
yuyi
b4494f921a ast: fix dumping sumtype of fntype (#15734) 2022-09-12 13:45:29 +03:00
shove
550b27b014 checker: fix recursive define check is missing when defining sumtype. (fix #15684) (#15718) 2022-09-11 15:17:38 +03:00
shove
be0dc0e537 checker: fix check omission in cast string to ptr. (fix #14921) (#15721) 2022-09-11 13:54:56 +03:00
Delyan Angelov
3e599a1436 ci: ignore vlib/v/tests/inout/vscript_using_generics_in_os.vsh in v test-cleancode on windows for now 2022-09-11 11:18:01 +03:00
shove
8b5f3aa970 checker: fix inner functions are called before definition. (fix #15673) (#15719) 2022-09-11 11:10:47 +03:00
lemon
aa3651fa58 native: add initial implementation of simple structs (#15722) 2022-09-11 11:05:12 +03:00
Delyan Angelov
e03ca2026b checker: fix generic fns usage in implicitly imported os in .vsh script mode 2022-09-11 10:47:47 +03:00
yuyi
7eb36789ac checker, cgen: fix nested match expr with optional or result type (#15717) 2022-09-10 11:44:22 +03:00
shove
bce1039c9c cgen: fix missing type name when anonymous struct is used as parameter. fix #15698 (#15699) 2022-09-10 09:35:42 +03:00
Spydr
b429aad63b native: add struct representing elf headers (#15716) 2022-09-10 09:29:46 +03:00
Louis Schmieder
f249feb9da orm: support parenthesized expressions as in select from User where (name == 'Sam' && is_customer == true) || id == 1 (#15693) 2022-09-09 21:08:48 +03:00
yuyi
61a4b469a3 cgen: fix nested match expr with optional or result (#15713) 2022-09-09 18:23:56 +03:00
Delyan Angelov
e7725bb340 ci: enable again failing on Doom visual mismatches. Increase Xvfb screen size in c2v.yml (better see Doom screenshots when there is a difference) 2022-09-09 17:51:03 +03:00
shove
ca36284612 fmt: fix anonymous struct in parameter with invalid type name. fix #15696 (#15711) 2022-09-09 14:44:49 +03:00
Swastik Baranwal
6db5781d53 checker: add checks for .map(opt_fn_name) and .filter(opt_fn_name) (#15687) 2022-09-09 12:24:57 +03:00
yuyi
0f3a395ca2 checker, cgen: fix if expr with result (#15709) 2022-09-09 11:29:21 +03:00
yuyi
71f5f7f3a7 cgen: fix if expr with fn call result (#15702) 2022-09-08 22:39:49 +03:00
yuyi
ec2ca38adb checker, cgen: fix match expr with result (#15706) 2022-09-08 21:24:16 +03:00
Ken
1738641567 cgen, checker, ast: add syntax support for reference x in for x in &somearrary { and for x in &somemap { loops (#15678) 2022-09-08 13:36:40 +03:00
flopetautschnig
9641ced901 vweb.csrf: add a README.md, correct doc comments for public functions (#15697) 2022-09-08 13:20:29 +03:00
yuyi
5c900e23de cgen: fix const aliases of bytes fixed array (#15701) 2022-09-08 13:19:02 +03:00
Delyan Angelov
fc8e3d0971 builtin,strconv: speedup str.int() conversions (without -prod) 2022-09-08 11:28:19 +03:00
yuyi
a462610376 ast: minor optimization in sumtype_check_function_variant() (#15694) 2022-09-08 09:20:30 +03:00
shove
a75a12ec1e checker: fix const variable type error when global variable with the same name exists (fix #15686) (#15689) 2022-09-07 19:06:45 +03:00
Emin Arıcan
7672725204 net: fix typo (#15688) 2022-09-07 16:35:28 +03:00
yuyi
8627af18dd table: check sumtype of fntype assign error (#15685) 2022-09-07 16:05:38 +03:00
yuyi
2693935066 checker: check non generic struct used like a generic one (#15690) 2022-09-07 14:53:43 +03:00
Delyan Angelov
c5ed179e76 arrays: remove deprecation from arrays.concat/2; it is a useful abstraction for operating on immutable arrays 2022-09-07 13:25:40 +03:00
Hitalo Souza
21b2a9841a examples: js_dom_draw_bechmark_chart (#15518) 2022-09-07 01:55:32 +03:00
yuyi
ca99a1d355 cgen: fix sumtype with fntype using fn directly (fix #15674) (#15679) 2022-09-06 20:33:39 +03:00
flopetautschnig
1c63ce479c vweb: adding a vweb.csrf protection module (#15586) 2022-09-06 13:18:39 +03:00
Hitalo Souza
95a328be98 orm: improve the README and the tests. Add an error message for foreign key tags (#15670) 2022-09-06 13:12:37 +03:00
yuyi
e3d3863fbe cgen: refactor need_tmp_var_in_expr/match() (fix #15675) (#15676) 2022-09-06 13:09:28 +03:00
shove
862d91ed0a checker: check for name conflicts between const and __global variables (fix #15668) (#15669) 2022-09-05 18:58:30 +03:00
yuyi
6fd22531a9 cgen: fix if expr with index expr (#15666) 2022-09-05 18:55:53 +03:00
yuyi
d649f5aff4 checker, cgen: fix go call fn using map value (#15665) 2022-09-05 17:16:28 +03:00
Seven Du
90c2c5b8a4 token: add @FILE_LEN (#15661) 2022-09-05 17:00:35 +03:00
yuyi
d0d5f1d4e0 cgen: fix fn variable name using reserved c word (fix #15647) (#15648) 2022-09-04 17:50:41 +03:00
Swastik Baranwal
436b19c408 checker: add error for mismatched types and format character for string interpolation (#15639) 2022-09-04 14:15:26 +03:00
yuyi
78998a09e4 cgen: fix go call anon fn with closure (#15656) 2022-09-04 14:03:24 +03:00
Delyan Angelov
57802aaffc ci: install xsel and xclip on the jobs where imgur.sh is used 2022-09-04 13:46:27 +03:00
Larpon
0d0c2b278d vgret: add region support (#15651) 2022-09-04 13:39:10 +03:00
jrfondren
45e21bc311 os: remove private unix_environ() helper function, it is not needed anymore (#15654) 2022-09-04 13:22:38 +03:00
yuyi
0c84ad847e cgen: fix match expr with optional (#15658) 2022-09-04 13:21:16 +03:00
Delyan Angelov
cee8b38221 ci: disable job failure on doom picture regressions for now 2022-09-04 13:04:02 +03:00
Delyan Angelov
dd78620b31 cgen: fix [packed] struct support for tcc 2022-09-04 07:14:01 +03:00
yuyi
5e1a2f6f50 checker: check if guard with multiple return variable (#15646) 2022-09-03 10:56:46 +03:00
yuyi
a5aad6f791 cgen: fix alias of map delete (#15644) 2022-09-03 10:41:53 +03:00
yuyi
1ef95fdec6 cgen: fix assert value is '*unknown value*' (#15645) 2022-09-03 10:38:27 +03:00
Davide Beatrici
4bd49a0149 ci: run more tests on the FreeBSD Cirrus runner (#15602) 2022-09-01 21:56:43 +03:00
yuyi
42e582804e checker: check fn variadic passing arg error (fix #15629) (#15632) 2022-09-01 21:24:24 +03:00
yuyi
bfdd6f1cf8 csv: minor cleanup in writer.v (#15633) 2022-09-01 21:23:18 +03:00
Delyan Angelov
728b198384 os: extract dir_expansions_test.v from os_test.v 2022-09-01 13:07:29 +03:00
Delyan Angelov
0cc0e87051 time: use linux_utc() and linux_now() on freebsd too (more precise, and fixes time_test.v) 2022-09-01 09:54:20 +00:00
Davide Beatrici
23e8fca4f9 native: fix order and add missing path in find_o_path() (#15622)
This fixes the linker failing when:

- 32 bit libraries exist in "/usr/lib".
- 64 bit libraries are in "/usr/lib64" and not "/usr/lib/x86_64-linux-gnu".
2022-09-01 10:21:35 +03:00
Wertzui123
95760ae82a CHANGELOG.md: fix typo (paralell -> parallel) (#15621) 2022-09-01 09:26:05 +03:00
yuyi
5e8f9b11c9 checker: check casting voidptr to generic struct (fix #15618) (#15626) 2022-09-01 09:22:37 +03:00
Alexander Medvednikov
f2f6ea5969 V 0.3.1 2022-08-31 19:24:57 +03:00
Louis Schmieder
fef26a0b19 fmt: fix striping modules prefix in orm (#15005) 2022-08-31 19:23:36 +03:00
yuyi
806c39d46e parser: fix error for match sumtype with fntype (#15620) 2022-08-31 18:44:12 +03:00
Louis Schmieder
6110373519 orm: init or implementation (#14989) 2022-08-31 14:43:20 +03:00
Haren S
bc06866b20 make: add clock_gettime on macOS < 10.12 (fix #6605) (#15611) 2022-08-31 11:03:25 +03:00
yuyi
4d6b8cbfd8 cgen: fix casting sumtype as fntype (#15612) 2022-08-31 10:45:47 +03:00
yuyi
64f403e997 cgen: fix dumping shared variable (#15615) 2022-08-31 10:42:28 +03:00
yuyi
56135dbdbc cgen: fix printing reference enum (#15606) 2022-08-30 14:24:48 +03:00
Alexander Medvednikov
ba1045e5fd parser: deprecate inline sum types 2022-08-30 13:18:22 +03:00
yuyi
b154af032b parser: fix sumtype with multi fntype (fix #15557) (#15583) 2022-08-30 12:48:25 +03:00
yuyi
5d4492ac6f checker: check cast to reference struct (fix #15590) (#15601) 2022-08-30 11:42:21 +03:00
crthpl
a9b54e9b98 cgen: add __addr (bootstraps #14818) (#15585) 2022-08-30 10:28:47 +03:00
lemon
2221dd7058 native: support fncall with 7↑ arguments (#15599) 2022-08-30 10:24:37 +03:00
yuyi
0876cf86ed cgen: fix struct init with update expr (fix #15595) (#15603) 2022-08-30 09:22:14 +03:00
yuyi
e355ae7b3c checker: check generics struct field type error (#15593) 2022-08-29 16:55:26 +03:00
Delyan Angelov
9703410391 vfmt: fix formatting of submodules with common prefixes (fix #15582) 2022-08-29 15:30:58 +03:00
Larpon
1915bf81d0 ci: use ubuntu-latest for toml tests (#15591) 2022-08-29 12:43:50 +03:00
shove
f285ebd91c smtp: add base64 encoding to the body of the emails and use utf8, to prevent format confusion (#15589) 2022-08-29 09:19:46 +03:00
yuyi
72056f36d8 cgen: fix cross assign of fixed array (#15587) 2022-08-29 08:50:19 +03:00
Larpon
f23ebb6815 docs: "in over a" -> "in a" (#15576) 2022-08-28 20:51:45 +03:00
ChAoS_UnItY
ad76c9c719 checker: fix illegal result propagate on non-result type (fix #15574) (#15578) 2022-08-28 13:31:45 +03:00
ChAoS_UnItY
258ff73efd encoding.csv: re-encapsulate fields in Writer/Reader (fix #15558) (#15570) 2022-08-28 11:13:43 +03:00
Hitalo de Jesus do Rosário Souza
797bdd5e98 vweb: document the .query field (#15572) 2022-08-28 09:55:18 +03:00
yuyi
06e153d429 ast, cgen: implement sumtype with fntype partly (related #15557) (#15567) 2022-08-28 09:12:08 +03:00
Delyan Angelov
d75c62b806 checker: allow + operator overrides for type aliases 2022-08-27 12:54:16 +03:00
yuyi
2a03d22a37 ast: clean up table.find_or_register_fn_type() (#15560) 2022-08-27 09:32:03 +03:00
ChAoS_UnItY
0b843b801f checker: fix returning expression with void type (fix #15543) (#15554) 2022-08-27 09:00:14 +03:00
ChAoS_UnItY
70de4e1009 checker: fix no error on plus-assigning array (fix #15544) (#15552) 2022-08-26 23:11:23 +03:00
yuyi
f45042fa09 checker: improve error message of fn args mismatch (#15550) 2022-08-26 22:38:53 +03:00
Delyan Angelov
329670431b v.pref: skip vlib/builtin/prealloc.c.v, when -prealloc is not passed (#15553) 2022-08-26 22:08:42 +03:00
Delyan Angelov
a1e87664f4 ci: minimise work on commits/PRs, that affect only .yml files 2022-08-26 21:07:33 +03:00
Delyan Angelov
511cc2b267 ci: prevent native-backend jobs from separate PRs to cancel each other 2022-08-26 20:58:19 +03:00
lemon
e5c53cf412 native: match expr/stmt (#15537) 2022-08-26 15:18:02 +03:00
yuyi
02a47f42f3 ast, parser, cgen: fix closure with nested closure variable (#15542) 2022-08-26 13:37:10 +03:00
Subhomoy Haldar
3af12271fb log: add target_from_label and unit tests (#15538) 2022-08-26 07:09:48 +03:00
ChAoS_UnItY
b0e7ddfd97 checker: fix non-bool check on use of result bool (fix #15539) (#15540) 2022-08-26 07:08:57 +03:00
StunxFS
b83dd86d65 checker: check error for simple assignment with dumping of multireturn value (#15512) 2022-08-26 07:08:05 +03:00
lemon
939e9245db native: support integer infix arithmetics (#15536) 2022-08-26 07:07:15 +03:00
wahur666
dbf28c5bfb cmd/tools/where: check if parent already included vlib_dir (#15527) 2022-08-26 07:04:44 +03:00
yuyi
fc9d2d5d5e cgen: cleanup generic_fn_name() (#15531) 2022-08-26 07:04:10 +03:00
Swastik Baranwal
44137e07b0 datatypes: use generic op overloading for difference and equal (#15530) 2022-08-26 07:03:23 +03:00
shove
c10c8ff9e4 parser: fix anon struct name conflict (#15517) 2022-08-26 07:01:50 +03:00
tr00
3eb6ad7b8c os: fix type in error message (#15533) 2022-08-26 06:59:52 +03:00
yuyi
40c0a8cbaf parser, checker, cgen: implement generics anon fn (#15529) 2022-08-25 14:12:56 +03:00
shove
723b3d74ee datatypes: add array() method for LinkedList, DoublyLinkedList, Queue, and Stack (#15524) (#15525) 2022-08-25 14:12:39 +03:00
yuyi
c662431cfd checker: check unsafe array assign (fix #9651) (#15515) 2022-08-25 08:52:13 +03:00
yuyi
86496aa191 cgen: fix array init with it (#15523) 2022-08-25 08:00:11 +03:00
Delyan Angelov
3ad22eb0dd checker: show a more detailed error for invalid declarations of generic methods on generic structs. 2022-08-24 13:43:27 +03:00
Delyan Angelov
4718b8b45a all: unify the displaying of compiler errors, using a common util.show_compiler_message/2 function. 2022-08-24 13:38:47 +03:00
StunxFS
0d8b6ee7f2 checker: don't show manual memory warning twice (#15510) 2022-08-24 09:08:35 +03:00
shove
6ff753745f smtp: send mail to multiple recipients. #15508 (#15509) 2022-08-23 20:50:41 +03:00
Subhomoy Haldar
3b42f18dee os: add input_password(prompt) and unit tests (#15507) 2022-08-23 18:17:38 +03:00
Swastik Baranwal
d08edf8cba vdoc: highlight generic struct everywhere (#15506) 2022-08-23 15:21:26 +03:00
Delyan Angelov
3c23eebe51 ci: fix -fsanitize=address for c_array_test.c 2022-08-23 12:16:55 +03:00
yuyi
42c0bae9ce checker: check unknown array of fn type in struct field (#15502) 2022-08-23 11:15:25 +03:00
Larpon
9dd8228f91 arrays: move carray_to_varray from builtin, make it generic (#15503) 2022-08-23 11:12:50 +03:00
Alexander Medvednikov
2dde7ff5ba strconv: deprecate v_sprintf in favor of string interpolation 2022-08-23 09:53:05 +03:00
yuyi
a758b6686c json: minor cleanup in json_test.v (#15501) 2022-08-23 07:59:50 +03:00
yuyi
196b5f8e3a checker: fix match expr with non last if expr (#15500) 2022-08-23 07:58:33 +03:00
Delyan Angelov
98c6dad887 make.bat: add a small delay between del v.exe and move v2.exe v.exe, to make CI runs more robust 2022-08-22 22:08:47 +03:00
Larpon
d40d761e38 toml: support [toml: '...'] attributes (#15497) 2022-08-22 20:39:55 +03:00
Larpon
dda475bcc8 builtin: add carray_to_varray, closes #15493 (#15499) 2022-08-22 20:15:54 +03:00
Delyan Angelov
a689641c1b os: rewrite os.walk and os.walk_with_context to use iteration, instead of recursion 2022-08-22 17:27:14 +03:00
Delyan Angelov
21917f5b00 os: small cleanup of needless r'\' usage 2022-08-22 16:32:42 +03:00
Delyan Angelov
e156e6a44a os: remove commented code in os_windows.c.v 2022-08-22 14:54:38 +03:00
yuyi
d7501cc9a1 cgen: fix if sumtype var is none (#15496) 2022-08-22 13:32:27 +03:00
yuyi
18b6311b2f cgen: fix match sumtyp var with none (#15495) 2022-08-22 13:31:35 +03:00
irishgreencitrus
8db945ec52 vpm: force v install to clone git submodules too (#15487) 2022-08-22 11:23:32 +03:00
yuyi
47e75c68a9 cgen: fix json.encode of a struct containing a field of an alias type of another struct (#15490) 2022-08-22 11:04:58 +03:00
Swastik Baranwal
f727433929 scanner: add check for invalid unicode (#15485) 2022-08-22 10:56:51 +03:00
yuyi
6d501b073a datatypes: make Set's methods public (#15489) 2022-08-22 10:16:59 +03:00
Delyan Angelov
661d70a976 ci: run VLS tests with gcc on the main V repo too 2022-08-22 10:10:59 +03:00
Delyan Angelov
24e0a6cff2 checker: fix vls test compilation 2022-08-22 08:42:58 +03:00
yuyi
0d9ac1f59c checker: improve error message for test function definition (#15483) 2022-08-21 16:19:39 +03:00
yuyi
f194d3ca2e checker: fix generic method with nested generic method (#15480) 2022-08-21 14:12:31 +03:00
Delyan Angelov
3656d445ab Revert "Revert "tools/fast: do not build V with -usecache""
This reverts commit ad322f4eb0.
2022-08-21 10:40:27 +03:00
Delyan Angelov
ad322f4eb0 Revert "tools/fast: do not build V with -usecache"
This reverts commit f97a4f1904.
2022-08-21 08:56:05 +03:00
Delyan Angelov
0b41ff0c6a v.vcache, v.builder: use the module name inside the usecache paths (for more readable cache entries at a glance) (#15476) 2022-08-21 08:55:21 +03:00
Alexander Medvednikov
a069577e9c builder: remove msvc code from non windows systems 2022-08-21 05:21:31 +03:00
Alexander Medvednikov
12265a15ed pref: temp hack to make -os cross work when building V 2022-08-21 05:12:58 +03:00
Alexander Medvednikov
f97a4f1904 tools/fast: do not build V with -usecache 2022-08-21 04:40:32 +03:00
Alexander Medvednikov
eb6627fe41 cgen: remove unneeded comments 2022-08-21 01:39:54 +03:00
Delyan Angelov
9932ed9b7e doc: add a Parameter evaluation order section (#15473) 2022-08-21 01:08:38 +03:00
Delyan Angelov
c3568823ee tests: make vlib/time/private_test.v more robust/tolerant to small fluctuations 2022-08-20 13:56:10 +03:00
Delyan Angelov
499ab9bedb tests: make tcp_self_dial_from_many_clients_test.v more robust (use shared ctx) 2022-08-20 13:32:59 +03:00
Hitalo de Jesus do Rosário Souza
eafbf335cf docs: improve vlib/vweb/README.md (#15146) 2022-08-20 12:06:24 +03:00
Swastik Baranwal
a1de8f5f98 vdoc: highlight variadic function parameters (#15474) 2022-08-20 12:02:50 +03:00
yuyi
0645fe3322 parser: check generic struct init using multi return type (#15472) 2022-08-20 11:56:44 +03:00
Delyan Angelov
5cba5920d5 os: make find_abs_path_of_executable_test.v more robust (fix #15459) 2022-08-20 10:06:58 +03:00
yuyi
6062708c60 checker: fix comptime if generic value shift (#15471) 2022-08-20 08:15:52 +03:00
Alexander Medvednikov
46f32fc10c checker: require unsafe for free() 2022-08-20 08:03:07 +03:00
yuyi
fa447443ca cgen: fix push on closed channel (#15468) 2022-08-19 19:27:42 +03:00
Alwin Arrasyid
6ed69289a8 tutorials: remove unnecessary json.encode (#15464) 2022-08-19 19:27:26 +03:00
yuyi
f10ff0353e checker, fmt: check infix_expr with 'and' op (#15466) 2022-08-19 09:50:46 +03:00
Delyan Angelov
31067d4a6c ci: ignore changed .md files in native_backend_tests.yml 2022-08-19 09:49:17 +03:00
yuyi
1dc62a5a66 ast: fix string interpolation fmt with result call (#15467) 2022-08-19 09:44:59 +03:00
yuyi
ea163197c7 cgen: fix shared optional (#15462) 2022-08-18 20:18:03 +03:00
yuyi
6d399c5116 checker: fix struct init with update expr (fix #9472) (#15460) 2022-08-18 19:39:41 +03:00
Swastik Baranwal
22a79cfa1e v doc: add highlighting for new types and fix highlighting for edge cases (#15455) 2022-08-18 18:06:55 +03:00
irishgreencitrus
cd31108260 cgen: implement '#preinclude' (#15456) 2022-08-18 15:59:08 +03:00
yuyi
7227c1d508 scanner: fix false &&!ok1 (fix #7524) (#15458) 2022-08-18 11:55:38 +03:00
Larpon
af8bd10761 v.pref: support v -trace-calls run file.v (#15450) 2022-08-18 11:45:37 +03:00
yuyi
d3307fd2e3 cgen: minor cleanup in fn_var_signature() (#15454) 2022-08-17 18:42:46 +03:00
Delyan Angelov
7ed3389fa8 ci: fix -cstrict checks after 7585e86 2022-08-17 18:40:15 +03:00
Delyan Angelov
18e737aee2 builtin,tests: fix int_test.v on macos, m1 2022-08-17 17:18:10 +03:00
Delyan Angelov
7585e86868 os: reduce heap allocations done by os.real_path, os.executable, os.getwd 2022-08-17 17:06:38 +03:00
Delyan Angelov
0e62344043 tests: make private_test.v more tolerant to small delays 2022-08-17 16:25:46 +03:00
yuyi
e1ebd90190 cgen: fix array of fixed array map/filter/any/all(it[0]) (fix #15422) (#15445) 2022-08-17 16:16:08 +03:00
yuyi
9887dd1fbf cgen: fix go call fn with anon fn argument (fix #10351, fix #10270) (#15446) 2022-08-17 16:12:52 +03:00
ChAoS_UnItY
70f466460f cgen: fix struct field name generation in auto free (#15440) 2022-08-17 09:11:58 +03:00
yuyi
374186f1f7 checker: fix fn call with mut array of aliases arguments (#15443) 2022-08-17 08:49:53 +03:00
John
d41b2be3a7 crypt: implement crypto.rand.read/1 for OpenBSD and FreeBSD (#15437) 2022-08-17 07:41:27 +03:00
Alexander Medvednikov
8736f26a1c tutorials: simplify new_article() a bit 2022-08-16 22:20:03 +03:00
Vladimir Myshkovski
9b9115471f datatypes: Set implementation (#14853) 2022-08-16 20:23:48 +03:00
yuyi
b08f500c60 cgen: fix fn_var_signature() when param type is function (#15436) 2022-08-16 20:21:58 +03:00
yuyi
dc37386bcc cgen: minor optimization in return_stmt() (#15434) 2022-08-16 20:21:02 +03:00
Markus F.X.J. Oberhumer
77fd1419a7 cgen: avoid another sizeof warning in generated code (#15435) 2022-08-16 20:20:13 +03:00
Delyan Angelov
18cccb6caf builtin: show non zero codes on bubbled error_with_code(msg,code) errors 2022-08-16 18:59:38 +03:00
yuyi
66a3cdec6a cgen: add fn_var_signature(info ast.FnType, var_name string) string (#15433) 2022-08-16 12:57:33 +03:00
Swastik Baranwal
3bc01d696d cgen: fix []u8 string representation (#15432) 2022-08-15 23:48:38 +03:00
Nikolai
3aad5e2a8d cgen, checker: fix multi line return optional (#15428) 2022-08-15 23:43:56 +03:00
yuyi
8be85e7590 cgen: fix shared map delete (#15431) 2022-08-15 23:42:57 +03:00
Delyan Angelov
26986eb2f8 tests: fix deprecation warning in tcp_test.v 2022-08-15 15:17:00 +03:00
yuyi
6fdcc5bcd0 checker, cgen: fix closure with fn variables (fix #15286) (#15427) 2022-08-15 06:52:08 +03:00
Emily Hudson
90d9b200f9 gc: fix msvc not using libatomic_ops (#15418) 2022-08-14 13:16:52 +03:00
Delyan Angelov
8f98f1db9e os: fix os.open_file('text.txt', 'wb', 0o666), add test (#15420) 2022-08-14 09:50:05 +03:00
Delyan Angelov
cae7bc9a9a examples: add examples/gg/rotating_textured_quad.v 2022-08-14 09:45:25 +03:00
Swastik Baranwal
7280d4c95a checker: add error for println('x').abcd (#15423) 2022-08-14 09:43:54 +03:00
Delyan Angelov
4c0339242a doc: fix example comment for string.strip_margin() 2022-08-14 08:06:52 +03:00
yuyi
9734148f12 cgen: fix generic with multi-nested generic method call ref argument (#15421) 2022-08-13 19:26:00 +03:00
StunxFS
672066b65b cgen: fix optional indexes with mutable arrays (#15399) 2022-08-13 11:58:31 +03:00
Ken
001144fa82 doc: fix a typo in the -no-preludes option description in v help build-c (#15404) 2022-08-13 10:07:08 +03:00
Joe Conigliaro
f557acf76b net.urllib: fix ipv6 address parsing [ipv6]:port closes #15309 2022-08-13 00:50:38 +10:00
StunxFS
657389446b checker: fix typo (#15397) 2022-08-12 17:25:52 +03:00
yuyi
9f2651717a checker: fix generics with multi nested generic method call (#15410) 2022-08-12 17:25:29 +03:00
Hitalo de Jesus do Rosário Souza
b45da86688 examples: refactor vweb_orm_jwt (#15389) 2022-08-12 17:24:57 +03:00
yuyi
9c96b13f9b ast: fix anon fn with nested anon fn argument (#15415) 2022-08-12 17:24:23 +03:00
yuyi
70e3c72619 ast: fix expr.str() (fix #12650 #13312) (#15414) 2022-08-12 17:24:13 +03:00
yuyi
584597aa3d checker: check mismatch of return result type (#15413) 2022-08-12 17:23:14 +03:00
yuyi
e6606d8670 cgen: fix optional in if expr (#15411) 2022-08-12 17:22:27 +03:00
Alexander Medvednikov
09f1eb9ad2 doc: make if debug a bit more clear 2022-08-12 05:10:39 +03:00
Larpon
fd83b95d85 sokol: expose context_pool_size field on sgl.Desc (#15409) 2022-08-11 20:49:11 +03:00
yuyi
9e0bf005f7 checker: simplify infer_fn_generic_types() (#15408) 2022-08-11 14:25:43 +03:00
yuyi
275a997ec1 vweb: fix vweb static url (#15396) 2022-08-11 08:28:47 +03:00
yuyi
32fa475316 markused: fix generic fn mark as used (fix #15387) (#15406) 2022-08-11 08:27:20 +03:00
Nikolai
f54e45b77e json: fix array_fixed encode/decode (#15398) 2022-08-11 03:52:56 +03:00
Markus F.X.J. Oberhumer
5095364838 cgen: avoid a compiler warning in generated code (#15394) 2022-08-11 03:52:42 +03:00
Delyan Angelov
1c6366eb9c cgen: fix generated any/filter/all methods for shared array fields 2022-08-10 14:05:33 +03:00
yuyi
78d0255e6c checker: fix generics with nested generic method call (#15390) 2022-08-10 11:29:19 +03:00
Delyan Angelov
c752e5eb3e checker: add a suggestion for misspelled field names in struct literals 2022-08-10 11:01:43 +03:00
yuyi
d3aa7700c7 cgen: fix shared struct method call (#15386) 2022-08-09 12:44:19 +03:00
yuyi
7be9963a41 checker: fix dumping generic fn mut argument (#15384) 2022-08-09 07:46:55 +03:00
yuyi
d4b622bdc2 checker: add pref.is_verbose for print_backtrace (#15385) 2022-08-09 07:43:59 +03:00
Spydr
27c5ad03f6 native: initial linking support for linux (#15326) 2022-08-08 22:32:14 +03:00
StunxFS
a6026fd505 checker: disallow method calls with invalid expressions (#15337) 2022-08-08 17:35:24 +03:00
yuyi
9b88feccad checker: check generic method call argument mismatch (#15378) 2022-08-08 17:30:48 +03:00
Delyan Angelov
5a834a2ef9 encoding.base58: remove one unnecessary map access per the most common BTC usages; implement encode_bytes, decode_bytes, encode_walpha_bytes, decode_walpha_bytes functions 2022-08-08 15:37:00 +03:00
yuyi
6a728e1674 cgen: fix shared array.last() (#15379) 2022-08-08 13:11:38 +03:00
yuyi
c7152a6ab6 checker: fix generics with nested generic fn call (#15361) 2022-08-08 04:54:52 +03:00
Hitalo de Jesus do Rosário Souza
ee9142a113 examples: V orm still fast? (#15330) 2022-08-08 04:38:38 +03:00
jrfondren
0b1486f014 http: avoid costly string interpolation of resp.body (#15376) 2022-08-08 04:36:45 +03:00
Ikko Ashimine
d74cf084fb readme: fix a typo (#15373) 2022-08-08 03:01:05 +03:00
Vincenzo Palazzo
b01f71d9da io: migrate the Reader API to Result instead of Option (#15229) 2022-08-08 02:33:25 +03:00
l-m
8c33a40c5a vrepl: implement the 'pin' command from crepl (#15371) 2022-08-07 14:06:50 +03:00
Emily Hudson
fd1b6efea6 net: add failed addresses + details on connect errors, make connect more robust in the default non blocking mode (#15364) 2022-08-07 10:40:05 +03:00
Swastik Baranwal
d6b594c4e8 checker: check if struct field type isn't type (#15359) 2022-08-06 19:11:51 +03:00
yuyi
8d9af2e4a1 cgen: fix nested generic fn call with reference argument (#15353) 2022-08-06 19:07:33 +03:00
Delyan Angelov
4588bb44ab markused: skip panic_result_not_set (generated for fn main(){ foo()! }) too 2022-08-06 10:29:44 +03:00
cstffx
095f4bcf86 orm: add missing 'nonull' attribute description (#15348) 2022-08-05 10:27:19 +03:00
yuyi
ab244d2236 checker: cleanup in if_expr() (#15347) 2022-08-05 03:02:22 +03:00
yuyi
9e50803071 ast, parser: fix reference typenode (#15346) 2022-08-05 03:01:49 +03:00
yuyi
e034b35144 cgen: fix generic interface call with reference argument (#15345) 2022-08-05 03:01:11 +03:00
yuyi
d7a3b866ee checker: check generic interface missing type parameter (#15344) 2022-08-04 11:02:34 +03:00
Hitalo de Jesus do Rosário Souza
161ac3434f examples: serve js (#15246) 2022-08-03 13:34:26 +03:00
yuyi
372857c19c checker: minor cleanup in struct_decl() (#15325) 2022-08-03 13:28:53 +03:00
yuyi
2ad25f6d06 checker: fix nested generic fn call (fix #15328) (#15333) 2022-08-03 13:24:39 +03:00
Delyan Angelov
77495c8d03 all: support assert condition, extra_message, evaluating and showing extra_message on assert failure (#15322) 2022-08-03 01:14:01 +03:00
Subhomoy Haldar
fcde63127f rand: fix incorrect generic function call (#15327) 2022-08-02 20:11:49 +03:00
Sandro Martini
51ef8b62ba log: cleanup tests (#15320) 2022-08-02 18:01:49 +03:00
Spydr
867f500d78 gitignore: ignore valgind vgcore.* debug files (#15321) 2022-08-02 17:59:29 +03:00
Delyan Angelov
45c601b79c cgen: fix sorting of shared array fields (fix #15244) 2022-08-02 16:17:11 +03:00
Delyan Angelov
857e047d01 json: tag functions that cgen may call internally for json.encode/json.decode, as [markused] 2022-08-02 11:45:41 +03:00
Nacho Verdón
42efc383d2 encoding.binary: fix function names in comments (#15317) 2022-08-02 00:30:06 +03:00
Nacho Verdón
0555894e7f .github: Add example on PR template title to avoid confusion (#15311) 2022-08-01 23:29:04 +03:00
yuyi
ce59fffb53 scanner: make scan_all_tokens_in_buffer() private (#15312) 2022-08-01 23:15:56 +03:00
yuyi
7546d1450c scanner: minor optimization (#15313) 2022-08-01 23:09:27 +03:00
Spydr
dab8159b56 native: implement elf section types (#15316) 2022-08-01 23:04:59 +03:00
Delyan Angelov
a35356758c log: make set_level(level Level) part of the log.Logger interface too (fix for discordv) 2022-08-01 15:09:32 +03:00
StunxFS
b08690d151 gen.c: simplify unwrap_generic method (#15288)
* gen.c: use `nil` instead of `0`
* replace `muttable` => `mut_table`
2022-08-01 11:40:37 +03:00
Spydr
b4fd9b5f92 native: add sections for string- and symbol-tables, reimplement elf program headers (#15305) 2022-08-01 10:15:06 +03:00
Nacho Verdón
9561fb406e encoding.binary: add functions to read/write with an offset and at the end of the array, split files by endianness (#15301) 2022-08-01 08:20:14 +03:00
Dialga
dc78f1ba17 szip: update to 0.2.4 (#15296) 2022-08-01 00:47:45 +03:00
Delyan Angelov
fa75713bc3 tools: create the vmodules folder, when it does not exist, on v translate hw.c 2022-07-31 15:43:04 +03:00
Delyan Angelov
b8438ded32 markused: support vweb App.before_request() with -skip-unused 2022-07-30 18:56:05 +03:00
yuyi
014f44eab3 checker: improve error message of method_call_arg_no_mut_err.vv (#15281) 2022-07-30 18:11:10 +03:00
Davide Beatrici
c9a5896468 bultin: always enable GC_THREADS, even with -d dynamic_boehm, otherwise multithread operation is unsafe (#15275)
According to upstream documentation, only GC_WIN32_THREADS is explicit.

This PR fixes a random memory corruption(s) with "-d dynamic_boehm" on OpenMandriva.
1679adc04d.log
```
DEBUG: + VFLAGS='-prod -d dynamic_boehm'
DEBUG: + /usr/bin/clang -Os -fomit-frame-pointer -g3 -gdwarf-4 -Wstrict-aliasing=2 -pipe -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fstack-protector-all --param=ssp-buffer-size=4 -m64 -mtune=generic -flto -std=gnu99 -w -o tmp_1 v.c -lm -lpthread -Os -fomit-frame-pointer -g3 -gdwarf-4 -Wstrict-aliasing=2 -pipe -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fstack-protector-all --param=ssp-buffer-size=4 -m64 -mtune=generic -flto -Wl,-O2 -Wl,--no-undefined -flto
DEBUG: + ./tmp_1 -no-parallel -o tmp_2 -prod -d dynamic_boehm cmd/v
DEBUG: + ./tmp_2 -o v -prod -d dynamic_boehm cmd/v
DEBUG: /var/tmp/rpm-tmp.mcjmqc: line 52:   644 Bus error               (core dumped) ./v build-tools
```
2022-07-30 14:59:12 +03:00
yuyi
db79888daf picoev: restore struct Picoev definition (#15278) 2022-07-30 14:30:13 +03:00
yuyi
6e8350a9c9 fmt: fix interface method with fntype argument (#15280) 2022-07-30 14:29:41 +03:00
yuyi
e6a04905e9 fmt: fix comptime method call (#15279) 2022-07-30 14:28:34 +03:00
yuyi
b6ce7cc198 checker: check invalid variable (fix #15240) (#15260) 2022-07-30 14:27:28 +03:00
Delyan Angelov
0133ff2cbf checker: use reserved_type_names_chk.matches(word) instead of word in reserved_type_names 2022-07-29 23:23:34 +03:00
Delyan Angelov
f0a8d57735 checker: use array_builtin_methods_chk.matches(method_name) instead of method_name in array_builtin_methods 2022-07-29 23:23:34 +03:00
Delyan Angelov
336305daa5 scanner,parser,gen: use km.matches(word) instead of km.find(word) != -1 2022-07-29 23:23:33 +03:00
Delyan Angelov
2db8bd62a2 token: fix a new_keywords_matcher_from_array_trie bug (first word with idx 0 was ignored); add tests 2022-07-29 23:23:33 +03:00
Delyan Angelov
a42eb3b947 cgen: use a trie matcher for c_reserved checks as well 2022-07-29 23:23:32 +03:00
zakuro
8268df7e1d parser: create and use Parser.unexpected to unify all unexpected token error messages (#15259) 2022-07-29 19:28:34 +03:00
yuyi
1be595605a parser: fix optional fn argument (#15271) 2022-07-29 19:10:50 +03:00
yuyi
0bf23488dc checker: check struct field's fn call (fix #15249) (#15257) 2022-07-29 19:00:51 +03:00
lemon
927ec1fadb native: support ||, && and simple boolean expression evaluation (#15256) 2022-07-29 07:17:01 +03:00
Delyan Angelov
04b28d11be cgen: use switch for matches with integer literals, instead of an if else if ladder (#15254) 2022-07-29 00:36:29 +03:00
yuyi
17ce1a0e8d parser: check undefined ident in if guard expr (#15253) 2022-07-28 19:13:41 +03:00
Delyan Angelov
242ade8938 os: fix File.eof on FreeBSD (feof is a C macro there) 2022-07-28 17:26:55 +03:00
Reuben Thomas
ed56c3957e os: add File.reopen and File.eof methods (#15184) 2022-07-28 16:21:23 +03:00
Tim Dupont
3d0a48b1bb CHANGELOG.md: fix for a small typo (paramter -> parameter) (#15252) 2022-07-28 14:16:33 +03:00
Dialga
18ae726015 v.pkgconfig: add the default path for Debian 32bit (#15250) 2022-07-28 14:06:56 +03:00
Delyan Angelov
a16f9ac41f mysql: include workaround for windows programs that just exit, when the libmysql.dll is not found, into vlib/mysql/README.md 2022-07-27 22:26:36 +03:00
l-m
10f3c9f127 builtin: add string.replace_char and string.normalize_tabs (#15239) 2022-07-27 22:04:39 +03:00
yuyi
60094d95e2 cgen: check comptime call method (no value) used as value (#15241) 2022-07-27 21:32:00 +03:00
Davide Beatrici
8af87a9e98 make: rename "V" to "VEXE" in GNUmakefile, to prevent conflicts while building RPMs (#15237)
This fixes a build failure when using "%make_build" in an RPM spec file:

make: 1: No such file or directory
make: *** [GNUmakefile💯 all] Error 127
2022-07-27 21:04:29 +03:00
yuyi
6a7eb82d9e cgen: fix comptime for method call with arguments (#15236) 2022-07-27 03:22:05 +03:00
stringnick
afaab7ab4d stdatomic: add/sub return result of op (#15235) 2022-07-27 03:21:03 +03:00
Hitalo de Jesus do Rosário Souza
e5e750d533 orm: default attribute (#15221) 2022-07-27 00:59:32 +03:00
yuyi
c976a691ad scanner: correct error message of empty character literal (fix #15226) (#15228) 2022-07-26 15:07:08 +03:00
Bastian Buck
4ab72ccb69 os: add a security advisory for potential TOCTOU risks when using os.is_writable, os.is_executable etc (#15222) 2022-07-26 12:02:48 +03:00
yuyi
03b7c76b38 cgen: optimize auto_str_methods of [str:skip] fields (#15227) 2022-07-26 09:38:50 +03:00
yuyi
0b0c496eff cgen: fix printing struct with skip fields (#15224) 2022-07-26 04:37:16 +03:00
Alexander Medvednikov
f1ebfb2d42 cgen: str:skip field 2022-07-25 17:25:47 +03:00
Alexander Medvednikov
5a3a145e99 gg: fix native draw_circle on macos 2022-07-25 17:25:47 +03:00
yuyi
f619becbdc scanner: check undefined ident in string literal (#15212) 2022-07-25 14:28:47 +03:00
Hitalo de Jesus do Rosário Souza
82db1e4746 pg: improve pg README.md (#15206) 2022-07-25 08:32:21 +03:00
Tim Richardson
7bf2ad6889 vscode.md: fix typo (#15207) 2022-07-25 08:04:06 +03:00
Andrew Compton
f9385f6300 os: make get_raw_line() should not break lines on \r on windows (fix #5900) (#15205) 2022-07-25 08:03:07 +03:00
Delyan Angelov
6a5db0df61 v.token: use a more performant KeywordMatcher in the scanner and parser (#15196) 2022-07-25 06:32:06 +03:00
Subhomoy Haldar
297cb5f89c math.big: improve multiplication performance (#15200) 2022-07-24 19:35:37 +03:00
Hitalo de Jesus do Rosário Souza
2d7406a8cd examples: v back-end example for vweb (#15141) 2022-07-24 13:02:57 +03:00
Hitalo de Jesus do Rosário Souza
1f3be99859 crypto: add an example of how to verify jwt tokens (#15198) 2022-07-24 10:27:21 +03:00
yuyi
5464de406c cgen: fix custom str on struct with too many fields (#15195) 2022-07-24 10:15:22 +03:00
Delyan Angelov
de0683fe30 tests: fix compilation of tcp_test.v 2022-07-23 23:33:43 +03:00
Delyan Angelov
c63fed5393 tests: remove needless import math in translated_test.v 2022-07-23 23:24:17 +03:00
Alexander Medvednikov
d8b0df1a31 doc: fix ci 2022-07-23 01:55:17 +03:00
Alexander Medvednikov
d6de53362f checker: improve unused label check 2022-07-23 01:36:27 +03:00
Alexander Medvednikov
4d3401c852 checker: check for unused labels 2022-07-23 01:25:20 +03:00
Alexander Medvednikov
af41058979 doc: map ordering 2022-07-23 00:53:42 +03:00
Reuben Thomas
2ffad85f06 doc: remove misleading comment about stdin() (#15154) 2022-07-23 00:22:50 +03:00
yuyi
b0c32e0dbf checker: fix fn variadic with enum value (#15177) 2022-07-22 16:08:22 +03:00
yuyi
092f5f0bf8 checker: fix comptime if in const declaration (fix #15160) (#15169) 2022-07-22 16:03:45 +03:00
zakuro
9ec8a99243 parser: cleanup orblock duplicate code (#15173) 2022-07-22 12:36:50 +03:00
Delyan Angelov
e9809572b1 ast: use const empty_expr instead of fn empty_expr (thanks to Joe Conigliaro for the idea) (#15175) 2022-07-22 12:14:46 +03:00
Delyan Angelov
c6aea659e3 cgen,ci: fix v -usecache self on macos 2022-07-22 11:43:20 +03:00
Delyan Angelov
f75d7eb114 ci: fix v build-examples (use voidptr(u64(0)) inside vlib/js/dom/dom.js.v) 2022-07-21 23:08:18 +03:00
Delyan Angelov
5340f8afea ci: fix vlib/v/checker/tests/nil.vv and its .out file 2022-07-21 23:05:02 +03:00
Delyan Angelov
474033c055 ci: allow unsafe { a := nil }, add separate nil case in pointer_ops.vv, to test the nil checker errors independently from the voidptr ones 2022-07-21 22:52:38 +03:00
Delyan Angelov
697d546d46 ci: fix fixed_array_conv.out output (the .vv file was formatted) 2022-07-21 22:45:54 +03:00
Delyan Angelov
cf42ba2b80 ci: revert nil to voidptr(u64(0)) in voidptr_dereference_err.vv too. nil should have its own .vv/.out pair. 2022-07-21 22:43:14 +03:00
Delyan Angelov
cdefb878d6 ci: make pass_voidptr_as_interface_reference_test.v use voidptr again 2022-07-21 22:41:27 +03:00
Delyan Angelov
2e89eeb477 ci: make voidptr_casted_as_an_interface_test.v use voidptr again (it does test exactly that edge case, it should not have been converted to use nil) 2022-07-21 22:40:21 +03:00
Delyan Angelov
71cd256f0c ci,cgen: fix -usecache compilation of V itself 2022-07-21 22:29:44 +03:00
Delyan Angelov
73b02cdf36 ci: fix spurious native_backend_tests.yml cancellations 2022-07-21 22:13:21 +03:00
Delyan Angelov
81104ac309 ci: fix v test-cleancode failures 2022-07-21 22:05:17 +03:00
Delyan Angelov
231623b75b ci: vfmt tcp_test.v 2022-07-21 22:04:51 +03:00
Delyan Angelov
dc1b54c669 ci: fix failing ./v vlib/builtin/builtin_test.v (globals initialisation) 2022-07-21 21:49:00 +03:00
Delyan Angelov
ed43bfc469 ci: fix dlmalloc again (workaround vfmt) 2022-07-21 21:21:20 +03:00
Delyan Angelov
e29f6d1393 markused: fix ./v -skip-unused -cc gcc -keepc -freestanding -o bel vlib/os/bare/bare_example_linux.v 2022-07-21 21:18:33 +03:00
Delyan Angelov
d9fe2edc41 ci: fix failing build-module-docs (because of unsafe { unsafe { nil } }) 2022-07-21 21:11:43 +03:00
Delyan Angelov
6ebe668a74 tools: show the exact failing c2v command on v translate failure for easier diagnostic/debugging. 2022-07-21 21:04:06 +03:00
Alexander Medvednikov
9099594a49 all: wrap up unsafe { nil } (p. 3) 2022-07-21 21:01:30 +03:00
Alexander Medvednikov
a68d03ac59 checker: allow x := unsafe { nil } 2022-07-21 20:56:24 +03:00
Alexander Medvednikov
dc79f1392b all: voidptr(0) => unsafe { nil } (p.2) 2022-07-21 20:51:54 +03:00
Alexander Medvednikov
1f25811786 roadmap: update 2022-07-21 20:47:30 +03:00
Alexander Medvednikov
caa0c2f153 vfmt: voidptr(0) => unsafe { nil } (p.1) 2022-07-21 20:46:01 +03:00
yuyi
be9f8cc777 cgen: fix comptime if in struct field default (fix #15058) (#15152) 2022-07-21 16:59:18 +03:00
yuyi
7029e39088 checker: check struct field with default expression (#15151) 2022-07-21 10:33:34 +03:00
Joe Conigliaro
49228e1acd cgen: fix dep cycle for struct Node { children [4]&Node } closes #15136 2022-07-21 16:16:24 +10:00
Delyan Angelov
8593408179 json.cjson: add a submodule that allows lower level access to the cJSON library (constructing JSON trees in memory with null leafs). 2022-07-20 23:34:17 +03:00
Hitalo de Jesus do Rosário Souza
c8d4534f5b sqlite: remove spurious eprintln on select calls (#15139) 2022-07-20 17:35:38 +03:00
Ned
57a201f28c tools: add helpful message, when the vls server executable is not found on v ls (#15129) 2022-07-20 14:26:49 +03:00
kahsa
9995063304 doc: add a go fn() {} example (#15134) 2022-07-20 14:24:13 +03:00
yuyi
f27c0387ad cgen: minor cleanup in global_decl() (#15133) 2022-07-20 13:51:33 +03:00
Delyan Angelov
ee4a179e71 tests: add a test for Node{123, unsafe { nil }, unsafe { nil }} 2022-07-20 11:29:01 +03:00
Delyan Angelov
50075d5a79 ast,cgen: support a := Abc{unsafe{nil}}, for struct Abc { next &Abc } 2022-07-20 10:47:04 +03:00
Fossean1
1ccb4c3ac0 doc: minor fixes in examples (#15125) 2022-07-19 20:59:59 +03:00
Hitalo de Jesus do Rosário Souza
a13b8ff0c8 mysql: fix for adapting mysql types to v structs (#15100) 2022-07-19 18:29:09 +03:00
yuyi
041e90b2e2 checker, cgen: fix interface embedding smartcast (fix #13296) (#15127) 2022-07-19 16:36:16 +03:00
Alexander Medvednikov
0afa2f76c8 ci: fix gitly ci 2022-07-19 13:53:05 +03:00
Alexander Medvednikov
fd47385ff2 checker: check untyped nil in assignment 2022-07-19 13:31:10 +03:00
Alexander Medvednikov
1aeca113d3 sokol: do not crash if an image cannot be rendered 2022-07-19 13:21:34 +03:00
SakthiMahendran
e4674cb8e1 examples: replace "resp.text" with "resp.body". (#15123) 2022-07-19 12:52:42 +03:00
yuyi
a39fe68af1 cgen: clean up ident() in cgen.v (#15121) 2022-07-19 10:54:03 +03:00
Ned
c7ec71cd06 tools/vls: skip 'ls' argument on v ls (#15126) 2022-07-19 10:52:39 +03:00
Larpon
02925cecd1 ci: fix report-missing-fn-doc (#15118) 2022-07-18 22:33:18 +03:00
Mehmet Ali
12d57e8e7b sokol: add mouse cursor support (#15111) 2022-07-18 09:44:48 +03:00
Zhomart Mukhamejanov
c1502b3c1f examples: add macos_tray example app (#15101) 2022-07-18 09:42:45 +03:00
yuyi
5462d4aebf checker: check generic interface declaration (#15108) 2022-07-18 01:36:37 +03:00
penguindark
706a922e0c x.ttf: update to fix compilation of vlang/pdf and failing ci (#15109) 2022-07-17 19:44:11 +03:00
yuyi
eed496d0bc checker: check generic struct declaration (#15106) 2022-07-17 18:09:15 +03:00
Spydr
368cccb059 native: add typechecking to gen_var_to_string() (#15107) 2022-07-17 18:09:03 +03:00
Spydr
c73c4dc884 native: system for defining internal builtin algorithms which are not inlined (#15105) 2022-07-17 16:22:54 +03:00
yuyi
58ad6f7999 checker: check generic fn declaration (#15104) 2022-07-17 14:32:59 +03:00
yuyi
78242627c3 parser: fix fn argument type position (#15102) 2022-07-17 10:55:20 +03:00
Ken
3075e35237 encoding.csv: handle bools (#15103) 2022-07-17 10:54:36 +03:00
boris-741
b4dedcae43 encoding.csv: generic serialization (#15097) 2022-07-16 22:21:05 +03:00
yuyi
8d24522d02 parser: check generic interface method declaration (#15095) 2022-07-16 16:58:39 +03:00
Delyan Angelov
5e0899853b dlmalloc: fix warning about fixed arrays of references, by using unsafe{} 2022-07-16 16:37:20 +03:00
Delyan Angelov
bd4e9f6225 v: offer a suggestion for misspelled commands like v held 2022-07-16 14:58:26 +03:00
Delyan Angelov
b01df8ed0a help: chmod 644 cmd/v/help/where.txt 2022-07-16 12:45:08 +03:00
yuyi
ac7e809464 checker: fix generics struct init in generic fn (fix #15080) (#15088) 2022-07-15 17:30:56 +03:00
yuyi
560afac5d5 cgen: fix fixed array of threads (#15086) 2022-07-15 14:19:11 +03:00
lemon
f2961ec862 native: refer to types to generate code (#15077) 2022-07-15 14:18:32 +03:00
yuyi
57c4188d98 ast, checker: check generic fn declaration error (#15079) 2022-07-15 14:18:06 +03:00
shove
b4ed5d5f20 net: add a net.dial_tcp_with_bind/2 function (#15055) (#15056) 2022-07-15 12:38:17 +03:00
Sebastian Atlántico
4f997feee7 tools: add tests for v where; improve usability (#15059) 2022-07-15 07:59:11 +03:00
Alexander Medvednikov
89a757aba0 doc: clean up 2022-07-14 11:10:15 +03:00
Alexander Medvednikov
8d0fe3894a doc: document anonymous structs 2022-07-14 11:06:10 +03:00
yuyi
0d6d6f7de8 cgen: fix fixed array literal index (fix #14959) (#15054) 2022-07-14 08:23:29 +03:00
Alexander Medvednikov
a38310f929 checker: array of references check 2022-07-14 00:58:14 +03:00
Sebastian Atlántico
47b5d206a6 cmd/tools: vwhere fixes (#15051) 2022-07-13 18:04:26 +03:00
Hitalo de Jesus do Rosário Souza
3f3742122f orm: sql type in struct by attribute (#14919) 2022-07-13 18:03:30 +03:00
Hunam
4238e5f6b9 roadmap: update (#15038) 2022-07-13 10:04:27 +03:00
yuyi
7594157deb checker: check generic interface declaration (#15047) 2022-07-13 09:43:54 +03:00
Sebastian Atlántico
28fd17654e tools: add a v where fn join_path command, for platform independent searching the location of a symbol in the local project, vlib, ~/.vmodules (#15014) 2022-07-13 07:40:54 +03:00
wilesun
d12a8aef68 json: use C.cJSON_free, for freeing the intermediate result in json_print and json_print_pretty (#15029) 2022-07-13 07:11:18 +03:00
Jun
16a6972e2a readme: fix vinix screenshots (#15041) 2022-07-13 01:13:45 +03:00
yuyi
19d0d758c9 cgen: fix struct shared field with default init (#15040) 2022-07-12 20:04:06 +03:00
yuyi
7a17a29952 examples: fix typo in c_interop_wkhtmltopdf.v (#15036) 2022-07-12 19:42:55 +03:00
yuyi
9839ab6a6c parser: fix parse c function with optional argument name (fix #13234) (#15037) 2022-07-12 11:06:29 +03:00
Delyan Angelov
b59e6b1d06 ci: do periodic runs only in the main V repository (not in forks) 2022-07-12 11:03:59 +03:00
Delyan Angelov
662d0a3ef2 ci: change ci_bootstrapping_works.yml to a periodic run, *only* on the main repository. 2022-07-12 11:02:51 +03:00
Delyan Angelov
a4e0e0fa57 builtin: add drafts for __new_array_noscan, __new_array_with_default_noscan, __new_array_with_array_default_noscan for array_notd_gcboehm_opt.v 2022-07-12 10:00:58 +03:00
yuyi
62d800a775 checker, cgen: fix array of sumtype appending alias (#15034) 2022-07-12 09:26:11 +03:00
Subhomoy Haldar
8a4313c1b8 ci: fix vlib/v/builder/builder_test.v failures on msvc (#15035) 2022-07-12 08:46:59 +03:00
Dmitriy Smirnov
f35a3a89f9 checker: fix dereferencing voidptr. (#15033) 2022-07-12 01:12:29 +03:00
Subhomoy Haldar
dc68469818 use trimmed output for comparison (#15032) 2022-07-11 22:47:32 +03:00
Subhomoy Haldar
fbad48b5d9 v.builder: retain executable after v run, if the executable was already existing (#15021) 2022-07-11 21:08:53 +03:00
Delyan Angelov
f16355eeba ci: fix build failure (complete renaming in 39b6851) 2022-07-11 20:59:37 +03:00
yuyi
39b68518b2 checker: minor refactor in infix_expr() (#15028) 2022-07-11 20:16:42 +03:00
shove
032cb3f115 checker: fix the type of ComptimeCall (fixes #14996) (#15013) 2022-07-11 20:08:01 +03:00
yuyi
398bd2280d cgen: fix printing reference alias (#15027) 2022-07-11 20:04:34 +03:00
yuyi
ec19f4289c checker, cgen: fix alias operator overloading (#15024) 2022-07-11 19:20:15 +03:00
yuyi
9231697966 parser: check for illegal use of any type (fix #15003) (#15020) 2022-07-11 15:29:25 +03:00
Delyan Angelov
5498a6c263 tests: add more -skip-unused cases to v test-all 2022-07-11 11:02:17 +03:00
Delyan Angelov
94e35b710c markused: fix C compilation failures on -skip-unused -profile 2022-07-11 10:56:13 +03:00
yuyi
81d694b1f8 tests: restore interfaces_map_test (#15019) 2022-07-11 09:05:36 +03:00
yuyi
a6cc4c4c28 parser: minor cleanup in parse_type.v (#15011) 2022-07-11 08:03:08 +03:00
yuyi
7ff20c09ca tests: restore test_interface_struct_from_mut_array() (#15018) 2022-07-11 07:57:14 +03:00
Ned
a331cf577a tools/vls: fix installing vls when config is not present (#15017) 2022-07-11 07:56:53 +03:00
yuyi
cc43a23f29 vweb: check invalid port number (#15016) 2022-07-11 07:55:33 +03:00
Alexander Medvednikov
bfcf5b13ed checker: fix #define check on windows 2022-07-11 00:20:12 +03:00
Alexander Medvednikov
22dac71b33 checker: do not allow #define everywhere 2022-07-10 22:51:06 +03:00
Ned
235ef23588 tools: add v ls - a VLS launcher and updater utility (#15009) 2022-07-10 20:27:50 +03:00
yuyi
58c5d387c4 parser: check closure capture global variable (#15010) 2022-07-10 20:21:54 +03:00
Delyan Angelov
3549055548 ci: use v should-compile-all sdl/examples/ instead of the bash script that choked on v sdl/examples/assets 2022-07-10 20:05:04 +03:00
Delyan Angelov
3b575e83f1 ci: fix ./v cmd/tools/builders/golang_builder.v 2022-07-10 18:53:18 +03:00
Delyan Angelov
01dabe5966 ci: fix failing invalid_struct_decl_script_err.vv 2022-07-10 18:37:42 +03:00
Delyan Angelov
5d8d11c989 ci: fix v cmd/tools/vast after ast.StructInit field renaming 2022-07-10 18:28:24 +03:00
Delyan Angelov
d15e9f4866 ci: remove forgotten dump call 2022-07-10 17:05:49 +03:00
Delyan Angelov
69aaf68f2f cgen: fix anon struct auto string method generation 2022-07-10 16:57:13 +03:00
yuyi
64eab72f4c checker: fix anon fn using global variable (fix #15004) (#15008) 2022-07-10 12:43:50 +03:00
Alexander Medvednikov
7d0a9186bb all: wrap up anonymous structs 2022-07-10 12:00:17 +03:00
Ken
1ae11b41e7 net.websocket: make logger configurable (#14998) 2022-07-09 17:39:07 +03:00
Thomas Peißl
739f3cd90b pref: detect termux more reliably (#15001) 2022-07-09 17:23:19 +03:00
Subhomoy Haldar
8ee614d3f8 encoding.binary: add unit tests and module documentation (#15000) 2022-07-09 15:52:19 +03:00
Hitalo de Jesus do Rosário Souza
d4b0ebf215 doc: clear the explanation to 'sql: type' (#14915) 2022-07-09 14:04:35 +03:00
Delyan Angelov
f56aaa1007 examples: simplify examples/websocket/ping.v (end automatically, when the client ends) 2022-07-09 12:40:52 +03:00
CC
7e1c45ab44 math: add round_sig function for f64 (#14997) 2022-07-09 10:41:58 +03:00
shove
c5a290ffc6 cgen: fix lost return in ComptimeCall (fixes #14962) (#14995) 2022-07-09 08:55:01 +03:00
Alexander Medvednikov
70890b27a5 cgen: handle default anonymous structs 2022-07-08 15:40:57 +03:00
Emirhan Yener
1a49db4ea1 examples: remove empty comments (#14986) 2022-07-08 15:35:45 +03:00
Delyan Angelov
02d675ab67 os: restore the env TERMUX_VERSION based final resort for runtime auto detection of Termux 2022-07-08 11:16:53 +03:00
StunxFS
bcaa3ac915 vlib: remove jsdom module, use js.dom instead (#14985) 2022-07-08 09:23:10 +03:00
penguindark
df4bd88d45 x.ttf: fix a bug in TTF fixed point data management (#14987) 2022-07-08 09:20:59 +03:00
yuyi
5aa6ec0693 cgen: fix error for comptime method call (#14992) 2022-07-08 09:18:49 +03:00
Delyan Angelov
5f140fe2ff ci: v fmt -w vlib/v/builder/cc.v 2022-07-07 23:57:21 +03:00
StunxFS
9376009c39 v.eval: support panic function (#14972) 2022-07-07 20:00:59 +03:00
CC
6b597a4b58 builder: add support for icc (Intel C Compiler) (#14975) 2022-07-07 19:48:07 +03:00
yuyi
758f84fa86 ast, parser, cgen: fix anon sumtype cast (fix #14967) (#14976) 2022-07-07 18:51:57 +03:00
yuyi
029d583bb2 cgen: a minor fix in match_expr (#14983) 2022-07-07 18:51:27 +03:00
Larpon
9f3b6e3e3a android: provide more predictable logging, add comptime termux support (#14984) 2022-07-07 18:28:29 +03:00
Delyan Angelov
71a85249ea ci: fix failing ./v -W build-tools 2022-07-07 18:22:21 +03:00
Alexander Medvednikov
f5001192f9 fmt: handle anon structs; tests: bring back anon struct test 2022-07-07 16:11:13 +03:00
zakuro
972bba66d1 checker,ast: clean up deprecation code (#14980) 2022-07-07 15:45:45 +03:00
Delyan Angelov
de77114593 eval: support assignment operators like +=, make for a in 0..10 { more robust 2022-07-07 15:13:22 +03:00
Alexander Medvednikov
15ce15d41b tests: disable anon struct test for now 2022-07-07 13:08:10 +03:00
Delyan Angelov
91acd0f380 ci: fix failing v check-md vlib/sqlite/README.md 2022-07-07 13:05:05 +03:00
Alexander Medvednikov
7da466e81b parser: show a hint when using v . with multiple fn mains 2022-07-07 13:04:08 +03:00
Alexander Medvednikov
426421bebb all: anonymous structs (part 2) 2022-07-06 21:38:45 +03:00
yuyi
f4b39fbe4f cgen: fix sumtype with none (#14965) 2022-07-06 21:03:42 +03:00
CC
d86b4951c7 sqlite: add sync and journal funcs, docs (#14970) 2022-07-06 21:01:27 +03:00
Delyan Angelov
f0ce7fb9d3 Revert "gg: fix android compilation for ~/.vmodules/ui/examples/rectangles.v"
This reverts commit f1a855e6d2.
2022-07-06 16:19:40 +03:00
Delyan Angelov
f1a855e6d2 gg: fix android compilation for ~/.vmodules/ui/examples/rectangles.v 2022-07-06 16:02:50 +03:00
Delyan Angelov
82f7597a0c ci: fix failing v check-md doc/docs.md 2022-07-06 15:52:18 +03:00
Delyan Angelov
3308313167 os: remove the closing of stream handles at the end of Process.win_slurp/1 2022-07-06 15:43:13 +03:00
zakuro
a46bcf3571 all: v.ast.byte_type -> v.ast.u8_type (#14964) 2022-07-06 13:32:30 +03:00
Alexander Medvednikov
00dfce655e doc: document if as 2022-07-06 12:41:36 +03:00
CC
6a567a0dd6 sqlite: improve exec_none behaviour (#14955) 2022-07-06 10:44:36 +03:00
yuyi
bb2223c8b0 checker: fix shared_element_lock.vv test (#14960) 2022-07-06 10:43:36 +03:00
Alexander Medvednikov
59d6ca0c95 js: remove duplicate match 2022-07-06 07:46:58 +03:00
Alexander Medvednikov
819b6f475a os: remove unnecessary unsafes 2022-07-06 07:07:48 +03:00
Alexander Medvednikov
d3090de02e checker: apply the new array check only to len:, not cap: inits 2022-07-06 07:03:36 +03:00
yuyi
fab5802deb all: fix latest ci errors (#14957) 2022-07-06 07:02:16 +03:00
Alexander Medvednikov
3f3fb5be47 js: handle Nil 2022-07-06 06:47:37 +03:00
Alexander Medvednikov
c48ed52f43 checker: vfmt 2022-07-05 23:56:53 +03:00
Alexander Medvednikov
163c7ba2bb checker: stricter []&Type{len:x} check 2022-07-05 23:51:29 +03:00
Alexander Medvednikov
9b4dec7b98 parser: anonymous structs (part 1) 2022-07-05 23:17:00 +03:00
Alexander Medvednikov
5f78647137 all: unsafe nil 2022-07-05 22:59:54 +03:00
Larpon
9b1a616b13 ci: remove openrndr dependency from vgret testing (#14950) 2022-07-05 22:44:27 +03:00
Larpon
e08fedfd14 ci: add runtime DOOM checks via vgret (#14951) 2022-07-05 22:44:14 +03:00
Larpon
0dd5050b29 os: clean up usage of ANativeActivity, allow access to fields (#14948) 2022-07-05 16:30:10 +03:00
yuyi
56d62a6e6f checker: check undefined ident in reference selector (#14949) 2022-07-05 16:29:54 +03:00
yuyi
8b8667dd9a cgen: cleanup in fn.v (#14938) 2022-07-05 06:40:57 +03:00
Larpon
e18c5c7908 tools: add generic_screenshot method to vget (#14943) 2022-07-05 06:40:38 +03:00
Ken
a50e0f0522 net.websocket: allow timeout to be configured (#14941) 2022-07-05 06:40:23 +03:00
Alexander Medvednikov
5523c11dd4 help: remove "coming soon in 0.3" for v translate 2022-07-05 06:38:33 +03:00
Max Smirnov
3bdf2f053d changelog: fix typo (#14930) 2022-07-04 15:34:00 +03:00
Ted Stoychev
63b6923565 readme: fix header (#14933) 2022-07-04 15:33:41 +03:00
ghosttk
eb10cc9606 vweb: fix '/' in scan_static_directory (#14940) 2022-07-04 15:32:44 +03:00
Delyan Angelov
946da5556d ci: add a c2v job too, that checks that Doom compiles. 2022-07-04 14:16:14 +03:00
Delyan Angelov
e156066acf ci: fix gitly failure (compile gitly.scss to gitly.css) 2022-07-04 12:50:18 +03:00
yuyi
7f72ffdd66 cgen: fix error for result multi_return (#14936) 2022-07-04 10:54:08 +03:00
Delyan Angelov
90197fd58a term.ui: make C. unions and structs public (solve conflicts with term on windows) 2022-07-04 10:50:19 +03:00
Ikko Ashimine
584c035120 sync: fix typo in pool.v (#14928) 2022-07-03 15:24:57 +03:00
yuyi
9028b0ed76 parser: minor cleanup in partial_assign_stmt() (#14929) 2022-07-03 15:24:42 +03:00
Alexander Medvednikov
20ba2a10c1 builder: use is_dir for src/; changelog: add 0.3.1 features 2022-07-03 15:13:08 +03:00
Alexander Medvednikov
c90e8185ed builder: search for .v files in /src/ if there are none 2022-07-03 08:41:26 +03:00
Alexander Medvednikov
b5f2636b73 Revert "vweb: remove the extra '/' in scan_static_directory (#14806)"
This reverts commit 8172fecb51.
2022-07-02 11:38:24 +03:00
Dialga
6957f940a0 pkgconfig: fix parsing mid-line comments (#14920) 2022-07-02 11:31:52 +03:00
Joe Conigliaro
4032838aba gen.golang: array append & basic strings 2022-07-02 17:07:47 +10:00
Claudio Cesar de Sá
5b97ad15ad examples: add new graph algorithms, make some minor corrections to the programs in examples/graphs (#14562) 2022-07-01 21:37:00 +03:00
CC
dc9ff7cab2 README: add TCC acknowledgement (#14910) 2022-07-01 21:10:36 +03:00
Alexander Medvednikov
f0cee25213 Update README.md 2022-07-01 16:50:51 +03:00
yuyi
1b463834aa builder: fix cross compiling for linux on windows (fix #6241, fix #12922) (#14907) 2022-07-01 15:24:27 +03:00
Delyan Angelov
69d292e8d1 os: detect termux more reliably 2022-07-01 13:52:57 +03:00
Delyan Angelov
b6b611aa82 v: support better separation of general Android vs Termux specific code (part 2) 2022-07-01 13:18:31 +03:00
Delyan Angelov
30401e003f v: support better separation of general Android vs Termux specific code (part 1) 2022-07-01 12:48:35 +03:00
CC
ff0f75803d docs: add a note on how to install gcc-mingw-w64-x86-64 needed for linux->windows cross compilation (#14905) 2022-07-01 08:25:06 +03:00
Emirhan Yener
71ff221cff gg: update draw polygon test (#14880) 2022-06-30 21:21:12 +03:00
Hunam
e4a49d5dd5 doc: update ROADMAP.md (#14897) 2022-06-30 21:20:34 +03:00
yuyi
d3c1e671f1 fmt: minor optimization in struct.v (#14898) 2022-06-30 19:52:49 +03:00
ylluminate
3f147cbc38 CHANGELOG.md: fix the 0.2.4 heading (#14900) 2022-06-30 19:51:22 +03:00
Markus F.X.J. Oberhumer
74bb5ae17a os: add an optional "mode" parameter to os.mkdir and os.mkdir_all (#14887) 2022-06-30 13:49:47 +03:00
Larpon
7c3571b274 sokol: allow thirdparty window control (#14896) 2022-06-30 13:47:59 +03:00
Alexander Medvednikov
ec75860453 V 0.3 2022-06-30 10:41:25 +03:00
yuyi
9f59dbd319 fmt: fix import module { Foo } (#14894) 2022-06-30 09:48:39 +03:00
yuyi
92f441e894 cgen: minor cleanup in str.v (#14882) 2022-06-30 04:04:12 +03:00
yuyi
f2be115f7d parser: fix the incorrect location of the type declaration name (#14879) 2022-06-29 16:14:03 +03:00
Joe Conigliaro
1b0754e4f3 gen.golang: correct use of const github_job 2022-06-29 21:15:46 +10:00
Joe Conigliaro
c3866bb7b1 gen.golang: skip tests only on ubuntu-docker-musl 2022-06-29 21:11:28 +10:00
Joe Conigliaro
86549feafa gen.golang: globally skip go backend tests & run only on ubuntu-tcc 2022-06-29 20:55:43 +10:00
Joe Conigliaro
5462f06d6c gen.golang: correct error message 2022-06-29 19:09:36 +10:00
yuyi
f8461e2b3c parser: check const declaration using multiple assign (#14886) 2022-06-29 12:03:56 +03:00
ghosttk
fae26197b9 os: add exo-open to the list of tried launchers in os.open_uri/1 (#14884)
Add 'exo-open' for xfce4 desktop environment.
2022-06-29 11:59:25 +03:00
Hitalo de Jesus do Rosário Souza
c481b80ec3 docs: add a jwt example to vlib/crypto/README.md (#14872) 2022-06-29 11:57:05 +03:00
Joe Conigliaro
51649b924b gen.golang: dont push run_args in run_file assignent 2022-06-29 18:54:26 +10:00
Joe Conigliaro
eec60a3018 gen.golang: add run support & testrunner 2022-06-29 18:49:53 +10:00
yuyi
3ae59a7837 checker: optimize casting sumtype error message (fix #14023) (#14877) 2022-06-28 17:13:58 +03:00
Delyan Angelov
b47d35a0bb ci: compile golang_builder.v without warnings (fix v -prod build-tools) 2022-06-28 15:00:54 +03:00
Delyan Angelov
2bcbd0b636 ci: comment unused import strings 2022-06-28 14:16:39 +03:00
Delyan Angelov
6165b119f6 scanner,parser,checker: do show the first error on -Wfatal-errors 2022-06-28 14:05:32 +03:00
Alexander Medvednikov
64b8284419 go: remove unused code (comments) 2022-06-28 11:14:48 +03:00
yuyi
ce6bc2c26d checker: handle void in struct field init (fix #13944) (#14876) 2022-06-28 11:06:25 +03:00
Alexander Medvednikov
a4eb5b6356 gen: basic initial work on the Go backend 2022-06-28 09:41:15 +03:00
Emirhan Yener
28068e8ecf gg: add draw_polygon_filled test (#14871) 2022-06-28 08:30:45 +03:00
yuyi
42df154399 ast: add elem_type_pos to ChanInit (#14873) 2022-06-28 08:30:02 +03:00
yuyi
09630dd0bc parser: check interface name using single letter capital (#14878) 2022-06-28 08:29:23 +03:00
Emirhan Yener
6b2d3a826b gg: add draw_polygon_filled fn with rotation parameter (#14867) 2022-06-27 21:34:43 +03:00
Mehmet Ali
ae7c566232 doc: remove TODO C2V now that it's out (#14866) 2022-06-27 21:34:07 +03:00
yuyi
6be287d476 cgen: minor cleanup in ref_or_deref_arg() (#14862) 2022-06-27 21:33:35 +03:00
yuyi
044698746e parser: minor cleanup in parse_type.v (#14863) 2022-06-27 21:33:18 +03:00
Larpon
2d40ba1f49 cgen: call GC_INIT in sokol_main too, when compiling with -apk (#14869) 2022-06-27 21:24:39 +03:00
Delyan Angelov
b1a14c6cf7 tests: use a platform neutral module with C declarations (sokol.audio), instead of time in private_redeclaration_of_C_timeval.vv . 2022-06-27 19:48:46 +03:00
Delyan Angelov
94d6670e8f checker: make the type C.X is private re-declaration error more informative 2022-06-27 18:32:21 +03:00
Delyan Angelov
0ef8382824 tests: show timing info in the output of run_project_folders_test.v 2022-06-27 18:31:07 +03:00
yuyi
1af94c7edf checker: fix error for array_of_aliases.pop() (#14861) 2022-06-27 11:50:46 +03:00
WoodyAtHome
34517c340d net: support blocking sockets in TcpSocket.connect (#14849) 2022-06-27 11:01:55 +03:00
yuyi
ef7f9779a3 parser, checker: fix postfix expr check (fix #14852) (#14857) 2022-06-27 04:28:24 +03:00
yuyi
5a79a54fe4 all: fix all remaining unsafe 0 (#14856) 2022-06-26 17:04:23 +03:00
Alexander Medvednikov
cb60392302 examples: fix unsafe 0 2022-06-26 07:12:15 +03:00
Alexander Medvednikov
ca30397e7a cli: fix compilation 2022-06-26 07:08:05 +03:00
Alexander Medvednikov
e76f74fd73 checker: unsafe 0 for references (default value) 2022-06-26 06:40:40 +03:00
yuyi
546f9a544f parser: fix a typo in an error message (#14848) 2022-06-26 00:04:08 +03:00
Emirhan Yener
d42aadda0f gg: fix draw arch functions alpha color (#14850) 2022-06-26 00:03:43 +03:00
Leon Arndt
d7f962ef6e examples: remove empty comment from Tetris (#14845) 2022-06-25 05:47:44 +03:00
yuyi
ef643e106b checker: check unknown chan element type (#14843) 2022-06-25 05:19:41 +03:00
yuyi
90287f6aaa checker: check error for cast sumtype (fix #14771) (#14847) 2022-06-25 05:19:16 +03:00
CC
d336b7b877 examples: add another vweb example, showing file upload, transform, and file download (#14842) 2022-06-24 09:23:47 +03:00
Delyan Angelov
ccc3271493 docs: restore the important sentence about the mutable args that have to be marked on call 2022-06-23 21:15:21 +03:00
Emirhan Yener
e5bbb23389 examples: fix 2048 gameplay (#14838) 2022-06-23 21:07:30 +03:00
Wertzui123
c10ba6d81a os: add .cmd to the list of Windows executable suffixes (#14839) 2022-06-23 20:12:29 +03:00
Delyan Angelov
b0fe21f018 ci: fix long lines/links in docs.md 2022-06-23 20:09:20 +03:00
Alexander Medvednikov
c17200c33d doc: clear up concurrency and immutable fn args 2022-06-23 17:46:57 +03:00
Larpon
298dc77c38 ci: add pure -os android checks (#14837) 2022-06-23 11:22:55 +03:00
yuyi
e9a8f5fcc7 cgen: fix ref_struct.str() with null pointer (#14836) 2022-06-23 08:35:21 +03:00
Wertzui123
587101a1ea os: fix find_abs_path_of_executable function (on Windows) (#14835) 2022-06-23 03:36:15 +03:00
Delyan Angelov
2524207d1c tools: support c2v.exe in v translate, use os.quoted_path, cleanup errors. 2022-06-23 03:31:10 +03:00
Alexander Medvednikov
78c527b243 tutorials: improve c2v tutorial a bit 2022-06-23 02:45:14 +03:00
Alexander Medvednikov
dbc51a4579 readme: add c2v demo 2022-06-23 02:33:09 +03:00
l-m
ed8c63cc0b builtin: add a contains_only method on string (#14830) 2022-06-23 01:41:42 +03:00
Delyan Angelov
a7108ff05c docs: use the actual most recent output of c2v in the example 2022-06-23 01:39:39 +03:00
Delyan Angelov
b8d9bfec16 docs: fix C primes example in the tutorials (fixes c2v translation on linux) 2022-06-23 01:35:45 +03:00
Delyan Angelov
436081a9f5 ci: fix v check-md tutorials/ 2022-06-23 01:30:22 +03:00
Delyan Angelov
1b87a4770c tutorials: rename the folder containing spaces, to fix git checkouts on windows 2022-06-23 01:08:07 +03:00
Delyan Angelov
856270cac2 tutorials: restore the old tutorials/building_a_simple_web_blog_with_vweb/ folder. 2022-06-23 00:11:59 +03:00
Alexander Medvednikov
989c5e26f5 c2v: use https git clone 2022-06-22 22:49:29 +03:00
Alexander Medvednikov
fe673e7963 tutorials: rename vweb tutorial 2022-06-22 22:48:40 +03:00
Alexander Medvednikov
ae2183043b tutorials: c2v 2022-06-22 22:47:43 +03:00
Dialga
5cd5d551e3 v.pkgconfig: fix building standalone pkgconfig (#14825)
* Update main.v

* add test to prevent future regressions

Co-authored-by: Delyan Angelov <delian66@gmail.com>
2022-06-22 22:38:50 +03:00
Alexander Medvednikov
c9ab086029 cmd/tools: enable c2v 2022-06-22 22:10:46 +03:00
yuyi
e6c3de2f46 cgen: format cgen.init() generated c codes (#14824) 2022-06-22 21:39:15 +03:00
Larpon
3fb88500a2 os: improve Android interop (#14827) 2022-06-22 21:38:27 +03:00
yuyi
585b5145fa cgen: fix auto string method generated for []&int{len:1} (#14829) 2022-06-22 14:54:04 +03:00
Delyan Angelov
6a4ba22eae tests: flush test headers to ensure stable output with VJOBS>1 2022-06-22 12:46:32 +03:00
pancake
23d1c792c0 native: fix macho generation for macos11-amd64 (#14821) 2022-06-22 11:58:27 +03:00
Delyan Angelov
74fb473301 ci: use unique concurrency.group for native_backend_tests.yml 2022-06-22 11:23:40 +03:00
Delyan Angelov
6c060b76fd ci: fix v building inside native_backend_tests.yml 2022-06-22 11:19:00 +03:00
Delyan Angelov
48b2ab157b ci: add a separate native_backend_tests.yml, to run the native tests on all the available github actions vm environments 2022-06-22 09:11:01 +03:00
yuyi
c64c4907a2 parser: check closure var name conflict (#14823) 2022-06-22 09:04:15 +03:00
Delyan Angelov
e2e3992e0d ci: remove continue-on-error: true for most ci jobs (#14811) 2022-06-22 00:20:57 +03:00
ghosttk
8172fecb51 vweb: remove the extra '/' in scan_static_directory (#14806) 2022-06-21 15:13:09 +03:00
Larpon
9f5e442dab tools: add bump flags to vcomplete (#14813) 2022-06-21 15:11:42 +03:00
yuyi
c160ba2a8d checker: stricter mutable reference check (fix #14803) (#14805) 2022-06-21 13:23:21 +03:00
Delyan Angelov
c6f94e9cab tools: distribute vpm queries randomly between the available backend servers 2022-06-21 12:58:37 +03:00
yuyi
cab6355a38 cgen: fix array of reference sumtype index() (#14812) 2022-06-21 12:37:54 +03:00
Delyan Angelov
f08c768c8e tools: add a new readonly VPM server mirror url, to mitigate failures of the main vpm.vlang.io 2022-06-21 12:27:41 +03:00
Ulises Jeremias Cornejo Fandos
e505fcdac0 encoding.csv: update reader.v (#14807) 2022-06-21 08:31:47 +03:00
yuyi
f6f77e5264 clipboard: make clipboard.Clipboard public on windows (#14810) 2022-06-21 08:21:54 +03:00
David 'Epper' Marshall
524df8da1b math: add zpl stuff (#14543) 2022-06-21 00:17:49 +03:00
Delyan Angelov
473d26ce47 builtin: enforce linking to libgc.a with -prod on macos 2022-06-20 21:29:27 +03:00
pancake
1caff5b379 native: initial support for apple-m1 (#14795) 2022-06-20 21:25:12 +03:00
yuyi
8703e336e0 checker: cleanup in fn_decl() (#14802) 2022-06-20 17:56:02 +03:00
Delyan Angelov
1fc9e1a716 tools: build c2v in non verbose mode by default 2022-06-20 16:03:39 +03:00
Delyan Angelov
fa2e8d8459 tools: use os.system for the c2v runs to monitor the progress more easily 2022-06-20 15:50:38 +03:00
Delyan Angelov
0e4198f23b tools: fix v vet file.v for return if x { y // comment } else { z } 2022-06-20 13:29:22 +03:00
yuyi
cf1fc6f090 ast: fix array of reference sumtype appending (#14797) 2022-06-20 12:23:53 +03:00
Alexander Medvednikov
924239026c pref: disable gc for translated code 2022-06-19 20:07:45 +03:00
Alexander Medvednikov
bc60b0d1a3 builder: add -c when building object files 2022-06-19 19:57:52 +03:00
Alexander Medvednikov
d215618f4c sokol: mark pub structs 2022-06-19 19:47:47 +03:00
yuyi
de136f6baf checker: improve pub struct check (fix #14446) (#14777) 2022-06-19 17:42:22 +03:00
Delyan Angelov
37ef1ee453 tools: do show the output of c2v, when it fails 2022-06-19 17:08:21 +03:00
Delyan Angelov
7b1ade237b tools: fix the first run of v translate hw.c 2022-06-19 16:19:56 +03:00
Delyan Angelov
b9cb56572f ci: use VTEST_JUST_ESSENTIAL=1 for the -cstrict test-self task in ubuntu-clang too 2022-06-19 16:08:24 +03:00
Alexander Medvednikov
6875a173ec cmd: enable v translate, download and install c2v 2022-06-19 15:52:42 +03:00
Delyan Angelov
97be840a6d ci: use VTEST_JUST_ESSENTIAL=1 for the ubuntu -cstrict gcc task (prevent 2 hour runs) 2022-06-19 13:29:36 +03:00
lemon
e0310964d9 native: initial support for defer (#14779) 2022-06-18 23:51:31 +03:00
Alexander Medvednikov
10051e005a parser, cgen: temporary prefix ++ for translated code 2022-06-18 13:30:47 +03:00
wahur666
18dfaf6164 tools: handle fn attributes/comments more robustly, when v missdoc is run (#14774) 2022-06-18 11:02:39 +03:00
yuyi
01fdd5d07f cgen: add a minor optimisation for array.push_many (#14770) 2022-06-17 09:44:13 +03:00
Alexander Medvednikov
b89617726c pref: is_o 2022-06-16 20:51:21 +03:00
Louis Schmieder
5df3d8ac75 orm: mysql fixes (#14772) 2022-06-16 20:19:49 +03:00
Alexander Medvednikov
fb5a40d1c8 builder: handle linker errors when building .o files 2022-06-16 15:19:13 +03:00
yuyi
26714fadc5 ast, checker, cgen: improve sorting globals and consts (#14769) 2022-06-16 14:32:41 +03:00
Alexander Medvednikov
9c72b85f72 checker: temporary c2v struct init fix 2022-06-16 14:24:17 +03:00
Danilo Lekovic
df239b9208 doc: fix 'specifing' typo (#14768) 2022-06-16 11:12:58 +03:00
yuyi
f2962c34dd cgen: format module_init generated c code (#14764) 2022-06-16 11:01:17 +03:00
Delyan Angelov
205221074c tools: support v watch -k run examples/gg/rectangles.v (keep a program running) 2022-06-15 18:00:10 +03:00
yuyi
0c1708db23 cgen: minor cleanup in stmt() (#14763) 2022-06-15 17:44:00 +03:00
yuyi
5135952c9c v.util: add a retry loop for tool compilation in launch_tool() (#14760) 2022-06-15 11:59:53 +03:00
yuyi
7f38b92ca8 cgen: simplify sorting globals and consts (#14761) 2022-06-15 11:56:17 +03:00
yuyi
7c50d276c7 ast: minor cleanup in is_comptime_type() (#14759) 2022-06-14 14:21:45 +03:00
lemon
e4e858b132 transformer: fix a bug with string literal length (#14757) 2022-06-14 12:42:45 +03:00
yuyi
6d8a0ad15d ast, checker, cgen: sort consts with call expr (fix #14748) (#14755) 2022-06-14 10:50:20 +03:00
Spydr
2f1a896d18 native: integer-to-string conversion (#14758) 2022-06-14 00:35:25 +03:00
Leo Developer
67716b5b59 cgen: fix comptime if attributes for test_ functions (#14756) 2022-06-13 21:22:25 +03:00
yuyi
5efa67906c cgen: sort const array init order (fix #14748) (#14749) 2022-06-13 21:09:24 +03:00
yuyi
3535927bcd parser: correct error message for seclector_expr_assign.vv (#14747) 2022-06-12 20:29:54 +03:00
Delyan Angelov
139c34c07d gg: optimise app.gg.show_fps() (cache ctx.text_size() results, round frame to int without interpolation, center text inside the background rectangle) 2022-06-12 16:07:00 +03:00
Delyan Angelov
4682e17ac1 gg: fix v -d show_fps run examples/gg/stars.v 2022-06-12 15:17:04 +03:00
Delyan Angelov
7e06203da8 gg: support -d show_fps for all gg apps 2022-06-12 14:20:32 +03:00
Delyan Angelov
ff8e286c88 compress.gzip: support gzip.decompress(data, verify_length: false, verify_checksum: false)? 2022-06-12 11:25:01 +03:00
Spydr
5c104cf981 native: implement neg() for arm64 (#14745) 2022-06-12 09:42:39 +03:00
Spydr
8fa1e30dd2 native: int-to-string conversion detecting zeros and negative values (#14743) 2022-06-11 21:20:13 +03:00
Alexander Medvednikov
f08266ab66 doc: autofree/gc update 2022-06-11 20:44:28 +03:00
Joe Conigliaro
f3351b6a29 pref: maintain order of 'debug' in compile defines as mod cache key depends on it 2022-06-12 02:22:04 +10:00
Delyan Angelov
5cea8d30fa ci: make crun_test.v more robust by reducing the tested gap from 5x to 4x 2022-06-11 18:44:02 +03:00
yuyi
a538ab7e8c cgen: minor cleanup for sort globals and consts (#14742) 2022-06-11 18:42:22 +03:00
yuyi
cdf4ffc513 cgen: sort globals and consts definitions (#14739) 2022-06-11 17:17:49 +03:00
lemon
c7a619d16e native: support else, break, continue (#14738) 2022-06-11 11:50:19 +03:00
Dialga
da7a166708 v.pkgconfig: fix duplication in short flags to the standalone pkgconfig binary (#14740) 2022-06-11 11:06:55 +03:00
spaceface
26d051475a cgen: ensure closures are kept alive when using the GC (#14736) 2022-06-10 19:48:50 +03:00
Delyan Angelov
b27b6b2047 tools: let v gret make an easily visible diff.png image after regressions, and upload it too, to make CI failures easier to diagnose 2022-06-10 15:38:50 +03:00
yuyi
fcaf529228 parser, checker: check undefined ident in if expr using generic type name (#14734) 2022-06-10 11:57:26 +03:00
Larpon
690a8422d1 vcomplete: add -no-parallel to flag completions (#14735) 2022-06-10 11:57:12 +03:00
Delyan Angelov
f4869bcdc6 ci: add apt-get update before apt-get install in gg-regressions 2022-06-10 11:50:30 +03:00
Delyan Angelov
ea71ea3ec1 examples: speed up mandelbrot.v a little, increase iterations/details too 2022-06-09 20:10:00 +03:00
yuyi
922f003729 cgen: fix fixed array global variable (fix #14712) (#14730) 2022-06-09 16:53:19 +03:00
Larpon
be23ddc253 ci: remove VFLAGS: -gc none from vab runs (#14731) 2022-06-09 15:37:53 +03:00
yuyi
784361f153 checker: fix generic method on aliases receiver type (#14729) 2022-06-09 15:36:31 +03:00
Delyan Angelov
e1360ccf8c ci: add VTEST_JUST_ESSENTIAL=1 ./v test-self mode. Use it for alpine-docker-musl-gcc . 2022-06-09 15:26:52 +03:00
Ben
39e54a508b os: correct description of windows_volume function (#14726) 2022-06-09 10:56:58 +03:00
spaceface
4ed9780b80 all: enable -gc boehm by default (#14577) 2022-06-09 00:44:29 +03:00
yuyi
e6580fefaa ast: cleanup in generic_insts_to_concrete() (#14724) 2022-06-08 23:17:03 +03:00
Spydr
8563696476 native: added new helper functions (#14723) 2022-06-08 23:16:15 +03:00
Larpon
f58e5a94c2 gg: fire resize event before init if necessary on Android (#14725) 2022-06-08 21:43:20 +03:00
Ben
c6b1c8d07a os: add windows_volume function (#14721) 2022-06-08 21:26:24 +03:00
Mikey
5ac9b5c9f1 term.ui: don't print event data in readme example (vlang#14719) (#14720) 2022-06-08 09:36:22 +03:00
Delyan Angelov
4b3c3d9082 checker: add error for if c >= A && c <= Z { in non generic functions 2022-06-07 20:43:31 +03:00
Larpon
96a9faf2fd strings: add split_capital (#14716) 2022-06-07 18:43:06 +03:00
David Valdespino Pavon
1d462136bc net.http: cookie parsing fixes (#14420) 2022-06-07 12:52:43 +03:00
Larpon
8027919285 ci: update vab install (vlang/vab#176) (#14713) 2022-06-07 12:51:43 +03:00
Delyan Angelov
82594c0156 v.vcache: improve the output of -d trace_usecache_n 2022-06-07 12:39:30 +03:00
Delyan Angelov
a942ecf737 v.vcache: support -d trace_usecache_n too (less verbose tracing for just the initialisation of CacheManager) 2022-06-07 12:24:53 +03:00
Delyan Angelov
82d23dedf1 builtin: add flush_stdout and flush_stderr to builtin.js.v, for feature parity with builtin.c.v 2022-06-07 12:15:35 +03:00
yuyi
7780f56c31 cgen: fix cast to generic interface (#14708) 2022-06-07 08:32:25 +03:00
ChAoS_UnItY
73b59c7b16 cgen: fix none literal str() function calling (#14704) 2022-06-07 01:29:27 +03:00
yuyi
abf35270cf checker: fix json decoder with generic struct (#14700) 2022-06-06 19:25:02 +03:00
ChAoS_UnItY
ce26d5bc5c cgen: fix mutable receiver type calling mapping function causes C error (fix #14230) (#14696) 2022-06-06 18:34:04 +03:00
Delyan Angelov
778fe2cde0 ast: use [direct_array_access] for attrs []Attr lookup methods 2022-06-06 14:43:04 +03:00
Delyan Angelov
6398043094 cgen: fix missing function names in declarations on [c2v_variadic][c: xyz]fn deh_fprintf(fstream &C.FILE, fmt &i8) 2022-06-06 14:33:24 +03:00
Alexander Medvednikov
7f67981637 checker: allow literal args as references in translated code 2022-06-06 13:24:36 +03:00
yuyi
8a2236d3f8 cgen: fix generic interface with non-generic method (#14694) 2022-06-06 12:30:48 +03:00
Alexander Medvednikov
e89a6269e4 checker: do not require fn main when building an object file 2022-06-06 12:29:57 +03:00
yuyi
ce771876a3 cgen: fix nested map index check (fix #14683) (#14687) 2022-06-06 06:29:22 +03:00
ChAoS_UnItY
df80b33dc0 cgen: fix array init with it (fix #14679) (#14680) 2022-06-05 19:41:54 +03:00
Leo Developer
3a90d8ef14 compress: add a new module compress.gzip too (#14686) 2022-06-05 18:53:45 +03:00
Ikko Ashimine
7b25957a26 builtin: fix typo in array.v (#14688) 2022-06-05 18:49:40 +03:00
ChAoS_UnItY
b000728845 compress.gzip / deflate: rename gzip module into deflate module (#14682) 2022-06-05 08:48:38 +03:00
yuyi
4cf6abd99d checker: check using literal argument as reference parameter (#14674) 2022-06-05 08:44:35 +03:00
ChAoS_UnItY
f6ebbc99cd cgen: fix array type as interface (fix #14677) (#14681) 2022-06-05 05:05:48 +03:00
yuyi
5d429140a4 json: fix json decode with missing map type field (#14678) 2022-06-04 20:27:11 +03:00
Wertzui123
d71fd04c81 thirdparty/sokol: apply speaker/headset bug fix from latest upstream sokol_audio.h (#14676) 2022-06-04 20:24:07 +03:00
Delyan Angelov
3c5ae41712 examples: simplify the shebang in the v_script.vsh example 2022-06-04 20:15:39 +03:00
Delyan Angelov
3ac3375b43 cgen: fix for (int i = 0; i < 10; i++, a++) { (multiple expressions in the inc part) 2022-06-04 20:03:59 +03:00
Delyan Angelov
82eb495617 ci: on windows-msvc, skip const_fixed_array_containing_references_to_itself_test.v 2022-06-04 13:05:27 +03:00
Delyan Angelov
f2171b4148 ci: fix macos clang failures with const_fixed_array_containing_references_to_itself_test.v 2022-06-04 09:15:37 +03:00
Delyan Angelov
4cfff58fdf checker: allow for references to fixed array consts inside their initialisation const a = [ ... &a[0] ...]! 2022-06-04 09:04:12 +03:00
Alexander Medvednikov
a8461a900d vweb: use http.Cookie 2022-06-04 06:52:46 +03:00
yuyi
66572d5ead ast: cleanup is_lit() (#14672) 2022-06-03 21:02:36 +03:00
Delyan Angelov
c15d1c6e7e cgen,ci: fix cast_bool_to_int_test.v on windows-tcc 2022-06-03 20:53:10 +03:00
Delyan Angelov
6f9070e06d cgen: do not initialise externally declared globals (with -cstrict with [c_extern]). 2022-06-03 19:14:01 +03:00
Delyan Angelov
dbaecdc058 cgen: simplify int(bool_var) casts; support [c_extern] tag for global declarations 2022-06-03 18:48:08 +03:00
yuyi
daa94de93f cgen: fix autofree_variable() (fix #14576) (#14602) 2022-06-03 17:41:30 +03:00
yuyi
dcbd8d6405 cgen: fix if expr with optional method call (#14600) 2022-06-03 15:57:39 +03:00
ChAoS_UnItY
65066098d8 compress: Add gzip module & refactor compress & compress.zlib module (#14599) 2022-06-03 09:00:11 +03:00
yuyi
251716fa0e vrepl: fix error for exitasdfasdf in repl (fix #14593) (#14598) 2022-06-02 19:59:57 +03:00
Delyan Angelov
9f7656f328 ci: vfmt vlib/v/checker/check_types.v 2022-06-02 19:02:34 +03:00
Delyan Angelov
c892b3203e checker: speed up check_expected_call_arg, by only calling Table.type_to_str on errors 2022-06-02 18:58:20 +03:00
Hunam
41414b5d5f vlib: add net.http.mime (#14516) 2022-06-02 18:07:25 +03:00
Delyan Angelov
aae5b9fb95 ast.table: cache the returned values of Table.type_to_str_using_aliases/2
This results in 9% speedup of the checker stage for V itself.
2022-06-02 17:53:30 +03:00
Delyan Angelov
ed759b2ec9 ci: vfmt vlib/v/parser/parser.v 2022-06-02 15:55:13 +03:00
Delyan Angelov
031629faa1 tools: add cmd/tools/measure/scanner_speed.v and cmd/tools/measure/parser_speed.v 2022-06-02 13:50:25 +03:00
Delyan Angelov
9a0ec7f367 strings: update docs for .str() and for .free() 2022-06-02 10:41:32 +03:00
yuyi
545eaae77b ast: fix IfExpr.str() (#14595) 2022-06-02 10:28:31 +03:00
Alexander Medvednikov
8b0e843cb8 checker, cgen: c2v variadic fixes 2022-06-02 09:35:25 +03:00
yuyi
10fb16e00b parser: fix optional with multiple statements (#14592) 2022-06-02 08:23:16 +03:00
Claudio Cesar de Sá
5bf246fce6 examples: some new graphs algorithms and improving 2 others (#14556) 2022-06-02 07:11:29 +03:00
Ben
e201665e92 os: fix file_ext function (#14566) 2022-06-02 07:09:46 +03:00
Wertzui123
f971da9a93 help: add Windows to the list of supported native backends in v help build-native (#14589) 2022-06-02 07:08:46 +03:00
ChAoS_UnItY
a95cdac635 cgen: fix type not being unaliased (fix #14568) (#14591) 2022-06-02 06:21:01 +03:00
yuyi
55951e0943 checker: minor cleanup in if_expr() (#14584) 2022-06-02 06:20:09 +03:00
Hunam
d0a1608ede ci: re-enable Go2V test suite (#14588) 2022-06-02 06:19:38 +03:00
yuyi
33a2d00445 cgen: fix fixed array of aliases struct (#14583) 2022-06-01 16:56:12 +03:00
Delyan Angelov
bf70f0b436 v: add support for v crun examples/hello_world.v, use crun mode for .vsh files by default. (#14554) 2022-06-01 14:47:52 +03:00
Delyan Angelov
c91b646372 examples: document how to produce the shared library, needed for a standalone run of examples/dynamic_library_loading/use.v 2022-06-01 13:58:49 +03:00
yuyi
786045c7da parser: fix comptime if script mode (fix #6419) (#14578) 2022-06-01 13:27:27 +03:00
Delyan Angelov
5a2c271bd4 cgen: do not #include signal.h, on -os wasm32 and -d no_segfault_handler 2022-06-01 13:21:22 +03:00
Delyan Angelov
2fa64f1471 ci: skip embed_file_test.v for now 2022-06-01 12:06:02 +03:00
yuyi
fefb9643b2 checker, cgen: fix array index optional with if expr (#14575) 2022-06-01 09:18:59 +03:00
Delyan Angelov
846ddfd728 v: always embed file data of \$embed_file(file) constructs, even without -prod, unless -d embed_only_metadata is given. 2022-06-01 09:08:18 +03:00
Alexander Medvednikov
f40c30c3dc cgen: fix goto label 2022-06-01 06:34:04 +03:00
Alexander Medvednikov
c54c9b817c cgen: c2v infix fix 2022-06-01 06:14:28 +03:00
Larpon
84e375e38a toml: update readme with value_opt() usage (#14569) 2022-05-31 19:02:33 +03:00
yuyi
80cc88427b scanner: minor cleanup in scanner.v (#14565) 2022-05-31 11:52:47 +03:00
playX
db34adaec8 builtin.js: fix string.int method (#14564) 2022-05-31 11:52:11 +03:00
Delyan Angelov
dc30089c74 v.util, v.builder: fix util.module_is_builtin on macos with -usecache 2022-05-31 09:30:45 +03:00
Ben
4ffdcf8058 os: add existing_path function (#14536) 2022-05-31 06:32:12 +03:00
Delyan Angelov
928dafeb6d strconv: make f64_to_str_lnd1 public (fix building vlang/coreutils printf) 2022-05-30 22:14:22 +03:00
Delyan Angelov
fc64f09f0b crypto.md5: improve performance of md5.blockblock_generic 2022-05-30 21:56:39 +03:00
Delyan Angelov
0f3b2c2ae7 builtin: use C.fwrite (buffered) for _write_buf_to_fd (#14558) 2022-05-30 19:15:05 +03:00
Delyan Angelov
58ebc0680e builtin: fix sporadic linking failures on v -cc gcc -gc boehm examples/hello_world.v 2022-05-30 15:17:01 +03:00
yuyi
844ba2a177 checker: vfmt overload_return_type.vv (#14557) 2022-05-30 13:49:13 +03:00
Hunam
78d1b7f4ef net.http: Response.text -> Response.body (#14478) 2022-05-29 20:27:18 +03:00
yuyi
2c5febe25e scanner: fix string interpolation with inner curly braces (fix #12242) (#14553) 2022-05-29 19:28:23 +03:00
yuyi
79d861ad4f parser: fix cast or dump arguments ending with comma (#14552) 2022-05-29 09:15:55 +03:00
Delyan Angelov
63d15086e7 docs: document explicitly, that maps support if v := m[k] { too 2022-05-28 21:36:13 +03:00
Delyan Angelov
c006d5c242 cgen: add support for v -cmain SDL_main sdl_example.v 2022-05-28 21:16:48 +03:00
yuyi
c0ef6dbde8 cgen: fix cross assign in closure (#14549) 2022-05-28 20:47:54 +03:00
yuyi
7dcc19df55 ast: fix call_expr.str() with propagate_option or propagate_result (#14550) 2022-05-28 20:47:29 +03:00
Delyan Angelov
c6a6eb9a3c ci: temporary workaround for cross assignment in a closure leading to cgen error 2022-05-28 13:21:59 +03:00
yuyi
b8e8768928 parser, cgen: fix cross assign with parentheses (#14545) 2022-05-28 12:02:17 +03:00
yuyi
a46cf10e92 checker: fix declare assign literal with closure (#14544) 2022-05-28 11:50:37 +03:00
Delyan Angelov
4894f61998 toml: add pub fn (d Doc) value_opt(key string) ?Any { and some tests for toml.parse_dotted_key/1 2022-05-28 09:18:18 +03:00
yuyi
a971b9a99a parser: fix match expr case with struct init (#14538) 2022-05-27 18:51:40 +03:00
Larpon
f3e7f24ee6 tools: implement v missdoc --diff oldv newv (#14537) 2022-05-27 18:19:06 +03:00
spaceface
52a3e5e780 cgen: fix a race condition in the closure implementation (#14532) 2022-05-27 17:35:02 +03:00
Delyan Angelov
f7995c8916 checker: fix error position in fn f() int { return 1,2 } 2022-05-27 16:53:24 +03:00
Delyan Angelov
36cb552918 ci: vfmt cmd/tools/vpm.v 2022-05-27 15:22:47 +03:00
Delyan Angelov
156aa661ee tools: fix v install https://github.com/nedpals/vex.git (fix #14483) 2022-05-27 15:21:01 +03:00
Louis Schmieder
a83ac948a0 orm: document & fix pg (#14533) 2022-05-26 22:53:09 +03:00
yuyi
b97ef09b2d checker: cleanup checker.v (#14530) 2022-05-26 22:52:42 +03:00
Delyan Angelov
bb6ef8bba8 cgen: fix parallel cgen for json encoding of struct fields that have default values 2022-05-26 16:55:44 +03:00
Delyan Angelov
8c969efe6b tests: make json_test.v less noisy, to see errors easier 2022-05-26 15:27:54 +03:00
Wertzui123
1017335365 x.ttf: fix typo in README (#14528) 2022-05-26 11:17:15 +03:00
yuyi
3849cdcecc fmt: fix fn return types list ending with comma (#14529) 2022-05-26 04:20:22 +03:00
Delyan Angelov
410b57b2fa all: add support for struct field deprecation (#14527) 2022-05-26 00:44:18 +03:00
Larpon
95cc535fc7 ci: use missdoc as subcmd (#14524) 2022-05-25 19:07:07 +03:00
Larpon
9f5e999b4a tools: add v missdoc --verify mode (#14525) 2022-05-25 19:06:11 +03:00
Larpon
6c08af63ff embed_file: rename debug_embed_file_in_prod -> force_embed_file (#14523) 2022-05-25 18:26:17 +03:00
yuyi
59e57f0c62 fmt: fix fmt of Ok<[]Token>{[]} (#14522) 2022-05-25 15:17:30 +03:00
kahsa
dd8c96f6bc net.html: use -d debug_html instead of -g, prevent undesired output, while debugging user programs (#14521) 2022-05-25 11:23:56 +03:00
Delyan Angelov
31c234485a cgen: split keys and values in generated new_map_init calls into separate lines 2022-05-25 10:26:17 +03:00
yuyi
e19ac0c4a7 checker: check fn call with argument mismatch (#14519) 2022-05-25 09:00:26 +03:00
yuyi
79a75c5ac0 parser: fix fmt error for json decode (#14520) 2022-05-25 08:59:22 +03:00
yuyi
0eb3f8854d fmt: fix file with just imports (fix #14267) (#14513) 2022-05-24 20:14:08 +03:00
Ben
f431020764 os: minor clean ups on filepath.v (#14506) 2022-05-24 11:29:32 +03:00
yuyi
f35f7fe997 fmt: fix using rand.seed() when import rand and rand.seed (#14511) 2022-05-24 11:21:49 +03:00
yuyi
a5b98cb267 parser: check fn decl multi return types without parentheses (#14508) 2022-05-24 05:15:31 +03:00
yuyi
5ade39f8db cgen: fix sizeof('str') and sizeof(r'str') (#14507) 2022-05-24 05:14:38 +03:00
Delyan Angelov
953ef1f8c9 pref: add support for -dump-files - and for -dump-modules - 2022-05-23 19:51:21 +03:00
Delyan Angelov
dda49fe735 v.builder: support -dump-c-flags with -cc msvc too 2022-05-23 18:29:39 +03:00
yuyi
a3c0a9b791 checker: minor optimization in fn_call() and method_call() (#14503) 2022-05-23 08:00:57 +03:00
yuyi
4ef9e2c05a parser: fix sizeof(c'str') (fix #14499) (#14502) 2022-05-23 01:59:39 +03:00
Alexander Medvednikov
863eeca2e0 checker: vfmt checker.v 2022-05-23 00:12:37 +03:00
Daniel Däschle
5e95bdc451 checker: allow but deprecate propagating result as option (#14500) 2022-05-23 00:11:29 +03:00
yuyi
7f03b89611 checker: check method call argument type mismatch (#14496) 2022-05-22 22:16:46 +03:00
spaceface
ba859c584b builtin: add static GC support on Windows with TCC (#14497) 2022-05-22 21:25:46 +03:00
Delyan Angelov
5328dabad1 time: simplify some very commonly used t.format methods 2022-05-22 21:09:49 +03:00
spaceface
e5ff2ab455 ci: run on all branches on forks (#14498) 2022-05-22 20:19:04 +03:00
yuyi
1f3336c9d3 checker: fix map get anon fn value with mut argument (fix #14479) (#14493) 2022-05-22 16:28:53 +03:00
Alexander Medvednikov
245d28d57a checker: c2v infix fix 2022-05-22 14:53:21 +03:00
Daniel Däschle
d3ffd983c8 markused: add _result_ok (#14495) 2022-05-22 14:52:38 +03:00
Subhomoy Haldar
3647fb4def rand: move dist functions to top module and PRNG interface; minor cleanup (#14481) 2022-05-22 13:21:52 +03:00
Delyan Angelov
64a686f41f examples: speed up mandelbrot.v by using a constant size thread pool, processing smaller chunks 2022-05-22 11:12:16 +03:00
yuyi
50ab2cfd1a fmt: fix 'strings' name variable call generate auto import (fix #9713) (#14485) 2022-05-21 15:01:58 +03:00
Delyan Angelov
0ceb16f285 v.builder: use /NOLOGO, when building cached object files with msvc 2022-05-21 12:56:24 +03:00
Delyan Angelov
c0dcc80e18 cgen: support -profile - for _test.v files too 2022-05-21 10:59:01 +03:00
Delyan Angelov
a7afb2d1eb time: remove import math dependency, by implementing a simpler version of mceil 2022-05-21 02:04:17 +03:00
Ben
971c55cf30 os: add norm_path and abs_path function (#14435) 2022-05-21 01:16:29 +03:00
Daniel Däschle
efc5cab8c3 checker,cgen: allow result if guard (#14474) 2022-05-20 19:34:53 +03:00
Alexander Medvednikov
53c217fe5e cgen: do not generate _vinit() for translated .o code 2022-05-20 19:28:37 +03:00
Vincenzo Palazzo
17bba712bd checker: ban unsafe pointer/fn comparison (#14462) 2022-05-20 18:30:16 +03:00
Daniel Däschle
d81fbb1ccd ci: only run on master (#14476) 2022-05-20 18:27:35 +03:00
Delyan Angelov
dd1049f21d thirdparty: fix typo in atomic.h, cleanup comments. 2022-05-20 14:21:31 +03:00
yuyi
28b0cbddad parser: check error for script mode that define main function (fix #14467) (#14469) 2022-05-20 14:20:18 +03:00
yuyi
913164bc73 builtin: minor cleanup in string_interpolation.v (#14471) 2022-05-20 14:19:27 +03:00
yuyi
bf44572f30 fmt: fix chain calls with comments (#14470) 2022-05-20 11:47:44 +03:00
StunxFS
11bdb04d0c json: fix struct field default value support (#14304) 2022-05-20 11:22:17 +03:00
Delyan Angelov
ca00b59b3f tests: make potential failures in urllib_test.v more informative 2022-05-20 08:49:56 +03:00
David 'Epper' Marshall
120f31b4d9 math: update documentation (#14457) 2022-05-20 08:45:54 +03:00
David 'Epper' Marshall
23568f19da url: fix parse (#14456) 2022-05-20 02:58:58 +03:00
crthpl
95d24e543d checker, cgen: fix shared non-decl assignment (#14466) 2022-05-20 02:58:11 +03:00
yuyi
55e7daa2f9 cgen: simplify auto_str_methods.v (#14463) 2022-05-19 22:29:15 +03:00
crthpl
46f94e8d68 cgen: fix autostr of shared fields (#14455) 2022-05-19 17:00:27 +03:00
Daniel Däschle
a52fbc5e51 checker: forbid optional variable (#14460) 2022-05-19 16:04:44 +03:00
yuyi
3291c59ebf cgen: minor cleanup in auto_str_methods.v (#14461) 2022-05-19 14:02:07 +03:00
Delyan Angelov
634e8c3624 vfmt: keep selective imported names used for generic calls 2022-05-19 12:48:43 +03:00
yuyi
15c62bc8e8 parser: improve error messages of 'for val in array' (#14459) 2022-05-19 11:53:27 +03:00
Delyan Angelov
25812e52f0 ci: use V_CI_CSTRICT=1 consistently for every v -cstrict test-self 2022-05-19 11:52:31 +03:00
Delyan Angelov
a52590572f tests: fix the push_work_on_channel.vv output 2022-05-19 11:30:36 +03:00
Delyan Angelov
3d5617c4fa tests: re-add the disambiguated for (val in [TokenValue(+), TokenValue(-)]) { test 2022-05-19 08:31:03 +03:00
Delyan Angelov
809b1ca3b4 Revert "parser: fix 'val in array' as condition in for stmt (fix #14440) (#14451)"
This reverts commit b482c0512b.
2022-05-19 08:29:30 +03:00
yuyi
b482c0512b parser: fix 'val in array' as condition in for stmt (fix #14440) (#14451) 2022-05-18 20:38:53 +03:00
Delyan Angelov
805a7d9713 ci: skip more .vv files on specific jobs 2022-05-18 20:04:59 +03:00
yuyi
5b96f7e8fd checker: split up infix.v from checker.v (#14449) 2022-05-18 14:52:53 +03:00
yuyi
4cbfa884c5 cgen: fix another error for 'in array of sumtype' (#14448) 2022-05-18 14:39:35 +03:00
Delyan Angelov
f2447a4bd8 tests: do not use -prod for compiling .vv files in vlib/v/checker/tests/ and vlib/v/parser/tests/ 2022-05-18 13:39:57 +03:00
Delyan Angelov
2cc3b74e19 tests: cleanup compiler_errors_test.v using language features (chan), instead of raw sync.new_channel and unsafe { ch.push } calls 2022-05-18 13:39:56 +03:00
Larpon
9de0c725f6 checker: add test for empty #flag node, (fix #14291) (#14447) 2022-05-18 13:38:58 +03:00
Adam Oates
a786c58d0a os: add fn user_names() (#14424) 2022-05-18 13:37:34 +03:00
yuyi
417a6dc506 cgen: fix error for 'in array of sumtype' (#14444) 2022-05-18 08:51:31 +03:00
Larpon
8eea861c93 vcomplete: improve flag completion, add missdoc (#14415) 2022-05-18 08:50:32 +03:00
Delyan Angelov
ed17779434 math.big: fix Integer.bit_len() when there are no digits in the number 2022-05-18 08:29:08 +03:00
Delyan Angelov
ebac3bebb1 pref: pass -v after a command, to the command only, do not set verbose mode on 2022-05-18 07:03:00 +03:00
playX
a608516b82 checker: c2v fixed array fix (#14436) 2022-05-18 02:35:05 +03:00
spaceface
b5fb848508 cgen: reduce the closure memory usage (#14437) 2022-05-18 02:34:51 +03:00
Delyan Angelov
65d9c8fa6f tools: add a vet_known_failing_windows skip list to v test-cleancode 2022-05-17 20:19:37 +03:00
Delyan Angelov
dfa2d63616 ci: use VJOBS=1 for the macos v test-cleancode task too; cleanup periodic.yml 2022-05-17 19:55:28 +03:00
Delyan Angelov
4e56147223 ci: vfmt builtin_d_use_libbacktrace.c.v 2022-05-17 19:41:57 +03:00
Alexander Medvednikov
2a06290ac7 cgen: fix eq generation for translated code 2022-05-17 15:30:05 +03:00
Ned
db4b49a5ca builtin: print libbacktrace output to stderr, on panics/segfault crash (#14434) 2022-05-17 14:56:34 +03:00
Delyan Angelov
da42f0d42b ci: add an early step 'All code is formatted' to more workflows. 2022-05-17 13:14:08 +03:00
Delyan Angelov
3fc4459485 ci: ignore orm_joined_tables_select_test.v on tasks, that do not have sqlite installed 2022-05-17 12:53:07 +03:00
yuyi
020845f6c3 cgen: fix alias of array that has builtin method (#14432) 2022-05-17 12:26:26 +03:00
yuyi
d7b1e57186 v.builder: improve builder error messages (fix #14386) (#14421) 2022-05-17 12:12:20 +03:00
yuyi
60e817ff32 cgen: minor optimization in index_of_array/map() (#14429) 2022-05-17 12:08:44 +03:00
yuyi
d6aa85d059 parser: fix panic for parse invalid map type (#14431) 2022-05-17 12:05:10 +03:00
playX
7c6eaa8204 checker: allow to use [n]anyptr as [n]otherptr in check_types (c2v fix) (#14433) 2022-05-17 11:55:04 +03:00
Delyan Angelov
78ab3296c9 checker: fix orm bug, when a joined table field context replaced the original table field context 2022-05-17 11:45:17 +03:00
WoodyAtHome
02c8a6057c builtin.string: new fn (s string) is_ascii() bool (#14418) 2022-05-17 08:01:03 +03:00
Alexander Medvednikov
d10f83ce15 cgen: fix c2v struct eq 2022-05-17 03:39:48 +03:00
playX
bc397bb0e1 checker: c2v array fix (#14426) 2022-05-17 00:08:41 +03:00
Delyan Angelov
32dd801201 checker: apply fix for ui suggested by spaceface 2022-05-16 21:33:02 +03:00
Delyan Angelov
9cb8bb2968 Revert "Revert "checker: allow using methods as vars when expecting a ctx arg (#14414)""
This reverts commit e5c7fe3006.
2022-05-16 21:29:47 +03:00
yuyi
c624de8523 cgen: fix struct field array index error (#14417) 2022-05-16 19:37:39 +03:00
Delyan Angelov
e5c7fe3006 Revert "checker: allow using methods as vars when expecting a ctx arg (#14414)"
This reverts commit 36bec823c2.
2022-05-16 14:19:33 +03:00
Delyan Angelov
39874ae168 clipboard: fix v -gc boehm run x.v, where x.v does c.paste() (fix #14281) 2022-05-16 12:54:30 +03:00
yuyi
d59f4e9479 ast, cgen: fix generic method with variadic generic argument (#14404) 2022-05-16 12:26:38 +03:00
Larpon
ef6225c542 vvet: fix false positive, add test (#14403) 2022-05-16 12:24:21 +03:00
yuyi
0ab4133128 cgen: minor cleanup in struct_init() (#14405) 2022-05-16 12:22:51 +03:00
spaceface
36bec823c2 checker: allow using methods as vars when expecting a ctx arg (#14414) 2022-05-16 12:05:08 +03:00
WoodyAtHome
c2b763655d net.smtp: handle UTF-8 subjects according to RFC 1342 (#14410) 2022-05-16 11:09:36 +03:00
Delyan Angelov
1cf683d482 checker: add a suggestion for misspelled mod.const_name + a test 2022-05-16 10:29:58 +03:00
Delyan Angelov
b4c529066a tests: simplify cmd/tools/modules/testing/common.v 2022-05-16 10:29:57 +03:00
Ben
cbb24d34c9 os: fix is_abs_path function for Windows systems (#14397) 2022-05-16 09:59:37 +03:00
yuyi
7fe3ef9a6e fmt: fix fmt error of anon fn with if expr (fix #14393) (#14413) 2022-05-16 09:48:21 +03:00
Larpon
5068b8b293 ftp: document all public methods (#14408) 2022-05-16 08:52:12 +03:00
Jah-On
02e026e298 clipboard: add [heap] tag to the Clipboard structs (#14412) 2022-05-16 08:45:40 +03:00
WoodyAtHome
eeff02a8ee net.openssl: read doesn't block infinitely (#14406) 2022-05-16 08:44:34 +03:00
spaceface
c01a8a1737 checker,gen: allow using methods as function pointers (#14407) 2022-05-15 18:28:37 +03:00
Delyan Angelov
c2bc9f4960 sync: only run channel_select_test.v when VTEST_RUN_FLAKY=1 2022-05-15 12:43:04 +03:00
crthpl
e4065bd57b checker,cgen: fix if expressions in lock expression (#14384) 2022-05-15 12:31:07 +03:00
David 'Epper' Marshall
c28051020a time: fix calculate_date_from_offset (#14399) 2022-05-15 10:55:24 +03:00
Delyan Angelov
b50f7fdc71 ci: simplify ci_sanitized.yml again; use v.exe fmt -verify vlib/builtin for windows/msvc instead of v test-cleancode 2022-05-15 10:54:31 +03:00
Delyan Angelov
c70e18ea8f ci: add a skip list in compiler_test.v (for tmpl_parse_html.vv) 2022-05-15 10:23:13 +03:00
Delyan Angelov
3a09ccc80a ci: restore .github/workflows/ to its state at cee7856, when all checks were done 2022-05-15 10:23:12 +03:00
Larpon
dd6629e932 examples: fix 2048 scaling on Android (#14380) 2022-05-15 09:14:18 +03:00
David 'Epper' Marshall
8d141878ce math: cbrt fix (#14395) 2022-05-14 21:06:38 +03:00
Delyan Angelov
67963e0ff2 ci: further cleanup of ci_sanitized.yml 2022-05-14 20:34:01 +03:00
Delyan Angelov
1225a865a3 ci: simplify ci_sanitized.yml 2022-05-14 20:29:56 +03:00
yuyi
fe9f97074b cgen: fix appending struct to interface array (#14388) 2022-05-14 17:49:42 +03:00
Alexander Medvednikov
3adad32355 tmpl: fix a test 2022-05-14 17:48:50 +03:00
Alexander Medvednikov
b42c824cdb vweb: simplify @foo by removing V_TEMPLATE rule 2022-05-14 17:46:30 +03:00
Daniel Däschle
f0d46413d9 ci: require code to be formatted before everything else (minimise CI queue length) (#14396) 2022-05-14 15:38:15 +03:00
JalonSolov
b3e80a3100 examples: add missing v.mod file (#14392) 2022-05-14 14:48:42 +03:00
j. redhead
441637eeb4 checker: fix optionals in infix expression check (fix #14354) (#14390) 2022-05-14 00:54:49 +03:00
Delyan Angelov
cee7856c0f ci: add a quick v test-cleancode check, before more costlier tasks 2022-05-13 12:24:11 +03:00
Delyan Angelov
714ce4e7fc ci: fix .out regression after d407a64 2022-05-13 11:18:17 +03:00
Delyan Angelov
c1bafe7a5a ci: extract v_apps_and_modules_compile.yml 2022-05-13 11:02:24 +03:00
playX
6ec4185017 checker: allow to pass alias to array as a pointer (c2v) (#14389) 2022-05-13 10:17:28 +03:00
Daniel Däschle
d407a6449d parser: fix dollar (closes #14292) (#14378) 2022-05-13 08:30:10 +03:00
Delyan Angelov
ed12a5c84c math.big: reduce memory usage of Integer.str() (free intermediary Integers), optimise some operations using [direct_array_access] (#14353) 2022-05-13 08:21:34 +03:00
yuyi
3c95504a35 checker, cgen: fix generic fn with array and fixed array arguments (#14385) 2022-05-13 06:57:48 +03:00
Daniel Däschle
d679146a80 fmt: remove space in front of ? and ! (#14366) 2022-05-13 06:56:21 +03:00
Delyan Angelov
df029da942 Revert "ci: run code-formatting job before everything else (try 2) (#14379)"
This reverts commit 0972e67f72.
2022-05-12 23:29:37 +03:00
Daniel Däschle
0972e67f72 ci: run code-formatting job before everything else (try 2) (#14379) 2022-05-12 21:58:11 +03:00
Delyan Angelov
8ef9dc6247 ci: run v fmt -w vlib/v/checker/fn.v (fix CI regression after 4952967) 2022-05-12 21:24:12 +03:00
Delyan Angelov
668d1b04d2 parser: make script mode errors more informative, when a top level declaration is encountered, after script mode had already started 2022-05-12 21:14:00 +03:00
Hunam
20139ad756 checker: fix typo (#14368) 2022-05-12 12:23:32 +03:00
playX
4952967366 checker: alias C2V fix (#14377) 2022-05-12 12:19:31 +03:00
yuyi
f48f7014f0 checker: check error for generic sumtype types (#14374) 2022-05-12 11:57:57 +03:00
penguindark
e93a8766e5 regex: fix #14370, last IST not managed in advance tests (#14372) 2022-05-12 11:49:57 +03:00
Delyan Angelov
b7ca4c1668 checker: fix a compiler panic on fntest()?(&int,&int){return test()?} 2022-05-12 11:36:32 +03:00
yuyi
8830af5c89 rand: minor cleanup in choose() (#14376) 2022-05-12 11:20:38 +03:00
yuyi
5bc4fea9e0 checker: check error for cast function to string (#14375) 2022-05-12 10:04:38 +03:00
CC
901b8f0c24 builtin: add a map.clear() method (#14373) 2022-05-12 09:43:01 +03:00
spaceface
49382f1f43 gen: make the closure implementation more performant (#14352) 2022-05-12 00:05:14 +03:00
Emily Hudson
c19b037880 net: select with deadlines (#14369) 2022-05-12 00:03:48 +03:00
yuyi
cd4fa041ff checker: check generic sumtype declare error (#14367) 2022-05-11 17:39:58 +03:00
Larpon
34a252ef84 os: add raw_execute on Windows (#14363) 2022-05-11 16:56:03 +03:00
David 'Epper' Marshall
26b81d68b5 time: update doc comments (#14359) 2022-05-11 16:55:19 +03:00
Larpon
0ec1c8d9f0 szip: expose zip_folder (#14356) 2022-05-11 16:48:41 +03:00
yuyi
3afc7c4c6d parser: check error for generic struct parameter (#14362) 2022-05-11 13:24:54 +03:00
Delyan Angelov
cf536b848b Revert "strings: reduce time spent in Builder.writeln (very frequently called)"
This reverts commit b53b1cc7cb.
2022-05-11 09:19:37 +03:00
yuyi
8f765ed5f1 checker: minor cleanup and speedups in fn_call() (#14343) 2022-05-10 16:41:47 +03:00
yuyi
5697d4375b cgen: fix error for printing aliases of multi fixed array (#14348) 2022-05-10 14:03:18 +03:00
yuyi
606d8cfaca checker: check error for returning aliases of fixed array (#14349) 2022-05-10 14:01:55 +03:00
Isaiah
9e09b709e3 net.http: fix crash on Windows when using Boehm GC (#14351) 2022-05-10 14:00:55 +03:00
yuyi
940c78bdfd checker: minor cleanup in method_call() (#14342) 2022-05-09 18:01:44 +03:00
Subhomoy Haldar
79f8a3c796 rand: update README.md (#14341)
* update README for rand module

* use concrete values

* make sure code works
2022-05-09 17:59:20 +03:00
StunxFS
d24dce8eb3 parser,checker: support $compile_error('message') and $compile_warn('message') (#14320) 2022-05-09 08:18:26 +03:00
Dialga
4400f9891e szip: fix extracting dot folders (#13387) 2022-05-09 07:45:36 +03:00
yuyi
8519996201 checker: fix error for match sumtype that referenced before (#14338) 2022-05-09 07:32:51 +03:00
Merlin Diavova
106487d62f pg: resolve PG string datetime values to V time.Time ones (#14336)
Co-authored-by: Merlin Diavova <md@merlindiaova.org>
2022-05-08 15:37:46 +03:00
David 'Epper' Marshall
650fb493bd regex: add split (#14329) 2022-05-08 15:21:39 +03:00
Delyan Angelov
084f2867b6 time: let time.parse_rfc3339('2015-01-06T15:47:32.080254511Z') succeed (dockerd timestamps, Go's RFC3339Nano). 2022-05-08 14:54:57 +03:00
WoodyAtHome
a0a3499bdc net.smtp: correct date in smtp body (#14326) 2022-05-08 09:15:45 +03:00
Alexander Medvednikov
0526499d5f tools: hide tcc warning on macos for now 2022-05-08 08:01:55 +03:00
Merlin Diavova
f8747d05dc pg: add type 18 for pg boolean data type (#14335) 2022-05-08 07:17:43 +03:00
StunxFS
d5e70552eb checker: check error for json.decode (fix #6732) (#14305) 2022-05-08 07:17:11 +03:00
David 'Epper' Marshall
aef95721a4 strings: builder: add clear (#14328) 2022-05-08 07:15:42 +03:00
yuyi
b04d46770b ast, checker, cgen: fix error for generic method with generic fn type argument (fix #14239) (#14333) 2022-05-07 20:22:20 +03:00
yuyi
724e7f037a cgen: fix error for if cond with optional expr (#14334) 2022-05-07 20:20:00 +03:00
David 'Epper' Marshall
a91226c376 docs: cleanup (#14327) 2022-05-07 20:18:42 +03:00
Delyan Angelov
b53b1cc7cb strings: reduce time spent in Builder.writeln (very frequently called) 2022-05-07 12:55:41 +03:00
Delyan Angelov
7ecd65221e v.util: support -d trace_cached_read_source_file 2022-05-07 12:55:41 +03:00
Delyan Angelov
56cf0b0a2e builtin: inline manually isnil calls in array.push_many (very frequently called) 2022-05-07 12:55:40 +03:00
Delyan Angelov
7f974a275a docs: fix teh typo 2022-05-07 12:55:40 +03:00
Delyan Angelov
f956acd2f6 ci: restore the v -autofree . step for gitly (gitly now has a workaround) 2022-05-07 12:55:40 +03:00
Delyan Angelov
9e8e364493 ci: comment out the go2v testing step for now 2022-05-07 12:55:39 +03:00
Alexander Medvednikov
ca42ace367 Revert "checker: remove more unnecessary void errors"
This reverts commit 89c1e7f980.
2022-05-07 11:03:12 +03:00
Alexander Medvednikov
35cfa0da7c doc: closures work on arm64 too 2022-05-07 11:02:53 +03:00
playX
6a6c005dc0 checker: c2v fixes (#14332) 2022-05-07 09:50:41 +03:00
Alexander Medvednikov
9fb8de14dd doc: closures now work on Windows 2022-05-07 09:49:33 +03:00
Alexander Medvednikov
89c1e7f980 checker: remove more unnecessary void errors 2022-05-07 09:09:18 +03:00
yuyi
70184ad1f8 scanner: minor simplification in scanner.v (#14331) 2022-05-07 08:30:15 +03:00
Alexander Medvednikov
14f06ead1b cgen: fix c2v consts; enum_decl() 2022-05-07 00:58:37 +03:00
yuyi
621574c12a checker: fix error for generic method on nested struct (#14322) 2022-05-07 00:51:04 +03:00
Hunam
0699f324b5 builtin: add map.values() (#14301) 2022-05-06 20:42:01 +03:00
Lathanao
ce99a306c0 net.http: make parse_form return POST requests with json data as a map with a json key, containing the json payload (#14289) 2022-05-06 20:23:36 +03:00
StunxFS
87de6df0e6 docs: update keyword list (#14319) 2022-05-06 20:17:45 +03:00
Ekopalypse
2027a1969b v.builder: harmonise the default settings of the different Windows compilers (#14314) 2022-05-06 19:28:13 +03:00
Daniel Däschle
76cdf75299 builtin,cgen: rename Option to _option (#14317) 2022-05-06 19:25:54 +03:00
yuyi
45fe87c9e3 checker: minor cleanup in fn_call() (#14307) 2022-05-05 21:15:54 +03:00
yuyi
3091f31019 checker: check for optional argument in dump() (#14316) 2022-05-05 21:15:22 +03:00
Claudio Cesar de Sá
634796ae42 examples: 2 new examples for graph algorithms (topological sorting) (#14303) 2022-05-05 18:08:08 +03:00
Andréas Livet
9fde5b067b docs: add missing function names in the builtin example doc comments (#14318) 2022-05-05 17:22:25 +03:00
Daniel Däschle
89fe82b732 checker: fix returning error on reference results (#14313) 2022-05-05 17:02:49 +03:00
yuyi
b6058bfd6e parser, checker: fix generic method on nested struct (fix #14089) (#14310) 2022-05-05 11:24:20 +03:00
playX
8afdb1c3ef checker: c2v: allow passing fixed array as pointer to functions; bool <-> int (#14309) 2022-05-05 11:23:57 +03:00
StunxFS
7499506cf8 .gitignore: minor cleanup (#14279) 2022-05-05 10:17:24 +03:00
Delyan Angelov
785e9af8f1 ci: comment out the v -autofree . step for gitly temporarily 2022-05-05 09:20:08 +03:00
Delyan Angelov
7170a09382 vfmt: fix stackoverflow on long nested infix expressions 2022-05-05 07:41:43 +03:00
Delyan Angelov
01c1892995 tools: fix building vdoctor.v with v build-tools 2022-05-04 23:30:44 +03:00
Delyan Angelov
a6b3e5d6a5 ci: wrap the too long line in README.md that failed ./v check-md -hide-warnings . 2022-05-04 21:19:57 +03:00
Ned
76a7354506 builtin: add libbacktrace as option for generating stack traces (#14277) 2022-05-04 21:17:05 +03:00
yuyi
4242e7610f checker: add comptime_selector() (#14286) 2022-05-04 19:25:58 +03:00
yuyi
e2aa5c9b3f parser: make peek_token_after_var_list() private (#14288) 2022-05-04 19:25:45 +03:00
Ikko Ashimine
223b96a59a builtin: fix typo in array_bare.v (#14299) 2022-05-04 19:25:17 +03:00
Delyan Angelov
1a4d9017e2 builtin: improve support for large arrays ([]int{len: 1_000_000_000} now works), fix an arr.repeat() bug (#14294) 2022-05-04 18:42:06 +03:00
Alexander Medvednikov
af8be14639 readme: minor github markdown fix 2022-05-04 18:06:41 +03:00
yuyi
ac90a2b53d checker: check error for fn call argument mismatch (fix #14280) (#14283) 2022-05-04 12:13:22 +03:00
playX
3bd6455178 checker: allow rune->any int and vice versa when translated (#14285) 2022-05-04 12:08:34 +03:00
Alexander Medvednikov
3d4b8dffdf checker: temporary c2v const fix 2022-05-04 08:28:27 +03:00
yuyi
f321422964 checker, cgen: check comptime selector that has no field name (#14282) 2022-05-04 07:06:52 +03:00
Alexander Medvednikov
1e9156fd71 checker: c2v rune comparison fix 2022-05-04 06:49:45 +03:00
yuyi
3732db2bcc cgen: cleanup in gen_array_contains_methods() (#14274) 2022-05-03 20:46:07 +03:00
playX
146051b231 checker: allow fixed array to pointer and vice versa when translated (#14275) 2022-05-03 20:44:45 +03:00
Delyan Angelov
04a77c731e tests: add // vtest flaky: true to atomic_test.v 2022-05-03 20:42:12 +03:00
yuyi
63eacede95 checker: check argument mismatch of array.filter/all/any() (#14273) 2022-05-03 16:56:18 +03:00
Hunam
6da300428e doc: add JS backend mention (#14265) 2022-05-03 12:51:12 +03:00
yuyi
276bd8060c cgen: fix error for fixed array in operate (#14269) 2022-05-03 12:45:04 +03:00
Delyan Angelov
0e5c1cee48 builtin: improve musl/Alpine support (define weak backtrace/backtrace_symbols/backtrace_symbols_fd symbols) (#14250) 2022-05-03 09:17:53 +03:00
Delyan Angelov
4da2908d63 vdoc: fix panic on empty // comment on v doc -f html file.v; turn expected code block after empty example to a warning 2022-05-03 00:02:12 +03:00
StunxFS
cf92224248 cleanup: delete x.v in project root folder (#14260) 2022-05-02 22:58:14 +03:00
Delyan Angelov
ab1c265679 builtin: add missing panic_result_not_set/1 callback function. 2022-05-02 22:40:26 +03:00
spaceface
db185598d2 checker: refactor comptime_if_branch (#14259) 2022-05-02 22:24:20 +03:00
yuyi
990afe37e1 checker: fix a bug in generics array init (#14258) 2022-05-02 16:18:33 +03:00
yuyi
d72a25098a parser: minor cleanup in interface_decl() (#14257) 2022-05-02 16:17:46 +03:00
yuyi
25c1b174ca checker: fix generic fn infering fn type argument (fix #14243) (#14256) 2022-05-02 16:17:27 +03:00
yuyi
b9cf2db6a8 parser: fix inline array's element access (#14253) 2022-05-02 16:16:32 +03:00
playX
afbe6bf3a2 cgen: fix const decl gen when translated (#14255) 2022-05-02 15:01:59 +03:00
Isaiah
a4fd349cf1 builder: allow -compress to work on windows too, when upx is installed (#14252)
Allow `-compress` flag on Windows if upx is installed. If upx not installed, same behavior as on linux/mac
2022-05-02 14:28:31 +03:00
yuyi
968d2b4654 cgen: fix fixed array init with it (#14251) 2022-05-02 02:00:45 +03:00
spaceface
332e821518 checker, gen: add support for a [minify] struct attribute (#14247) 2022-05-02 01:59:17 +03:00
Delyan Angelov
aed2d0caf2 make files: add a make check target, that runs v test-all locally 2022-05-01 13:38:30 +03:00
David 'Epper' Marshall
91c1157810 time: relative update (#14240) 2022-05-01 10:47:05 +03:00
Daniel Däschle
ec92d467d1 cgen: fix unsafe return error (#14233) 2022-04-30 17:31:28 +03:00
playX
0b54196962 checker: allow pointer index for translated code (#14231) 2022-04-30 17:30:55 +03:00
Daniel Däschle
9f8a34a528 all: rename result to _result (#14232) 2022-04-30 17:10:30 +03:00
Delyan Angelov
63d413f93c tools: support v missdoc . instead of v run cmd/tools/missdoc.v . 2022-04-30 16:12:39 +03:00
Delyan Angelov
c0b37409d2 tools: support a v vet -p file.v option that will warn about private functions with missing documentation 2022-04-30 16:09:30 +03:00
Delyan Angelov
8da42bfc85 tests: fix ./v -W build-tools CI failure 2022-04-30 13:49:36 +03:00
Delyan Angelov
5277ce7dce tests: support for marking _test.v files with // vtest flaky: true, to reduce false positives from the CI 2022-04-30 13:30:02 +03:00
David 'Epper' Marshall
a2338dbb7c docs: document more builtin functions/methods (#14229) 2022-04-30 12:31:23 +03:00
Delyan Angelov
dcdfdf4dd8 tools: make v up more informative on failure 2022-04-30 10:11:02 +03:00
spaceface
dab649ec8a cgen: rewrite the closure implementation (#14223) 2022-04-30 09:32:46 +03:00
Alexander Medvednikov
ce31a01a70 checker: allow voidptr arithmetic in translated code 2022-04-30 05:52:37 +03:00
yuyi
cd30b6ea82 parser: make sure interface field names use uppercase letters (#14228) 2022-04-30 05:29:33 +03:00
Daniel Däschle
08fd0ce0de all: basic implementation of result type (#14140) 2022-04-30 01:59:14 +03:00
StunxFS
db185e6580 checker: check for reserved type names in for in (fix #14072) (#14212) 2022-04-30 01:25:29 +03:00
Benjamin Thomas
48eb40cd2c doc: suggest a basic auto-reload setup (#14216) 2022-04-29 20:57:04 +03:00
David 'Epper' Marshall
881d0c04f1 time: add custom formatter (#14202) 2022-04-29 15:57:08 +03:00
yuyi
ec865cfb37 parser: check interface methods name (fix #14217) (#14218) 2022-04-29 15:48:03 +03:00
yuyi
317acfda97 checker: check struct field name using uppercase letters (#14220) 2022-04-29 14:57:14 +03:00
Wertzui123
872f739396 builtin: ignore C++ 0xE06D7363 exception errors on windows (#14225) 2022-04-29 14:55:29 +03:00
StunxFS
995485c649 builtin: add string.len_utf8() method (#14208) 2022-04-29 10:23:57 +03:00
StunxFS
8b798acadd cgen: fix use of C reserved words inside defer statement (fix #14101) (#14211) 2022-04-29 08:04:59 +03:00
Alexander Medvednikov
77645fcf35 builtin: define atoi & ftell 2022-04-29 04:31:51 +03:00
spaceface
14309594fe ast: add a type_size() method (#14213) 2022-04-28 23:35:10 +03:00
David 'Epper' Marshall
5a42350a78 docs: add a v fmt -w . step in the contributing guide (#14210) 2022-04-28 23:31:22 +03:00
StunxFS
e24482a143 transformer: minor optimization for 'string literal'.len (#14207) 2022-04-28 22:35:16 +03:00
playX
e56385d57d checker: disable op overloading on structures for translated code (#14209) 2022-04-28 20:46:46 +03:00
yuyi
7aca67fb60 ast, parser: fix complex map init (#14206) 2022-04-28 17:37:19 +03:00
yuyi
dd94ab890a cgen: fix go anon fn call with ref argument (fix #14192) (#14197) 2022-04-28 14:43:20 +03:00
yuyi
c802688690 ast: fix error for complex map operating (#14204) 2022-04-28 13:20:56 +03:00
Atom
a225b25117 arrays: rephrase doc string (#14205) 2022-04-28 13:17:53 +03:00
Delyan Angelov
4538efd8f4 eval: small cleanup in the handling of $if platform { 2022-04-28 13:15:09 +03:00
Delyan Angelov
e0ed8f8278 eval: make the interpreter backtrace more efficient and informative. 2022-04-28 12:31:30 +03:00
Delyan Angelov
f72297c331 eval: add support for C.read/3, C.malloc/1, $if openbsd { 2022-04-28 11:30:36 +03:00
Delyan Angelov
be04ec0620 pref: add support for -thread-stack-size 4194304 (default set to 8MB) (#14168) 2022-04-28 08:46:33 +03:00
yuyi
7dd5d9ee61 checker: fix error for array of sumtype appending literal value (#14200) 2022-04-28 08:44:30 +03:00
yuyi
09f8b6a380 checker: check error in for_c_stmt with optional call (#14190) 2022-04-28 08:43:16 +03:00
tzSharing
eb03fad934 gg: improve some loops in draw_rounded_rect* methods (#14195) 2022-04-27 22:57:48 +03:00
Delyan Angelov
f53b9b4f12 ci: fix tcc compilation of atomic_test.v 2022-04-27 22:50:18 +03:00
Alexander Medvednikov
7dbfa86f25 all: atomic int fixes 2022-04-27 18:31:21 +03:00
yuyi
82ac39eca6 math: fix error for math.abs(0.0)/math.abs(0) (related #14165) (#14191) 2022-04-27 13:23:37 +03:00
yuyi
752e105f25 cgen: fix error for generic sumtype casting to typenode (#14188) 2022-04-27 11:32:43 +03:00
tzSharing
85f616877f gg: fix gg.draw_rounded_rect_empty() graphical abnormalities and some optimizations (#14186) 2022-04-27 11:22:57 +03:00
playX
b76095f28a checker: allow + - * on pointers for translated code (#14183) 2022-04-26 21:00:44 +03:00
R cqls
c26b7666c7 gg: some stuff required to have svg and png screenshots working on v ui (#14180) 2022-04-26 20:59:36 +03:00
yuyi
be513b4c27 cgen: split up array_init() (#14178) 2022-04-26 20:58:47 +03:00
Larpon
1c48a8d760 strconv: add missing doc strings (#14164) 2022-04-26 18:09:36 +03:00
yuyi
660201c188 cgen: fix error for cast to empty interface (fix #14162) (#14176) 2022-04-26 13:26:48 +03:00
Brian Callahan
b9a0e2d285 sokol: support compilation on OpenBSD (#14169) 2022-04-26 13:14:00 +03:00
yuyi
38afd74d26 ast, checker, cgen: fix error for multi-return in or expr (fix #14167) (#14172) 2022-04-26 12:17:05 +03:00
playX
95880dfe5c checker: allow indexing through alias to int (#14177) 2022-04-26 12:15:35 +03:00
playX
dce2173ac9 checker: c2v fixes (#14161) 2022-04-26 01:34:26 +03:00
Alexander Medvednikov
501b293e84 checker: remove already handled "undefined" errors 2022-04-25 16:53:34 +03:00
Larpon
d799abd139 regex: rephrase doc string (#14159) 2022-04-25 16:03:13 +03:00
yuyi
e42dc8e228 checker: fix error for match aliases (#14157) 2022-04-25 14:42:43 +03:00
yuyi
f89c81087b checker: check error for array.index() argument (#14147) 2022-04-25 14:42:31 +03:00
yuyi
aeba110d01 cgen: fix error for printing multi fixed array (#14141) 2022-04-25 14:42:05 +03:00
Larpon
283d181047 cli: add missing doc strings (#14158) 2022-04-25 14:41:46 +03:00
yuyi
88f22b4367 cgen: fix error for anon fn decl inside ternary (#14150) 2022-04-25 12:36:03 +03:00
Delyan Angelov
60e205a193 tests: add ability to check the output of commands for .starts_with, .ends_with and .contains strings, in v test-all 2022-04-25 12:20:38 +03:00
Delyan Angelov
d35d67c2bd eval: enable v interpret examples/hanoi.v 2022-04-25 12:20:37 +03:00
Nick Treleaven
d8a5df9044 checker: error if smaller signed == unsigned (#14078) 2022-04-25 12:09:25 +03:00
Delyan Angelov
147e6e669f cgen: fix pushing to an array of string pointers (fix #14156) 2022-04-25 11:26:24 +03:00
yuyi
922cee9162 parser, checker, cgen: fix error for fn call using anon fn call argument (#14155) 2022-04-25 11:26:14 +03:00
Delyan Angelov
1291b621f6 ci: bump test retries for go_anon_fn_variable_call_test.v to 3 2022-04-25 10:32:41 +03:00
fleur
ddbe812f1b cgen: add callconv support for fns from ptr (#14151) 2022-04-25 08:51:03 +03:00
Haren S
11ee2b6409 builder: improve macOS 10.5 and PPC support (#14152) 2022-04-25 08:17:00 +03:00
stackotter
563469ed9f vfmt: fix array_init line wrapping (#14154) 2022-04-25 08:11:44 +03:00
yuyi
c819f0f86f checker, cgen: fix printing in 'for v in a' (#14146) 2022-04-24 13:30:13 +03:00
Alexander Medvednikov
9355048b6c tmpl: minor fixes and optimizations 2022-04-23 16:01:44 +03:00
Delyan Angelov
3388caa6c5 ci: bump vtest retry to 6 for channel_select_test.v (fails sporadically in the windows-gcc job) 2022-04-23 15:36:19 +03:00
Delyan Angelov
365e7d6b34 vfmt: ignore parser warnings, cleanup code 2022-04-23 11:10:12 +03:00
yuyi
d934472b17 checker: simplify checking array.contains() argument (#14133) 2022-04-22 22:34:13 +03:00
yuyi
b86320a669 parser: minor cleanup in stmt() (#14136) 2022-04-22 22:33:13 +03:00
Claudio Cesar de Sá
a2db44bc38 examples: add 2 more graph search examples (DFS and BFS), move them into examples/graphs (#14131) 2022-04-22 12:01:29 +03:00
yuyi
5dce091379 checker, cgen: fix generic empty interface to multi struct (#14132) 2022-04-22 11:02:51 +03:00
Alexander Medvednikov
9b565bf765 cgen: fix enum switch bug in translated code 2022-04-22 02:31:32 +03:00
tzSharing
03d21a727e gg: fix gg.draw_rounded_rect_filled() graphical abnormalities (#14128) 2022-04-22 00:16:10 +03:00
Larpon
506259adb6 os: add behavior info to is_dir_empty documentation (#14110) 2022-04-21 18:21:00 +03:00
yuyi
26b0e7fd34 fmt: remove extra parentheses (#14125) 2022-04-21 18:20:32 +03:00
Delyan Angelov
2080557f50 ast: allow a := match x { 101 { ... for {...} ... y } 2022-04-21 13:31:06 +03:00
yuyi
8a18f9175a cgen: fix error for if expr with nested match expr (#14122) 2022-04-21 13:02:31 +03:00
yuyi
448938be0d parser: fix generic anon fn decl with type only argument (#14124) 2022-04-21 12:53:13 +03:00
yuyi
99eb9fdaab checker: fix error for fn with array of aliases argument (#14123) 2022-04-21 12:52:09 +03:00
yuyi
f13583b04a checker: check array builtin method's arguments (#14119) 2022-04-21 12:51:04 +03:00
yuyi
8013bd43b0 checker: check map builtin method's arguments (#14120) 2022-04-21 12:49:46 +03:00
Delyan Angelov
5e8c4a3aff ci: enable again the v install ui task 2022-04-21 11:21:59 +03:00
StunxFS
2a0b372d0d tools: minor cleanup in fast.v (#14117) 2022-04-21 10:46:35 +03:00
ChAoS_UnItY
c5824c36f2 checker, cgen: allow static (fixed) arrays in in operator (#14121) 2022-04-21 10:32:29 +03:00
Delyan Angelov
c789ea5a15 ci: temporarily use git clone https://github.com/vlang/xyz ~/.vmodules/xyz instead of v install xyz 2022-04-21 09:20:15 +03:00
sunnylcw
4491b535ec doc: add link to V's standard library documentation at the start (#14114) 2022-04-21 00:26:20 +03:00
Delyan Angelov
31b28af179 bootstrap: remove -I ./thirdparty/stdatomic/nix from make files (#14111) 2022-04-21 00:12:50 +03:00
lemon
960225f7a7 builtin: fix -cc gcc -gc boehm on linux and macos (#14115) 2022-04-21 00:12:17 +03:00
Nick Treleaven
1533b77404 builtin: remove unnecessary casts for defunct small unsigned warning (#14108) 2022-04-20 21:47:09 +03:00
yuyi
0260c2a552 checker: minor cleanup in assign_stmt() (#14107) 2022-04-20 21:03:41 +03:00
Hunam
0374f021c5 os: small cleanup of function description (#14112) 2022-04-20 20:58:41 +03:00
mjh
1546645f63 datatypes: fix bst child access, when .root is 0 (#14080) 2022-04-20 16:49:18 +03:00
Larpon
a1342e85c3 os: add info about overwritten content to write_file (#14109) 2022-04-20 15:29:58 +03:00
yuyi
52ea0b8cc3 ast: minor cleanup of types.v (#14103) 2022-04-20 14:24:13 +03:00
yuyi
ce4c2afc9c checker, cgen: use 'stmts.last()' instead of 'stmts[stmts.len - 1]' (#14105) 2022-04-20 14:23:32 +03:00
yuyi
44ba19716b checker: fix error for fn with multi return (#14095) 2022-04-20 13:09:40 +03:00
yuyi
0c3b69eaef checker: fix error for assign array of aliases (#14096) 2022-04-20 13:08:47 +03:00
Alexander Medvednikov
364656b312 builtin: define C.abs() 2022-04-20 13:03:30 +03:00
Isaiah
0887b59254 vpm: fix get_all_modules() (#14097) 2022-04-20 12:15:30 +03:00
yuyi
8cc79e4299 checker: check error for arguments of array.contains() (#14102) 2022-04-20 11:00:59 +03:00
playX
711e90cf99 v.util: add math to builtin_module_names (temporary fix for C2V) (#14100) 2022-04-20 10:57:55 +03:00
playX
f6a0c26a85 checker: c2v fixes (#14091) 2022-04-20 01:09:34 +03:00
Delyan Angelov
9646e4b9d8 sync: use #insert for atomic.h, so that bootstrapping can be simplified 2022-04-19 20:06:20 +03:00
Delyan Angelov
006df58451 checker, cgen: add support for #insert, to simplify bootstrapping V 2022-04-19 19:37:04 +03:00
JalonSolov
daf5d32327 checker: fix error message when number of generic parameters is incorrect (#14090) 2022-04-19 18:34:23 +03:00
yuyi
a318a2e09e examples: fix optional in string interpolation and format error (#14079) 2022-04-19 13:29:53 +03:00
yuyi
e16ce3af88 token: minor cleanup of token.v (#14083) 2022-04-19 13:28:27 +03:00
yuyi
6164654d11 checker: check fn return type mismatch (#14081) 2022-04-19 13:04:41 +03:00
Nick Treleaven
4400efeb9f checker: Revert part of small_unsigned == signed (#13967) (#14075)
`gcc -W` doesn't error for e.g. u16 == i32, only for u32 == i16.
Any u16 value can fit in an i32.
2022-04-18 21:30:09 +03:00
yuyi
7ef64bde50 checker: check error for fn decl with optional arguments (#14076) 2022-04-18 21:22:31 +03:00
yuyi
d0a11f50ca cgen: minor cleanup of infix_expr.v (#14070) 2022-04-18 15:05:19 +03:00
Delyan Angelov
379b638b57 ci: update windows-install-sqlite.bat to latest sqlite 2022-04-18 14:25:57 +03:00
yuyi
fe371845da ast, checker, cgen: fix aggregations type check (#14066) 2022-04-18 12:38:08 +03:00
spaceface
775c4c34b5 builtin: compile the gc statically by default (#14063) 2022-04-18 10:50:21 +03:00
Ikko Ashimine
56a3539ea9 io: fix typo in readerwriter.v (#14060)
seperate -> separate
2022-04-17 17:40:14 +03:00
yuyi
17c34b09a6 checker, cgen: minor cleanup of last expr stmt expression (#14057) 2022-04-17 14:08:43 +03:00
yuyi
cb44f5981e checker, cgen: fix error for if expr with generic sumtype (#14056) 2022-04-17 08:19:44 +03:00
Vincenzo Palazzo
4f14f7714f checker: ensure that the variant SubType exists (#14053)
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-04-16 19:29:10 +03:00
Vincenzo Palazzo
48486e1afb ci: reformatted tools/vcreate.v (#14054)
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-04-16 19:09:08 +03:00
Cameron Katri
1fc54a1e5b vcreate: Allow custom default license (#14046) 2022-04-16 17:43:25 +03:00
Delyan Angelov
8a57f7ed2d v.util: always compile vfmt with -d vfmt to enable more efficient parsing 2022-04-16 14:05:55 +03:00
Julien de Carufel
16ead4e63c cgen: fix infix generics bug (#14048) 2022-04-16 13:23:19 +03:00
Alexander Medvednikov
43931a8e77 doc: byte => u8 2022-04-16 13:02:56 +03:00
Delyan Angelov
5b7e538119 v.pref: show the VCROSS_COMPILER_NAME notice only when the output is not a .c file 2022-04-16 10:46:03 +03:00
Delyan Angelov
4a71b27c52 ci: add test_byte_vs_u8 to int_test.v 2022-04-15 21:42:07 +03:00
Delyan Angelov
d75c408868 ci: fix typeof_simple_types_test.v 2022-04-15 21:22:32 +03:00
Delyan Angelov
82c5621621 ci: fix typeof_simple_types_test.v 2022-04-15 21:21:44 +03:00
Delyan Angelov
675f8b6300 ci: fix generic_fn_infer_struct_test.v 2022-04-15 21:21:12 +03:00
Delyan Angelov
ad231cec2f ci: fix code_test.v 2022-04-15 21:20:03 +03:00
Delyan Angelov
87a373d82c ci: fix coutput_test.v 2022-04-15 21:18:55 +03:00
Delyan Angelov
c7aedb8e8d ci: fix fmt_test.v 2022-04-15 21:16:31 +03:00
Delyan Angelov
375361b787 ci: fix ./v check-md -hide-warnings . 2022-04-15 21:08:09 +03:00
Delyan Angelov
840f474fb5 ci: fix ./v -progress test-cleancode 2022-04-15 21:04:10 +03:00
Delyan Angelov
e802e0b9cb ci: fix more test-all failures 2022-04-15 21:02:03 +03:00
Delyan Angelov
bb2a324d61 ci: more gen.js fixes 2022-04-15 20:51:04 +03:00
Delyan Angelov
868d3e1008 ci: fix failing tests for mysql, crypto.rc4, strings 2022-04-15 20:51:04 +03:00
Alexander Medvednikov
c03fe020bf parser: do not allow [x]byte{} 2022-04-15 20:40:37 +03:00
Delyan Angelov
6f5a513d8b ci: fix v build-examples 2022-04-15 20:31:10 +03:00
Delyan Angelov
e18cb9748f ci: fix v check-md doc/docs.md 2022-04-15 20:25:19 +03:00
Delyan Angelov
173e6a943b checker: fix tests (adjust byte to u8 in .out files too) 2022-04-15 20:15:03 +03:00
Delyan Angelov
cc8803c602 builtin: fix failing embed_file_test.v (pub fn (data &u8) vbytes(len int) []u8 {) 2022-04-15 19:57:00 +03:00
Alexander Medvednikov
78cb6e2b41 all: handle fixed []u8 2022-04-15 18:35:56 +03:00
Alexander Medvednikov
1c6f63ac0a tests: use u8 everywhere 2022-04-15 18:34:15 +03:00
Alexander Medvednikov
fbb9e65c0f all: ~500 more byte=>u8 2022-04-15 18:25:45 +03:00
Alexander Medvednikov
ae6a25f44e websocket, utf: u8 fixes 2022-04-15 16:24:02 +03:00
Alexander Medvednikov
e97ebf8cfc sokol: byte => u8 2022-04-15 16:12:05 +03:00
Alexander Medvednikov
258d1f77dc net: fix byte buffers 2022-04-15 15:57:45 +03:00
Alexander Medvednikov
af73e195da net: byte fixes 2022-04-15 15:55:39 +03:00
Alexander Medvednikov
fb192d949b all: replace []byte with []u8 2022-04-15 15:35:35 +03:00
Alexander Medvednikov
0527ac633e ast: remove .byte 2022-04-15 15:30:37 +03:00
Alexander Medvednikov
dbcf6e9c33 os: fix Process on windows 2022-04-15 15:23:05 +03:00
Alexander Medvednikov
c14984899b builtin: fix windows fn definitions 2022-04-15 15:18:21 +03:00
Alexander Medvednikov
a1372e284c builtin: update alloc fn definitions 2022-04-15 15:16:10 +03:00
Alexander Medvednikov
c3ad4e2069 encoding.base64: use u8 2022-04-15 15:10:34 +03:00
Alexander Medvednikov
d4a0d6f73c all: byte => u8 2022-04-15 14:58:56 +03:00
Alexander Medvednikov
b49d873217 builtin: [1000]u8 fix 2022-04-15 14:48:39 +03:00
Alexander Medvednikov
014c3c97f0 all: byte => u8 2022-04-15 14:45:52 +03:00
Alexander Medvednikov
7f3b91e688 builtin: more byte => u8 2022-04-15 14:10:11 +03:00
Alexander Medvednikov
1e7eb713fb cgen: remove byte references from cheaders.v 2022-04-15 14:04:53 +03:00
Alexander Medvednikov
ba7b329c73 builtin: more byte=>u8 2022-04-15 13:55:56 +03:00
Alexander Medvednikov
e6ff1508d2 all: make u8 the primary type, byte the alias 2022-04-15 13:43:03 +03:00
Delyan Angelov
566f150b24 net.http: add parse_request_head/1, cleanup existing code 2022-04-15 10:33:44 +03:00
Delyan Angelov
c3ee4fb2a2 crypto: make public all Digest.checksum() methods 2022-04-15 09:02:42 +03:00
Alexander Medvednikov
3b36f16365 all: volatile globals 2022-04-15 02:39:38 +03:00
Alexander Medvednikov
0dff050735 builtin: u8/byte clean up 2022-04-14 16:43:34 +03:00
yuyi
2d6d6c9ac9 json: fix json decode with sumtype of multi array type (#14035) 2022-04-14 15:36:24 +03:00
yuyi
c4dff0d797 cgen: format the generated source code by gen_str_for_union_sum_type() (#14026) 2022-04-14 15:26:10 +03:00
yuyi
72c2dc805d cgen: fix error for generics struct that parent has str to string (#14037) 2022-04-14 15:23:50 +03:00
Delyan Angelov
f6c9a60f99 pref: only show the support cross compiler warning/VCROSS_COMPILER_NAME message for the C backend 2022-04-14 15:04:00 +03:00
Delyan Angelov
bf62b2e33e vfmt: stabilise the attribute sorting order (sort first by length of atributes, then in alphabetical order of their names) 2022-04-14 14:53:45 +03:00
Delyan Angelov
f1f75897b3 sync: use asserts in channel code only when -d debug is passed 2022-04-14 14:00:57 +03:00
Delyan Angelov
a62560d2c1 ci: fix generation of vc/v_win.c in gen_vc.yml 2022-04-14 13:44:18 +03:00
Delyan Angelov
e555335bf0 ci: fix windows-msvc builds, as well as the windows-cross job, turn on deprecation notices for [windows_stdcall] and [_fastcall] 2022-04-14 13:36:51 +03:00
fleur
68401d9dc8 gen: add callconv attribute for fn and type (#14027) 2022-04-14 11:29:52 +03:00
Delyan Angelov
5905590e78 builder, pref: use i686-w64-mingw32-gcc for cross compiling 32bit windows apps with v -m32 -os windows hw.v 2022-04-14 10:42:25 +03:00
Vincenzo Palazzo
48c295150f checker: fixes typechecking for a sum type with an alias type (#13974) 2022-04-13 18:38:26 +03:00
yuyi
dc08105022 json: fix error for json decode with sumtype (#14025) 2022-04-13 18:06:28 +03:00
Delyan Angelov
e5809363de docs: describe the contents of vlib/v/gen/c/testdata/ and how to write tests for the checker, that still do not have good codegen counterpart 2022-04-13 14:55:26 +03:00
Alexander Medvednikov
d7adb67d52 cgen: fix [cinit] 2022-04-13 02:55:47 +03:00
Alexander Medvednikov
2525a30b5f cgen: [cinit] attr for globals 2022-04-13 00:30:51 +03:00
yuyi
e3e5bef139 ast, parser: fix formatting of if with inline comments (fix #7796) (#14018) 2022-04-13 00:15:27 +03:00
Nick Treleaven
c780de6282 checker: disallow 'small_unsigned == signed' (#13967) 2022-04-12 19:37:30 +03:00
fleur
6718958058 cgen: add a [_fastcall] fn attribute (#14016) 2022-04-12 17:06:56 +03:00
牧心
a810fbb80e cgen: fix infix_expr_in_optimization compile error when treating some kind cannot directly use '==' (#14015) 2022-04-12 16:19:44 +03:00
Delyan Angelov
8788512c4d checker: make using err.msg and err.code produce an *actual* notice, even with the present compatibility hack (will be *removed* in 2022-06-01) 2022-04-12 14:56:02 +03:00
Delyan Angelov
4c7cdd2a2d checker,cgen: use faster sym.idx == ast.error_type_idx integer comparisons, instead of sym.name == "IError" 2022-04-12 14:49:51 +03:00
Delyan Angelov
62032c43db ast: fix Table.rewrite_already_registered_symbol calls (they were setting sym.idx to 0) 2022-04-12 14:49:51 +03:00
Delyan Angelov
9b43713ec5 net: simplify TcpListener.accept, use C.accept(l.sock.handle, 0, 0), since we do not care about the local address of the accepted connection 2022-04-12 11:47:41 +03:00
Delyan Angelov
716cb17aea math.big: wrap all asserts in module code (not in tests) in $if debug {} (#14012) 2022-04-12 09:38:53 +03:00
crthpl
afb07e0e16 cgen: fix deadlock when returning multiple values in lock (#14014) 2022-04-12 09:21:27 +03:00
yuyi
3e3b2e25db parser, fmt: fix the formatting of fn headers with inline comments (#14010) 2022-04-11 22:31:06 +03:00
Larpon
07207db998 examples: reduce C. prefix usage, rename fontstash enums (#14011) 2022-04-11 22:23:06 +03:00
Delyan Angelov
cb969e0934 tools: fix the behaviour of regress.v , when oldv.v is not compiled 2022-04-11 21:57:33 +03:00
Delyan Angelov
382586da6d ci: fix toml segfault (remove unused low level builtin option IError.msg compatibility hack) 2022-04-11 21:49:59 +03:00
Delyan Angelov
e64c8cce62 ci: bump size of EMPTY_STRUCT_DECLARATION's _dummy_pad field to 8 (a voidptr, instead of char) 2022-04-11 17:53:18 +03:00
yuyi
5551cb248c ast, parser, fmt: fix formatting of consts with embedded comments (#14008) 2022-04-11 17:27:41 +03:00
牧心
25d8faabf6 cgen: fix alloc empty struct array error (#14007) 2022-04-11 14:16:09 +03:00
Delyan Angelov
843ce43077 strconv: cleanup atof.c.v - use a ParserState enum, clarify comments 2022-04-11 12:01:47 +03:00
Delyan Angelov
e4dfffd70b toml: remove math import (used only for math.max and math.max_u32) 2022-04-11 10:22:31 +03:00
Nick Treleaven
1938bc48e7 toml.scanner: make end_of_text, at, next and peek return u32 (#13998) 2022-04-11 10:12:04 +03:00
yuyi
fa66183f43 checker: check error for map of generic struct init (#13999) 2022-04-11 10:07:23 +03:00
Delyan Angelov
a0e7a46be4 rand: speed up MT19937RNG.u64 2022-04-10 13:07:35 +03:00
Delyan Angelov
6c25f5b291 rand: fix needless array allocation in MT19937RNG.u64() 2022-04-10 13:02:31 +03:00
Subhomoy Haldar
3f90809035 rand: add missing pub modifiers for .byte() and .u32() methods (#13992) 2022-04-10 11:43:46 +03:00
牧心
11d9a67e3b cgen: fix invalid operands to an_alias in an_array_of_aliased_values (#13994) 2022-04-10 11:42:17 +03:00
Delyan Angelov
8517b8f8b0 examples: use #[] in news_fetcher.v to simplify the code 2022-04-10 11:11:53 +03:00
Delyan Angelov
88c4a64a15 examples: make examples/sokol/drawing.v more symmetrical 2022-04-10 10:40:14 +03:00
yuyi
93a5d03182 parser: improve embedded struct parsing/better error for Architecture []string (#13995) 2022-04-10 10:24:36 +03:00
Vincenzo Palazzo
3571f66a82 pref: fix access in invalid position on v search '' (#13993) 2022-04-10 10:21:58 +03:00
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
Nick Treleaven
bf385d2ac9 docs: add links to download C compilers (#13984) 2022-04-09 15:53:37 +03:00
pancake
804f2f56d4 vpm: support v install -once module_name(#13977) 2022-04-09 14:29:41 +03:00
pancake
e3da3101f6 vpm: simplify output for v list (#13975) 2022-04-09 14:26:01 +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
mir.zhou
6425000ce4 example: fix the tuicool.com crawler example (changed html structure) (#13962) 2022-04-07 18:18:10 +03: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
Pascal Masschelier
95753ffb30 examples: fix process_stdin_trick example (#13953) 2022-04-07 13:55:12 +03:00
playX
6a820c2845 checker: allow all binary operations when translating code produced by c2v (#13964) 2022-04-07 12:22:24 +03:00
Vincenzo Palazzo
4666a27e5f ci: introduce v benchmarks inside the ci workflow (#13949) 2022-04-07 12:21:13 +03:00
Larpon
d34ef69229 tools: improve deprecation detection in missdoc.v (#13960) 2022-04-07 12:20:14 +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
Alexander Medvednikov
829fed4af0 ci: build vpm again 2022-04-05 08:02:47 +03:00
Nick Treleaven
7d8db1042d vdoc: don't highlight less than expression as generic function (#13938) 2022-04-05 05:58:47 +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
StunxFS
1211b2e941 v: minor change in the output for an unknown help topic (#13927) 2022-04-04 08:36:10 +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
Nick Treleaven
9c1981a309 vdoc: show // comment prefix and hide any \x01 character (#13880) 2022-03-31 20:00:06 +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
Delyan Angelov
fb5df9665e ci: use ./v instead of v in "Shader examples could be build" step 2022-03-31 13:53:02 +03:00
Delyan Angelov
fa3fa2e74f ci: add again sudo apt-get update for the Install dependencies step 2022-03-31 13:44:42 +03:00
Cameron Katri
b15240185e builder,cgen: iOS fixes (#13883) 2022-03-31 11:51:13 +03:00
Delyan Angelov
4222fd0862 ci: add vlang/pdf testing task, simplify other_ci.yml using v should-compile-all 2022-03-31 11:35:20 +03:00
Delyan Angelov
74eabba52e tools: add a v should-compile-all examples/*.v examples/gg/ tool, to simplify CIs of V modules. 2022-03-31 11:13:20 +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
Delyan Angelov
61f078664c ci: entirely delete the Code CI / arm64-ubuntu-tcc Cirrus job, since it does not honor trigger_type: manual, but simply timeouts after severah hours, showing fake positives in the github CI 2022-03-30 16:00:01 +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
Nick Treleaven
476f19c090 vdoc: tweak keyword, attribute and light theme CSS (#13853)
Make keywords bold.
Make attributes use a monospace font (like code).
Tweak light theme foreground colors:
* Make default-text, operator-text and punctuation-text a bit darker,
  improving the contrast.
* Make builtin-text a bit darker and more green (similar to dark theme).
* Make function-text a bit darker and more greeny-blue (similar to dark
  theme).
* Make attribute-text a bit less transparent for better contrast.
2022-03-28 20:38:00 +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
Nick Treleaven
c7a92425f0 doc: tweak built-in functions section & move dump section here (#13841) 2022-03-27 18:05:44 +03:00
Nick Treleaven
afdf8f50e7 doc: move enum methods to enum section from sum types (#13843) 2022-03-27 17:46:20 +03:00
Nick Treleaven
3a4bb09de2 doc: improve Arrays section (#13842) 2022-03-27 17:45:00 +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
d748529337 doc: add links to notable array related subheadings (#13838) 2022-03-27 14:29:20 +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
Nick Treleaven
dc9fd2bd7e doc: tweak array methods section (#13837) 2022-03-27 14:26:23 +03:00
Delyan Angelov
a07d066e8f tools: cleanup all temporary files on successfull v check-md . 2022-03-27 10:24:10 +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
Larpon
894080b844 ci: update sdl ci to compile shader example (#13805) 2022-03-22 17:36:23 +02:00
Ikko Ashimine
82120d02a8 tools: fix typo in vbug.v (#13802) 2022-03-22 15:47:03 +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
178afd006b examples: avoid flash of unstyled content in the vweb_assets example 2022-03-21 19:13:53 +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
Delyan Angelov
f2e0ab5912 docs: add formatting example for "[${10.0000:.2f}]" 2022-03-21 14:42: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
aaf87e04a2 tools: make the mini greeting text in the REPL more informative 2022-03-20 23:22:46 +02:00
Delyan Angelov
7216b5df11 tools: force showing V errors in color in interactive REPLs 2022-03-20 23:04:20 +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
236bcda549 tools: speedup v fmt -verify when there are no file differences, avoiding diff.color_compare_files 2022-03-18 12:15:55 +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
ylluminate
d87b5d40b6 docs: add installation-issues discussion in README (#13761) 2022-03-18 11:32:56 +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
pancake
c5174c2c69 doc: fix minor typos in build-c (#13738) 2022-03-15 08:14:46 +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
serg-meus
d6eb6d5bae doc: update struct access modifiers (#13734) 2022-03-14 18:38:36 +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
Delyan Angelov
4d99157cd5 ci: add go2v build & test job to other_ci.yml 2022-03-13 19:03:42 +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
Delyan Angelov
137fade014 Makefile: support CFLAGS and LDFLAGS for the vc/v.c to v bootstrap. 2022-03-08 14:48:20 +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
Subhomoy Haldar
0fd4c699dd tools: modify .gitattributes to categorize *.vsh and v.mod files properly (#13674) 2022-03-07 18:15:18 +02:00
yuyi
e6270b05dc checker: check unsigned integer compared with negative value (#13670) 2022-03-07 10:26:40 +02:00
Alexander Medvednikov
36ec47cd20 all: replace "NB:" with "Note:" (docs/comments) 2022-03-06 20:01:22 +03:00
Delyan Angelov
f74b65b63f docs: change term.input to term.ui in vlib/term/README.md 2022-03-06 15:50:22 +02:00
yuyi
c8e33ad219 cgen: fix error for array of reference auto_str (#13665) 2022-03-06 12:15:31 +02:00
Delyan Angelov
b0f651bf81 sync: enable tcc compilation of sync programs on Amazon Linux 2 (and other Red Hat distros like CentOS) by default (#13664) 2022-03-05 19:13:47 +02:00
yuyi
6380b9eb15 cgen: minor cleanup of struct.v (#13661) 2022-03-05 17:19:20 +02:00
yuyi
22fda7c3dd cgen: fix error for time struct init with update (#13660) 2022-03-05 13:28:48 +02:00
yuyi
8136157f87 checker: fix error for 'or expr with nested match expr' (#13658) 2022-03-05 13:06:08 +02:00
Ned
0e5ae7126f x/json2: fix decoder errors (#13655)
* x/json2: fix decoder errors, refactoring

* x/json2: add error-catching tests

* x/json2: add missing docs

* x/json2: fmt
2022-03-05 13:02:43 +02:00
kahsa
3ef437e679 sokol: reorder and add missing funcs (#13652) 2022-03-04 14:39:38 +03:00
Ned
437fa02f27 x.json2: add customized JSON output capability via Encoder (#13654) 2022-03-04 14:39:23 +03:00
Hunam
74d5106e8f cli: print cli errors in red where possible (#13647) 2022-03-04 12:28:11 +02:00
yuyi
f70e5bd69b parser: check assign expr with undefined variable (#13653) 2022-03-04 10:33:14 +02:00
ChAoS_UnItY
63b41e67fa v.parser: change body_start_pos to function declaration's lcbr, resolve #13642 (#13646) 2022-03-03 19:51:27 +02:00
Devin Bayer
9cc73fd0f8 docs: fix the .vsh doc example (#13645) 2022-03-03 19:47:05 +02:00
Delyan Angelov
4331d6dea0 v.builder: only add /DEBUG:FULL when -cflags does NOT contain custom /DEBUG options (#13643) 2022-03-03 16:47:41 +02:00
yuyi
a98eebde7f checker: add a notice for potentially incorrect smartcasts (#13644) 2022-03-03 16:36:40 +02:00
kahsa
1e76cccd48 doc: add a struct reference example (#13638) 2022-03-03 13:20:49 +02:00
yuyi
ac1b31dbba checker: fix error for array of interface init in for_in (#13636) 2022-03-03 12:32:55 +02:00
Delyan Angelov
3364f2aadf cgen: use ADDR for sumtype conversion instead of HEAP (fix regression after 7f8f571) 2022-03-03 11:44:24 +02:00
yuyi
288b13b51d all: cleanup smartcasts in the compiler (#13639) 2022-03-03 10:48:31 +02:00
Delyan Angelov
4e7db5bab0 v.builder: streamline get_os_cflags/0, use pref.os_from_string to centralise string -> v.pref.OS conversion 2022-03-03 10:43:50 +02:00
ChAoS_UnItY
6a3d34ae11 checker: fix #13626, when unwrapped type is fixed array, and selector expr is 'len' (#13627) 2022-03-02 20:46:18 +02:00
Delyan Angelov
57c6454656 ci: bump timeout-minutes to 30 for 'Bootstraping works' job 2022-03-02 19:51:40 +02:00
yuyi
36e80266e6 ast: fix error for 'for smartcast' - part 2 (#13635) 2022-03-02 16:01:20 +02:00
yuyi
ffe6ff3cc8 cgen: fix error for print smartcast variable (#13634) 2022-03-02 12:32:54 +02:00
yuyi
22017ff8f4 parser: fix error for 'for smartcast' - part 1 (#13629) 2022-03-02 12:18:03 +02:00
yuyi
7f8f571ed2 cgen: fix error for optional cast to interface (#13623) 2022-03-01 19:21:55 +02:00
kahsa
6d57315aca net: fix html dom debug print (#13625) 2022-03-01 19:20:40 +02:00
Ikko Ashimine
aa633dab41 utf8: fix typo in utf8_util.v (#13624) 2022-03-01 19:06:48 +02:00
Delyan Angelov
fd91811fe2 v.util: add set_source_for_path/2 to enable external tools to use util.formatted_error on pathless sources 2022-03-01 18:55:25 +02:00
yuyi
996bd41ce8 checker: simplify for smartcast in for_stmt() (#13619) 2022-03-01 12:31:48 +02:00
Joe Conigliaro
3b6e122d9d all: comptime_call - update tmpl scope vars with caller scope vars after their properties got updated in checker 2022-03-01 02:13:29 +11:00
yuyi
0028e557f9 checker: cleanup smartcast in checker.v (#13618) 2022-02-28 17:06:37 +02:00
yuyi
9a2df0df0e cgen: fix fn mut argument of interface type (#13616) 2022-02-28 13:31:04 +02:00
yuyi
013589e9fe parser: minor cleanup in global_decl() (#13617) 2022-02-28 13:30:17 +02:00
Subhomoy Haldar
a0d9e6e1c2 rand: extend PRNG interface, add buffering support (#13608) 2022-02-28 13:17:54 +02:00
yuyi
efeb3e04da ast: add table.is_sumtype_or_in_variant() (#13615) 2022-02-28 11:38:20 +03:00
yuyi
81c787ef91 checker: fix match expr with assign sumtype variable (#13614) 2022-02-28 11:37:59 +03:00
yuyi
bc16c61f6f parser: check using 'mut' on fn_decl return type (#13610) 2022-02-27 14:23:43 +02:00
yuyi
0fb1eaef04 parser: check the redefinition of built-in IError (#13606) 2022-02-26 09:52:40 +02:00
Mihai Galos
4215bb125c examples: improve the sendbus example (#13604) 2022-02-26 09:50:44 +02:00
yuyi
0d9792bdf2 ast: cleanup in find_method_with_generic_parent() (#13600) 2022-02-26 02:11:56 +03:00
Larpon
d80f5165dd fmt: keep trailing comments after fn header decl (#13596) 2022-02-25 16:36:48 +03:00
yuyi
83ea97b1a3 parser: fix optional expr with array value (#13599) 2022-02-25 15:54:12 +03:00
Larpon
73f931b52e fmt: improve single line const comment placement (#13595) 2022-02-25 14:46:12 +02:00
Delyan Angelov
9535d38645 ci: fix concurrency.group name for containers_ci.yml 2022-02-24 16:00:57 +02:00
Bastian Buck
fa645516c3 crypto: implement Output Feedback (OFB) Mode for AES and DES (#13583) 2022-02-24 14:38:21 +02:00
Bastian Buck
0d07a64230 crypto: implement Counter (CTR) Mode for AES and DES (#13582) 2022-02-24 12:06:33 +02:00
Delyan Angelov
9523c23e14 ci: bump timeout-minutes to 25 for ci_cross.yml 2022-02-24 12:04:04 +02:00
yuyi
d30ad344e8 checker: check error for array of sumtype appendding (#13593) 2022-02-24 11:07:03 +02:00
kahsa
f6891c405a doc: fix header size (#13594) 2022-02-24 10:51:10 +02:00
yuyi
a28249c119 ast: fix for in iterator of generic struct (fix #13579) (#13585) 2022-02-24 10:48:52 +02:00
kahsa
9662b79662 doc: improve embedded struct section (#13574) 2022-02-23 15:54:00 +02:00
Subhomoy Haldar
114a341f5f rand: simplify rand.PRNG, move to optional types for error handling (#13570) 2022-02-23 12:36:14 +02:00
Bastian Buck
5c0b7b0d05 crypto: implement Cipher Feedback (CFB) Mode for AES and DES (#13566) 2022-02-23 11:55:16 +03:00
yuyi
b5e7cef1b1 ast: define 'const invalid_type_idx = -1' (#13573) 2022-02-23 11:54:43 +03:00
yuyi
c3ec738126 checker: check struct field reference type mismatch (#13575) 2022-02-23 11:53:22 +03:00
gcxfd
838a8f2183 docs: improve the documentation for struct embedding (#13560) 2022-02-22 19:09:54 +02:00
mahdi ramezaan zaade
2712e43802 doc: add an example on how to get a cloned slice (#13567) 2022-02-22 17:22:33 +02:00
Delyan Angelov
d2e8302d21 ci: show failing compilation output in draw_fns_api_test.v (make diagnostic easier) 2022-02-22 16:53:06 +02:00
yuyi
6486fffc5a checker: cleanup map = {} processing (#13563) 2022-02-22 16:04:54 +02:00
Vincenzo Palazzo
6a876d4170 datatypes: small fix for the BST node constructor (#13569) 2022-02-22 15:41:30 +02:00
Larpon
1032cf5c04 checker: only cast as ast.Var if not unresolved, fixes #13561 (#13562) 2022-02-22 15:23:15 +02:00
Delyan Angelov
33d379d530 ci: vfmt vlib/net/socket.v 2022-02-22 15:21:20 +02:00
gcxfd
ee1de06678 net: extract a common Socket struct, reuse it by embedding in TcpSocket & UdpSocket (#13559) 2022-02-22 10:34:38 +02:00
Vincenzo Palazzo
7bd8503170 datatypes: add a binary search tree implementation (#13453) 2022-02-22 10:28:01 +02:00
Delyan Angelov
4a765bc33b cgen: support -d trace_gen_source_line_info 2022-02-21 23:04:10 +02:00
Delyan Angelov
f2e5bb447e os: remove dead code 2022-02-21 22:57:24 +02:00
yuyi
07e9ed1a1d cgen: fix interface embedding method call (#13553) 2022-02-21 17:49:38 +02:00
playX
b842e89acc all: initial implementation of compile-time types (#13549) 2022-02-21 17:42:54 +02:00
yuyi
83cdd8bedd ast: add comments for struct 'StructInit' and 'StructInitField' (#13551) 2022-02-21 12:48:53 +02:00
simon place
8ba4a3dd01 math.complex: make mutable the Complex.re and Complex.im fields (#13540) 2022-02-21 12:39:45 +02:00
kahsa
809772db4e gg: improve Context scale for Android (#13545) 2022-02-21 12:12:21 +02:00
gcxfd
8b033c3993 tools: add a -theme-dir folder/ parameter to v doc (#13550) 2022-02-21 12:08:46 +02:00
yuyi
04654ed518 parser: check error for defer propagate (fix #13534) (#13536) 2022-02-20 12:29:08 +02:00
yuyi
75ebac006d cgen: fix struct init with multi nested embed update expr (#13529) 2022-02-19 20:46:44 +02:00
gcxfd
dbae2d6af4 net: add UdpSocket.address() method (#13524) 2022-02-19 20:45:55 +02:00
yuyi
09f08e1fee cgen: fix error for interface and embedded struct build (#13530) 2022-02-19 20:43:40 +02:00
eyun
67e33bf9bc checker: make public the valid_comptime_if_os list (#13518) 2022-02-19 15:22:33 +02:00
eyun
2b974cdb97 docs: rename exec -> execute (#13514) 2022-02-19 15:20:46 +02:00
yuyi
0236931c78 cgen: fix generics with reference generic arguments (#13525) 2022-02-19 15:19:50 +02:00
Alexander Medvednikov
3fa6622ee8 doc: simplify the filter/map example a bit 2022-02-19 12:10:12 +03:00
Dialga
bcc4de19fc v.builder: fix cross compiling directory with spaces (#13522) 2022-02-19 10:08:41 +02:00
yuyi
0208e9672d checker: check array sort_with_compare callback function parameters (#13511) 2022-02-19 10:06:36 +02:00
Milo
4cdb244151 docs: update urls in roadmap (#13509) 2022-02-18 14:19:06 +02:00
Delyan Angelov
d86b18844e net.unix: use byte() instead of u16() cast for addr.sun_family 2022-02-18 13:47:12 +02:00
Delyan Angelov
fad254dcce ci: skip use_net_and_net_unix_together_test.v on windows 2022-02-18 12:45:32 +02:00
Delyan Angelov
3c38abc56e rand: fix rand.uuid_v4()'s clock_seq_hi_and_reserved field 2022-02-18 12:43:38 +02:00
Delyan Angelov
c9867a9ae4 net: ensure that net and net.unix can be imported together in the same program 2022-02-18 11:47:56 +02:00
yuyi
14073ac0fe checker: fix error for array of sumtype init (#13501) 2022-02-18 11:47:24 +02:00
Subhomoy Haldar
072480352c math.big: add get_bit, set_bit, big_mod_pow (#13507) 2022-02-18 11:53:39 +03:00
Delyan Angelov
a886242700 ci: extract ubuntu-docker-musl and alpine-docker-musl-gcc to containers_ci.yml, so they can be easily turned on/off in private github actions 2022-02-18 10:31:01 +02:00
Delyan Angelov
3bcd11260f ci: move alpine-docker-musl-gcc and ubuntu-docker-musl to other_ci.yml 2022-02-18 10:25:04 +02:00
Delyan Angelov
ef5ea0ef21 ci: fix vweb failures (restore the ability to *force* vweb to listen to *only* local interfaces) 2022-02-18 10:18:04 +02:00
Alexander Medvednikov
3d46005195 tools/fast: bring back -usecache 2022-02-18 10:41:53 +03:00
Joe Conigliaro
f4051e0252 checker: make sure generic struct instantiation uses a known type. closes #13506 2022-02-18 17:54:52 +11:00
Anton Zavodchikov
da9331f8ff vweb: support ipv6 (#13498) 2022-02-17 23:13:36 +03:00
Delyan Angelov
eb45a321a5 tools: add cmd/tools/regress.v to simplify bisecting for regression bugs/features:
Support finding which commit introduced a regression:
       ./v run cmd/tools/regress.v --old COMMIT --command './v run /abs/path/to/regression_bug.v'

   Support also finding which commit introduced a feature (or made code compile/run):
       ./v run cmd/tools/regress.v --old COMMIT --command '! ./v run /abs/path/to/feature.v'

   NB: the '! ' is a POSIX shell feature. It may not work on Windows outside of WSL.
   Its meaning is to invert the exit code for the next command, i.e. 0 -> 1, non 0 -> 0

   If it does not work for you, you need to write a more explicit script that will exit
   with 0 code for all commits, where the feature does NOT work, and with non 0 code for
   all commits, where the feature does work.
2022-02-17 18:07:28 +02:00
Joe Conigliaro
d739abbb3f cgen: move var decl out of loop in global_decl() 2022-02-18 00:42:54 +11:00
Delyan Angelov
ebb66aa82c tools: support git bisect run cmd/tools/oldv --bisect --command "./v run /abs/path/to/regression.v" 2022-02-17 15:34:55 +02:00
Delyan Angelov
554a689213 ci: be more verbose when running make.bat on the CI 2022-02-17 13:26:23 +02:00
Joe Conigliaro
07b15a209a cgen: fix for prev commit - get usecache working with clang (fix duplicate symbols) 2022-02-17 22:24:58 +11:00
Joe Conigliaro
6fc654821f cgen: get usecache working with clang (fix duplicate symbols) 2022-02-17 22:17:07 +11:00
Delyan Angelov
245b70cabc checker: bump iface_level_cutoff_limit to 100 (fix ci) 2022-02-17 11:46:04 +02:00
Delyan Angelov
230dc26858 checker: bump iface_level_cutoff_limit to 99 (fix ci) 2022-02-17 11:42:34 +02:00
yuyi
4f9039991f parser: cleanup in check_undefined_variables() (#13496) 2022-02-17 10:16:52 +02:00
Delyan Angelov
901a4d8b84 checker: restrict too deep recursion, to prevent stackoverflows on windows
For v itself, the nesting levels do not exceed 15, so a limit of 40 seems reasonable.
2022-02-17 10:04:11 +02:00
yuyi
842fd7a27e parser: check assign expr with undefined variables of struct_init (#13495) 2022-02-17 10:21:03 +03:00
Delyan Angelov
89b99ad4c3 scanner: remove the restriction for \x00 in strings (#13493) 2022-02-16 23:41:05 +02:00
blackshirt
54b10e99a1 ed25519: make public ed25519.internal.edwars25519.Element (#13488) 2022-02-16 22:56:14 +02:00
Tarcisio Gruppi
f68144774d fmt: fix map missing a comma after enum keys, leading to non parsable code (#13481) 2022-02-16 21:08:29 +02:00
Delyan Angelov
d3b8ac2e46 ci: remove the -silent flag for CI jobs (the failing tests are listed at the end of the run anyway) 2022-02-16 21:02:36 +02:00
yuyi
f8b8950b96 checker: check mut interface arguments (#13479) 2022-02-16 11:53:41 +02:00
Alexander Medvednikov
5a14748e7c cgen: c2v enum fix 2022-02-16 12:05:32 +03:00
Delyan Angelov
9c24d09dc3 strconv: bug fix for "${239.5:0.0f}" (#13483) 2022-02-16 11:33:29 +03:00
starryskye
6d2a88e31f net.smtp: add STARTTLS and implicit SSL support (#13473) 2022-02-16 09:18:51 +02:00
vyrus001
d4fc8601e0 builder: fix clang failing to link on windows due to an -ftlo error (#13470) 2022-02-16 09:13:26 +02:00
Mihai Galos
b8d656b308 examples: enhance the call_v_from_python example, with a fn accepting 2 f64 params (#13480) 2022-02-16 09:12:49 +02:00
blackshirt
3ac4155f0c crypto: add an ed25519 digital signature module (#13476) 2022-02-15 21:28:14 +02:00
Delyan Angelov
ff34b79d39 crypto: implement rand.bytes(needed_bytes int) ?[]byte, use it consistently instead of the old rand.read(), which will change to be compatible with io and the pseudo random rand module 2022-02-15 18:39:33 +02:00
Larpon
80444c8ec4 strings: add find_between_pair (#13468) 2022-02-15 15:12:15 +02:00
Delyan Angelov
d25652fbcf parser, ast: support -d for trace_rewrite_already_registered_symbol, trace_register_sym, trace_parse_stmt, trace_parse_comptime, trace_parse_text, trace_parse_file, trace_parse_vet_file 2022-02-15 13:20:40 +02:00
yuyi
fb3dd82400 cgen: fix interface embedding complex cases (#13472) 2022-02-15 12:41:40 +02:00
mint
73cf597bec ci: remove now-useless mlibc stuff from Vinix workflow (#13471) 2022-02-15 11:19:28 +02:00
yuyi
f9fc136c24 all: rename InterfaceDecl.ifaces to InterfaceDecl.embeds (#13475) 2022-02-15 11:17:39 +02:00
crthpl
e23db2f9b7 cgen: fix autogen free method for struct with shared field (#13469) 2022-02-15 03:55:06 +02:00
Delyan Angelov
89e9f8a00c ci: fix vinix compilation to commit aa18fc0 (Meson building mlibc fails in a01546b) 2022-02-14 21:25:50 +02:00
yuyi
dc0b0c83c6 ast: fix error for interface embedding call (#13466) 2022-02-14 19:22:44 +02:00
Delyan Angelov
f8bf3db568 markused: always include slice_ni & substr_ni too (support s#[] and a#[] in -skip-unused) 2022-02-14 19:05:30 +02:00
igor
efdbe9d92c repl: fix list command deleting '/'; adapt the logo to the terminal size (#13462) 2022-02-14 16:18:20 +02:00
yuyi
8119a297f7 ast: fix error for 'struct embed is interface' (#13465) 2022-02-14 13:43:36 +02:00
yuyi
b2f984280b checker: strengthen the judgment of generic type parameters replacement, merge generic type init tests (#13460) 2022-02-14 02:38:47 +02:00
yuyi
2e0f8ee9e2 ast: fix error for struct embedding with interface (#13457) 2022-02-14 02:33:47 +02:00
Vincenzo Palazzo
bf11df40e2 readline: give the possibility to ignore the empty line in the history (#13452) 2022-02-14 00:12:25 +02:00
blackshirt
57e850e932 crypto.sha512, crypto.sha256 : Make public the write() and sum() methods (#13461) 2022-02-14 00:10:50 +02:00
Delyan Angelov
74048e2f17 net: simplify the TcpConn.read_line/0 method, accumulate partially read lines, use a string builder, instead of concatenation 2022-02-13 22:42:38 +02:00
Vincenzo Palazzo
6ea4f361a1 urllib: fixed regression in the set function (#13455) 2022-02-13 15:06:00 +02:00
igor
9ff0c51e61 repl: reduce the vertical size used by V's logo, put it on the left of the info texts (#13451) 2022-02-13 11:41:36 +02:00
Delyan Angelov
bad30bdd79 os: allow using XDG_CACHE_HOME for choosing the folder returned by os.cache_dir() on windows too 2022-02-13 11:18:51 +02:00
yuyi
5071a54b99 cgen: split up into for.v, match.v, struct.v (#13454) 2022-02-13 07:52:49 +03:00
yuyi
b5379255da checker, cgen: fix error for struct embed with fn type (#13450) 2022-02-12 20:55:40 +02:00
Ulises Jeremias Cornejo Fandos
4391ae563d examples: improve the pendulum simulation, with several modes and diagrams (#13446) 2022-02-12 19:38:07 +02:00
Delyan Angelov
a74d28ae5f sync,ci: bump vtest retry for channel_select_6_test.v 2022-02-12 19:22:27 +02:00
Delyan Angelov
799c95dc4e tests: filter test_ fns with params from the list of automatically run test functions (fix #13443) 2022-02-12 17:30:20 +02:00
Delyan Angelov
11a0df5bee tests: rename struct_with_reference_alias_field.v to struct_with_reference_alias_field_test.v 2022-02-12 15:29:22 +02:00
crthpl
0eee012ae9 cgen: fix x in shared_map (#13442) 2022-02-12 11:55:25 +02:00
Tim Basel
37c151efe5 docs, builtin, encoding.csv: update error implementations (#13440) 2022-02-12 11:54:10 +02:00
yuyi
ae0e90f5d8 cgen: fix struct init with embed field update (#13444) 2022-02-12 08:16:51 +03:00
yuyi
7178367de0 all: fix error for comptime for in field with generic fn (fix #13409) (#13439) 2022-02-11 22:00:13 +02:00
Tim Basel
9d0a5942ac builtin: change IError msg and code to methods + fix vlib, add a deprecation notice for the old usages (#13041) 2022-02-11 15:52:33 +02:00
Vincenzo Palazzo
61024d4b75 repl: support aliased module imports too (#13423) 2022-02-11 15:03:14 +02:00
Juergen Donnerstag
654bc49d3c os: implement win_read_string on os.Process (#13428) 2022-02-11 13:02:00 +02:00
Artem
e0618f94e8 v help: add an example of using both -prof and run (#13432) 2022-02-11 11:24:07 +02:00
yuyi
a21f4563b3 checker: check the arity and the kinds of the type parameters in generic struct inits (#13429) 2022-02-11 11:21:07 +02:00
Vincenzo Palazzo
7f29418c63 strconv: change atof64 to return an error, if the parsed value is not a valid number (#13424) 2022-02-10 13:27:32 +02:00
Delyan Angelov
1c19573382 ci: use 'trigger_type: manual' for Cirrus CI's arm64_task/arm64-ubuntu-tcc job 2022-02-10 13:22:18 +02:00
kahsa
b205e2fc67 docs: improve the interface examples (#13422) 2022-02-10 12:28:40 +02:00
Delyan Angelov
9ed18efa53 checker: error on redefining any of the public builtin functions, not just ['print', 'println', 'eprint', 'eprintln', 'isnil', 'panic', 'exit'] (#13419) 2022-02-10 12:26:30 +02:00
Artem
43d6b97c21 docs: improve the hot reload section, add run command example (#13418) 2022-02-09 19:26:09 +02:00
yuyi
f2eb50008d parser, checker: cleanup struct short syntax processing (#13416) 2022-02-09 18:31:16 +02:00
Vincenzo Palazzo
0d1d259bb4 net.urllib: keep the query parameter order (#13405) 2022-02-09 17:36:12 +02:00
yuyi
4be3c92640 checker: check generic struct init without type parameter (#13404) 2022-02-09 14:06:45 +02:00
Delyan Angelov
356ccf247f cgen: add an earlier error, to pin point the use of closures on windows 2022-02-09 08:35:11 +02:00
Delyan Angelov
dd835acb8d sync: add Once.do_with_param/2 method in addition to the existing Once.do/1 (workaround the absence of closures on windows) 2022-02-08 17:15:28 +02:00
Subhomoy Haldar
5d2995c4d5 tools: support ./v symlink -githubci (#13403) 2022-02-08 13:23:10 +02:00
Delyan Angelov
1dbde05267 ci,tools: improve the precision of report-missing-fn-doc, remove dependence on sed 2022-02-08 11:30:13 +02:00
Delyan Angelov
ff02f94fd6 tools: support --exclude/-e and --relative-paths/-r options in missdoc.v 2022-02-08 11:10:19 +02:00
Snavy
f0806822dd docs: add a JSON section, and subsections for encoding and decoding (#13396) 2022-02-08 10:18:40 +02:00
playX
4ef7d26133 arrays: add rotate_left and rotate_right (#13388) 2022-02-07 13:20:45 +02:00
Larpon
5df83812a0 ci: fix undoc pub fn diff output (#13389) 2022-02-07 13:18:10 +02:00
Vincenzo Palazzo
10dcb2e0d9 parser: allow embedding interfaces from other modules (#13385) 2022-02-07 00:20:34 +02:00
Delyan Angelov
1dc239227d docs, builtin: clean up the homepage of modules.vlang.io a little, do not use //==== comments for now in builtin 2022-02-06 23:51:40 +02:00
Delyan Angelov
7f70493e1d vdoc: show the V commit hash too, not just 0.2.4 2022-02-06 23:50:11 +02:00
Delyan Angelov
191e99c248 v.doc: use the .parse_comments mode, instead of the older .toplevel_comments (the scanner/parser is now more robust) 2022-02-06 23:49:21 +02:00
Larpon
649ecab11f ci: add report-missing-fn-doc job, to prevent adding new undocumented pub symbols in vlib (#13386) 2022-02-06 19:52:14 +02:00
Vincenzo Palazzo
d46ac40758 checker: add error for assigning none values (#13383) 2022-02-06 16:08:23 +02:00
Larpon
31df2c4f45 tools: tweak missdoc defaults, add CLI flags to control what's ignored (#13384) 2022-02-06 15:44:26 +02:00
kahsa
fd9aa8bee6 ci: require a minimal reproducible code sample in .github/ISSUE_TEMPLATE/bug_report.md (#13382) 2022-02-06 15:41:57 +02:00
Delyan Angelov
1be0cb0306 ci: do not fail silently in the Cirrus CI / Code CI / arm64-ubuntu-tcc job 2022-02-06 14:18:24 +02:00
div72
939bc9f26f v.parser: fix compilation of normal .v files with -translated (#13363) 2022-02-06 12:53:20 +02:00
Ikko Ashimine
31739c2586 docs: fix typo (#13381) 2022-02-06 11:39:35 +02:00
Delyan Angelov
66f21cae55 rand: add pub fn rand.read(mut buf []byte) and pub fn rand.bytes(needed int) ?[]byte{} + tests 2022-02-06 10:54:34 +02:00
yuyi
ece73836aa cgen: fix error for struct with reference alias field (#13380) 2022-02-06 10:52:36 +02:00
Vincenzo Palazzo
4e13ee22e9 repl: reproduce the void print function error (#13372) 2022-02-06 08:05:25 +02:00
Alexander Medvednikov
f23d2c8cf4 cgen: c2v variadic fixes 2022-02-06 03:36:38 +03:00
div72
cec7e91714 v.parser, v.checker, v.gen: add support for [translated] tag (#13373) 2022-02-06 00:16:02 +02:00
Sandro Martini
054c8b1f13 log: update Logger interface, so that Log is usable even as a Logger instance; add a test to ensure it (#13376) 2022-02-05 22:09:55 +02:00
Delyan Angelov
5faabe7464 Revert "cgen: fix error for struct with reference alias fields (#13374)"
This reverts commit 4d485ae687.
2022-02-05 18:52:37 +02:00
yuyi
4d485ae687 cgen: fix error for struct with reference alias fields (#13374) 2022-02-05 18:23:54 +02:00
Asher
47ee292ba4 vweb: make Context.mount_static_folder_at more robust (#13361) 2022-02-05 15:10:26 +02:00
yuyi
173b4652fb parser: check orm sql statements, using undefined variables in where expr (fix #13367) (#13368) 2022-02-05 11:32:41 +02:00
Vincenzo Palazzo
c9a8d6448d fmt: preserve formatting with comments in a empty map (#13362) 2022-02-05 10:05:35 +02:00
Vincenzo Palazzo
b9fce4ef09 checker: make sure that the operator check is made on the concrete type (#13360) 2022-02-05 00:11:24 +02:00
Delyan Angelov
a054f868a0 v.util: use a normalised relative file path in the error messages with /, even on windows, to make the compiler error tests more robust 2022-02-04 17:56:08 +02:00
Delyan Angelov
d02c0636d8 encoding.hex: fix shift warning 2022-02-04 15:16:08 +02:00
yuyi
a61b4809dc ast, parser, checker: fix generic struct init with inconsistent generic types (#13359) 2022-02-04 14:24:38 +02:00
Delyan Angelov
89d399b035 examples: fix leak in examples/sokol/particles/, by marking s.pool and s.bin with .noslices 2022-02-03 18:52:52 +02:00
Delyan Angelov
85d36ed231 checker: stricter type casting error messages 2022-02-03 14:18:30 +02:00
kahsa
ede9f29323 doc: mention []rune.string() (#13348) 2022-02-03 11:29:02 +02:00
yuyi
be1e40dac0 cgen: fix error for sql statement inside fn call (fix #13330) (#13346) 2022-02-02 18:05:31 +02:00
Delyan Angelov
9344c27021 builtin: save a call to array.ensure_cap in array.insert, array.push, array.push_many in most cases 2022-02-02 11:01:07 +02:00
crthpl
c0c07db7cc cgen: fix struct field init from shared struct field (#13343) 2022-02-02 10:55:57 +02:00
penguindark
c3573454d1 regex: fix bug in replace_by_fn (#13344) 2022-02-02 10:52:18 +02:00
yuyi
b10b65e134 cgen: fix error for interface with multi-nested embed struct (#13345) 2022-02-02 09:11:29 +02:00
Delyan Angelov
b2c299da48 vweb: support vweb.run_at(app, localhost, 8099) (#13337) 2022-02-01 18:41:12 +02:00
Delyan Angelov
d8cce0a71d ci: fix cgen for interface_struct_with_multi_nested_embed_test.v for gcc/clang 2022-02-01 17:12:15 +02:00
yuyi
a014844050 cgen: fix error for interface with multi nested embed structs (fix #13331) (#13336) 2022-02-01 14:50:12 +02:00
Tarcisio Gruppi
51513ae19a vfmt: keep file permissions with -w on !windows (#13334) 2022-02-01 14:49:06 +02:00
penguindark
7c1b249da0 regex: fix dot char problems on groups with * (#13333) 2022-02-01 13:49:37 +02:00
Delyan Angelov
310969a057 docs: clarify the interface methods section 2022-02-01 10:36:25 +02:00
Delyan Angelov
db50e79d26 tools: implement cgen tag for Markdown examples in v check-md (#13332) 2022-01-31 22:51:04 +02:00
yuyi
b34860e39b ast, checker: fix error for calling complex nested generic type function (fix #13025) (#13328) 2022-01-31 13:00:27 +02:00
Delyan Angelov
46a096b95d Revert "v.util: make mod_path_to_full_name more robust"
This reverts commit b11ce91141.
2022-01-31 06:57:50 +02:00
Delyan Angelov
b11ce91141 v.util: make mod_path_to_full_name more robust 2022-01-30 22:26:36 +02:00
Delyan Angelov
894da4b40b ci: fix for sporadic Killed failures when running js tests on macos 2022-01-30 16:43:04 +02:00
Delyan Angelov
96c8188083 builtin: fix warnings for tests inside vlib/builtin/js 2022-01-30 16:36:56 +02:00
Delyan Angelov
f6cb772347 v.util: prepare for removing vlib/v/util/module.v - improve tracing, comment edge cases with actual data 2022-01-30 15:08:33 +02:00
Merlin Diavova
f3683b7cdc os: add an .exit_code field to os.Command (#13321)
* Added os.Command.exit_code

* vfmt vlib/os/os_test.v

* extract os.Command to os.v, add a dummy panicing implementation on windows, just for parity, fix os_test.v on macos, skip test_command on windows.

Co-authored-by: Merlin Diavova <md@merlindiaova.org>
Co-authored-by: Delyan Angelov <delian66@gmail.com>
2022-01-30 00:44:52 +02:00
Delyan Angelov
eb7f152f3d gg: add a temporary import for gx + a gg.Color type alias for gx.Color, without using it 2022-01-29 21:42:19 +02:00
Delyan Angelov
afd3ca8273 gx: implement C1.over(C2), add gx.cyan and gx.magenta, fix + and - ops, add more tests 2022-01-29 21:40:09 +02:00
Benjamin Stigsen
a4fb5d2cfd Fix gx.Color math operations (#13315) 2022-01-28 22:53:14 +02:00
Delyan Angelov
44dddecc09 builtin: use a pure V version of string.to_wide() on != windows (#13314) 2022-01-28 20:41:50 +02:00
Ken
e43794ad61 picoev: remove unused #flag (#13311) 2022-01-28 20:36:41 +02:00
Benjamin Stigsen
ceb05b163a strings: rename Builder.write_b() to Builder.write_byte(), add deprecation (#13313) 2022-01-28 20:34:44 +02:00
kahsa
7f22ed7935 doc: clarify the section about -autofree (#13309) 2022-01-28 13:18:59 +02:00
kahsa
61d28c8a8c doc: change word coroutine to thread (#13308) 2022-01-28 13:17:36 +02:00
Delyan Angelov
71d98717dc checker: small cleanup of commit edc6c9e 2022-01-28 11:03:15 +02:00
Yamada Hayao
edc6c9e24f checker: show error instead of panic, when using a somemodule.NonExistingEnum.enum_value (#13295) 2022-01-28 11:02:51 +02:00
kahsa
1f20127502 doc: add example for interface casting (#13304) 2022-01-28 10:09:52 +02:00
Delyan Angelov
8491e83e3f ci: bump retries to 8 for vlib/net/tcp_test.v 2022-01-28 10:07:37 +02:00
Larpon
41b9b2988a examples: add port of simple triangle sokol sample (#13298) 2022-01-27 21:16:00 +02:00
Larpon
faaa7035c4 examples: fix segmentation fault crash on exit in sokol 0X_ examples (#13299) 2022-01-27 19:46:55 +02:00
Delyan Angelov
eb765f975c ci: add a small delay between failed test retries. bump retries for channel_select_6_test.v to 8 2022-01-27 17:43:55 +02:00
Delyan Angelov
daa5be4c27 ci: skip vlib/v/checker/tests/modules/deprecated_module on windows for now 2022-01-27 15:38:52 +02:00
yuyi
9dce8194a8 cgen: fix error of method calls on nested embedded structs (#13292) 2022-01-27 13:20:56 +02:00
Delyan Angelov
f8f7bc8ead ci: fix deprecated_module.out file too 2022-01-27 13:16:25 +02:00
Delyan Angelov
ebad7301f9 ci: fix failing deprecated_module test on windows 2022-01-27 13:15:34 +02:00
Delyan Angelov
e1a2ab345d parser,ast,checker: add support for [deprecated: "use another module"] module obsolete 2022-01-27 12:34:14 +02:00
yuyi
3bd528b218 ast, checker, cgen: fix error for map sumtype value init (#13290) 2022-01-27 09:44:34 +02:00
Delyan Angelov
3fa9128716 cgen,pref: support -profile-fns strings__new_builder,i64_str -profile - 2022-01-26 20:39:47 +02:00
Larpon
65a97a9fbe examples: fix navigating unicode text in text_editor (#13286) 2022-01-26 17:25:29 +02:00
JalonSolov
01c72d44e8 net.http: add allow_redirect to FetchConfig (#13285) 2022-01-26 17:13:10 +02:00
Delyan Angelov
2d184559b6 ci: fix failing draw_fns_api_test.v on macos (after rename) 2022-01-26 15:32:06 +02:00
yuyi
291a1ffd8d token: rename Position to Pos, rename position() to pos() (#13279) 2022-01-26 12:36:28 +02:00
yuyi
d71fc0d13f checker: fix error for cast to alias of reference struct (#13278) 2022-01-26 12:32:14 +02:00
kahsa
867056dafb gg: rename some variables (for consistency) (#13280) 2022-01-26 12:26:12 +02:00
Delyan Angelov
0979723636 gg: improve small circle (r<20) looks 2022-01-26 10:32:14 +02:00
Delyan Angelov
469282b20d builtin: cleanup [trusted] tags for C function declarations 2022-01-25 19:31:40 +02:00
Alexander Medvednikov
4715fb67c1 checker: c2v fixes for enums and pointer to numbers 2022-01-25 20:15:45 +03:00
Tim Basel
1fdbdf4a6b cli: make help fn's public (#13275) 2022-01-25 15:58:06 +02:00
Larpon
95d86324c3 examples: support unicode in the text_editor.v buffer (#13269) 2022-01-25 15:39:35 +02:00
Larpon
28ddd8440a term.ui: add support for multi byte/UTF-8 events (#13274) 2022-01-25 14:46:48 +02:00
yuyi
ca1f675dba ast, checker, cgen: implement if guard with multi return optional (#13273) 2022-01-25 14:36:33 +02:00
Subhomoy Haldar
fe77e64b3e os: remove trim_space() in os.execute() on windows, to make implementations consistent (#13272) 2022-01-25 14:09:56 +02:00
Delyan Angelov
a913983408 ci: fix -cstrict jobs (use U postfix for u64 hash constants in embed.v) 2022-01-25 12:50:19 +02:00
crthpl
009a65b1fc cgen: fix appending an array to a shared array (#13265) 2022-01-25 12:05:43 +02:00
Delyan Angelov
5f38ba896e parser,cgen: handle const x = $embed_file("file.txt").to_string() 2022-01-25 11:40:07 +02:00
Delyan Angelov
32f2f0dfa1 term.ui: fix shift notices, remove warning for main example 2022-01-24 20:11:36 +02:00
yuyi
509a8fcaf1 cgen: fix 'for in mut val' with 'if val in' (#13263) 2022-01-24 17:08:21 +02:00
Delyan Angelov
7199528a27 ci: use different concurrency.group values for different .yml files 2022-01-24 14:36:42 +02:00
Delyan Angelov
1cea7b0c73 ci: vfmt vlib/net/http/request.v 2022-01-24 14:33:12 +02:00
kahsa
387b2db658 gg: cleanup reordering for readablity (#13258) 2022-01-24 14:12:34 +02:00
Delyan Angelov
0347dadf75 ci: vfmt checker.v 2022-01-24 14:01:35 +02:00
ZoaR
4ba9a2ffbe net.http: implement a Request.allow_redirect field (true by default) (#13259) 2022-01-24 14:00:30 +02:00
yuyi
3bfad1b943 checker: fix method call errors for generic struct instances (#13261) 2022-01-24 12:45:19 +02:00
skurgs
7fd08eca96 checker: fix c error on improper string to rune cast (#13197) (#13257) 2022-01-24 12:13:22 +02:00
Alexander Medvednikov
216a505c2a builtin: more libc fn definitions 2022-01-24 06:14:31 +03:00
yuyi
edf0bc365c checker: fix ui struct init error with default field value is const variable (#13215) 2022-01-23 18:37:52 +02:00
Benjamin Stigsen
4e0e2ef753 gg: additions, changes and fixes (#13255) 2022-01-23 18:18:17 +02:00
Delyan Angelov
34f0d442df ci: separate other_ci.yml and paths_ci.yml; simplify make.bat (#13254) 2022-01-23 12:50:19 +02:00
Delyan Angelov
86a2562fa7 ci: skip repl_test.v on windows for now 2022-01-23 01:37:03 +02:00
Delyan Angelov
657270faa8 ci: show more details for REPL tests on windows 2022-01-23 01:37:03 +02:00
Delyan Angelov
86930873ac ci: fix vsh_envbang_test.v 2022-01-23 01:37:02 +02:00
Wertzui123
22c21e62a1 examples: fix the mandelbrot set example on Windows (#13251) 2022-01-23 00:45:27 +02:00
Delyan Angelov
fba9587323 ci: fix compiler_errors_test.v too 2022-01-23 00:09:32 +02:00
Delyan Angelov
359b674cff ci: fix more failing tests 2022-01-22 23:18:09 +02:00
Delyan Angelov
9057e9f1dd ci: fix vls compilation 2022-01-22 23:08:30 +02:00
Delyan Angelov
62c3ad4953 use os.quoted_path more 2022-01-22 22:22:22 +02:00
Delyan Angelov
fa6f7d4c83 os: add os.quoted_path/1, use it consistently for running V itself 2022-01-22 21:13:28 +02:00
Delyan Angelov
85ec0248e9 ci: rename types_test.v to toml_types_test.v
This is a workaround for a concurency bug, occuring sporadically when
test file names in different folders are duplicate.

The duplicate in this case was with vlib/v/ast/types_test.v
2022-01-22 20:25:06 +02:00
Delyan Angelov
9ebd56caa7 cgen,json: bugfix for json.decode; now [skip] fields are initialised 2022-01-22 19:29:38 +02:00
yuyi
e66e35ced1 json: fix error for json encoding sumtype value (#13248) 2022-01-22 17:55:19 +02:00
Larpon
839ae6b2e4 toml: fix a doc string (#13246) 2022-01-22 10:27:16 +02:00
Larpon
2b4f7e7685 toml: add encode<T> and decode<T> (#13244) 2022-01-21 21:21:31 +02:00
Larpon
7ae96f0e38 toml: add support for arrays and maps of primitives in reflect<T> (#13245) 2022-01-21 21:20:44 +02:00
Delyan Angelov
36c9ed6889 ci: split code-formatting-perf-regressions in 2 jobs 2022-01-21 17:13:04 +02:00
Delyan Angelov
04aab250aa ci: prevent adding GPL licensed code by accident. 2022-01-21 17:13:03 +02:00
crthpl
cbd3c14e83 cgen: fix codegen for struct field with a shared array of points (#13222) 2022-01-21 17:08:19 +02:00
yuyi
ffb263c2e1 ast: minor cleanup of commented struct Field (#13231) 2022-01-21 15:00:21 +02:00
yuyi
05ff8f516d ast: fix error for generic sumtype init in generic fn call (#13238) 2022-01-21 14:46:55 +02:00
Charles WANG
79cb0db2ff gg: add a working implementation for screen_size() on windows (#13237) 2022-01-21 14:43:12 +02:00
Tim Basel
6c8e7f53b5 transformer: fix some missing stmt assignments (#13236) 2022-01-21 12:11:10 +02:00
yuyi
edbb39b81d checker: correct error message of struct_decl() (#13240) 2022-01-21 12:10:09 +02:00
Delyan Angelov
295156e054 checker,cgen: implement v.profile.on/1, support [if profile] and -d no_profile_startup (#13232) 2022-01-21 03:26:05 +02:00
Delyan Angelov
9e0156b46a net: copy the freebsd address declarations for netbsd, openbsd, dragonfly 2022-01-20 20:15:50 +02:00
Delyan Angelov
62687842e2 Revert "math: add a new math.easing module (#13226)" (#13235)
This reverts commit 758d1f44ab.
2022-01-20 18:57:53 +02:00
kahsa
758d1f44ab math: add a new math.easing module (#13226) 2022-01-20 14:17:47 +02:00
yuyi
7c9cd855b4 cgen: fix fn call with fixed array literal arguments (#13225) 2022-01-20 15:04:16 +03:00
yuyi
d553071e65 parser, checker: correct error message for a fixed array size using a non constant (fix #13219) (#13228) 2022-01-20 13:03:19 +02:00
Subhomoy Haldar
5143837d66 cmd/tools: add support for .editorconfig and improve v init to initialize missing files (#13230) 2022-01-20 13:01:30 +02:00
yuyi
09797e493e checker: check generics undefined operation of infix expression (#13223) 2022-01-20 08:57:25 +02:00
Tim Basel
14b33baa3b transformer: refactor + apply transform to (hopefully) all nodes (#13216) 2022-01-20 08:40:16 +02:00
Wertzui123
d67be6302b gg: add the gg.Context.remove_cached_image_by_idx() method (#13206) 2022-01-20 08:10:09 +02:00
yuyi
ba3308296b ast: rename register_type_symbol to register_sym (#13217) 2022-01-19 20:16:23 +02:00
Delyan Angelov
d63f395061 runtime: simplify nr_cpus 2022-01-19 19:29:29 +02:00
Tim Basel
d714dcef75 cgen: fix return of mut symtype (#13214) 2022-01-19 14:37:40 +02:00
Alexander Medvednikov
38d3239b50 checker: c2v fixes 2022-01-19 15:26:24 +03:00
playX
c48a9e71f5 math.unsigned: add uint128 tests (#13213) 2022-01-19 11:18:46 +02:00
jeffmikels
7a2705d8ce scanner: multibyte rune literals now support unicode, hex, and octal escape codes (#13140) 2022-01-19 03:23:25 +03:00
Tim Basel
bb6c46e1ef gen: fix mut sumtype arguments for fields (#13205) 2022-01-18 19:53:09 +02:00
Delyan Angelov
95b0c3789f docs: improve pub fn comments for the flag module 2022-01-18 18:38:27 +02:00
Delyan Angelov
1c5eb7ccdc ci: do not use pushd/popd in GNUmakefile 2022-01-18 17:42:29 +02:00
Delyan Angelov
6dfa11e2f7 make: improve diagnostic messages when the prebuilt tcc executable does not work/is missing 2022-01-18 17:36:05 +02:00
yuyi
ef562c92a5 cgen: fix assigning a new value to the mut sumtype receiver (#13204) 2022-01-18 16:16:15 +02:00
Delyan Angelov
91bfab79a5 docs: clarify TESTS.md 2022-01-18 14:57:46 +02:00
Delyan Angelov
40a5c5c1a0 parser: make the $tmpl subparser more robust. The legacy .html mode, is now ON, only for .html template files.
Implement a .simple default mode, with *minimum* heuristcs, and only
supporting expansion of @expressions, @include, @if, @else, @for, @end.

The existing .html mode, with its complex state transitions for html/js/css
and heuristics, is now used *only* for template files, that have the `.html`
extension.
2022-01-18 14:57:45 +02:00
yuyi
f0b7e5049b parser: check the receiver error of method call (#13203) 2022-01-18 12:47:06 +02:00
kahsa
1c4c430642 doc: replace 'property' to 'field' (#13200) 2022-01-18 11:35:43 +02:00
Delyan Angelov
d8263171ff math.mathutil: remove deprecated mathutil_test.v (workaround spurious test failures, due to same _test.v name) 2022-01-17 17:52:57 +02:00
yuyi
39f80840d7 checker: check type mismatch in args of generics method calls (fix #13193) (#13196) 2022-01-17 16:48:59 +02:00
Delyan Angelov
835484a953 ci: add libgc-dev to the v-apps-compile job 2022-01-17 16:39:30 +02:00
Delyan Angelov
4597c74d1a markused: fix v -gc boehm -skip-unused cmd/vls 2022-01-17 16:32:40 +02:00
trueFireblade
727c9fb4a1 all: add string range OrExpr (#13189) 2022-01-17 13:03:10 +03:00
Delyan Angelov
d1ac22e3bb math.unsigned: small fix after rename 2022-01-17 11:35:02 +02:00
yuyi
851f265a5e cgen: minor cleanup in match_expr() (#13192) 2022-01-17 11:26:20 +02:00
playX
8de1934f51 math: add an unsigned module, implementing Uint128, Uint256 and methods on them (#13186) 2022-01-17 11:23:21 +02:00
yuyi
31615d67c4 ast: fix typos in resolve_init() (#13191) 2022-01-17 11:00:57 +02:00
Hunam
db48594bd4 datatypes: add an index method on LinkedList and Queue (#13185) 2022-01-16 19:11:10 +02:00
Delyan Angelov
2a3a4cfc84 math.bits: fix bits.div_64 behaviour for leading_zeros_64(y) = 0 2022-01-16 18:11:23 +02:00
yuyi
315b2deda9 cgen: fix match sumtype var returning sumtype value (#13184) 2022-01-16 13:12:27 +02:00
Delyan Angelov
ab7cc5809a ci: vfmt cmd/tools/vpm.v 2022-01-15 18:02:58 +02:00
Delyan Angelov
f24e9cc80a help: fix -compress description 2022-01-15 17:32:02 +02:00
Delyan Angelov
d0bb810b42 vpm: fix v install GIT_REPO_URL 2022-01-15 16:38:03 +02:00
Delyan Angelov
57563599a7 vpm: support full urls in v.mod's dependencies field (#13180) 2022-01-15 14:35:37 +02:00
Delyan Angelov
6485b6eeb7 tests: skip valgrind tests, when valgrind is not present 2022-01-15 10:15:38 +02:00
yuyi
dfc23d939f ast, checker, cgen: fix array of sumtype initialisation with a default init: (#13178) 2022-01-15 09:59:38 +02:00
playX
7fe62a8b3e js,os: fix return in or blocks; Properly get path_delimiter and path_separator in JS (#13179) 2022-01-15 09:55:03 +02:00
trueFireblade
9fd65b5b18 checker: fix unrecognised empty argument names in anon fn's (#13176) 2022-01-15 08:23:30 +02:00
jeffmikels
f19197f9b0 builtin: make array.insert_many and array.prepend_many private (#13172) 2022-01-14 19:47:17 +02:00
yuyi
879d1d2f11 cgen: fix generics method with sumtype arguments (#13166) 2022-01-14 18:45:12 +02:00
playX
104e0c5692 js: fix break and continue in or blocks (#13165) 2022-01-14 18:43:18 +02:00
jeffmikels
9329b6c8c8 builtin: add more documentation (#13160) 2022-01-14 17:27:38 +02:00
yuyi
4660220f4c util: fix the potential error of js_builder command (#13170) 2022-01-14 15:49:24 +02:00
Delyan Angelov
6168a4d3a2 tools: improve diagnostic info for v vgret -v . 2022-01-14 15:18:40 +02:00
jeffmikels
70aedaf184 builtin: add a string.parse_int/2 method (wrapping strconv.parse_int/3) (#13164) 2022-01-14 00:31:11 +02:00
jeffmikels
4189b7e280 builtin: add a byterune method on []byte (#13145) 2022-01-13 22:26:17 +02:00
yuyi
155f897270 ast, parser, checker: fix generic struct field with default struct value (#13158) 2022-01-13 22:25:25 +02:00
Larpon
7fbd856bf8 os: add font module, move from gg (#13144) 2022-01-13 12:16:18 +02:00
jeffmikels
7882915409 tools: better error messages for v check-md (#13149) 2022-01-13 01:15:43 +02:00
yuyi
547169674d cgen: fix fn call with mut sumtype argument (#13143) 2022-01-12 18:36:19 +02:00
Delyan Angelov
b658b65774 scanner,cgen,vfmt: keep original when using byte char literals, test all 256 byte values in the C backend 2022-01-12 14:45:38 +02:00
yuyi
89165ed259 cgen: minor cleanup in comptime_if_cond() (#13142) 2022-01-12 11:40:11 +02:00
jeffmikels
f99b79480d cgen: reduce memory allocation and improve performance of cescape_nonascii (#13141) 2022-01-12 10:58:37 +02:00
Yuki Morota
c98af3c526 docs: adjust links (#13139) 2022-01-12 06:31:45 +02:00
jeffmikels
ab642cac43 scanner, cgen: improve support for escape codes in backticks/runes (#13127) 2022-01-11 22:36:18 +02:00
Ikko Ashimine
ea660315e0 examples: fix typo in text_editor.v (#13136) 2022-01-11 17:33:17 +02:00
Delyan Angelov
c27ffc6054 ci: vfmt fmt.v ... 2022-01-11 17:32:15 +02:00
yuyi
f3d8bbdf3d cgen: fix $if T.typ is Type { (#13135) 2022-01-11 16:25:16 +02:00
Tim Basel
10efe47f03 parser: add support for mutable if guards (#13132) 2022-01-11 15:32:58 +02:00
Delyan Angelov
ecc7accc8e tests: test with valgrind rune.bytes(), fix leak in .str_escaped() 2022-01-11 15:23:40 +02:00
Delyan Angelov
8acd84d04a builtin: reduce allocations in rune.bytes() 2022-01-11 15:23:39 +02:00
Ekopalypse
cb684b5c64 builtin: allow msvc users to link against a custom compiled Boehm library (#13133) 2022-01-11 15:23:21 +02:00
yuyi
1e52b2c134 cgen: fix cast in the index of reference fixed array (fix #13128) (#13131) 2022-01-11 10:55:29 +02:00
jeffmikels
078229f213 builtin: add a rune.bytes() convenience method (#13129) 2022-01-11 09:55:51 +02:00
yuyi
791972ebc9 checker: check error for match conditions with parenthesis (#13130) 2022-01-11 09:50:20 +02:00
Larpon
f54ad51946 tools: add support for ~ and absolute paths in vcomplete (#13125) 2022-01-10 21:50:39 +02:00
playX
65eb383cfd dlmalloc: add a temporary workaround for a segfault (#13120) 2022-01-10 15:54:23 +02:00
Delyan Angelov
da0b89cc57 tools: improve support for renamed v executables (vlang self now works too) 2022-01-10 15:45:28 +02:00
playX
c07ce3ff15 cgen,json2: improve -nofloat support (#13117) 2022-01-10 12:42:41 +02:00
yuyi
4ce6e663bf cgen: check error for comptime call method argument (#13115) 2022-01-10 12:03:50 +02:00
yuyi
02f791d9fe checker: fix returning optional empty map (#13113) 2022-01-10 09:12:46 +02:00
Charles WANG
7f1cc44b04 examples: detect windows and use correct file in the call_v_from_python example (#13114) 2022-01-10 09:11:54 +02:00
Saptak Bhoumik
5e85d4cb39 examples: show how to call a simple v module from python (#13105) 2022-01-09 19:53:36 +02:00
Larpon
535317eba3 ci: simplify vab_ci.yml (#13109) 2022-01-09 19:24:47 +02:00
yuyi
236a1d0255 cgen: fix error for print comptime for method call (#13108) 2022-01-09 19:00:23 +02:00
yuyi
0ac450927c checker: check array init with a void type value (#13106) 2022-01-09 16:53:37 +02:00
yuyi
86ba4517b1 parser: check error of anon fn argument type (#13103) 2022-01-09 16:15:34 +02:00
jeffmikels
5e5d62ed4c arrays,docs: remove arrays.zip; improve docs (#13082) 2022-01-09 16:12:33 +02:00
Larpon
05ec8ec15b tools: add help for v complete (#13098) 2022-01-09 16:09:10 +02:00
Larpon
b44b8c472d examples: use vmemset instead of C.memset (#13104) 2022-01-09 16:08:11 +02:00
kahsa
e2a0046849 net.html: add Tag.get_tags() (#13102) 2022-01-09 16:07:12 +02:00
penguindark
92fcb82ca3 sokol: fix for example06 (#13101) 2022-01-09 16:02:24 +02:00
penguindark
22fce6a525 sokol: update sokol_gfx.h to the LAST version, and fix example 06 (#13100) 2022-01-08 20:29:29 +02:00
yuyi
64c8fb061d ast: fix generics with nested generic type parameter (fix #13077) (#13088) 2022-01-08 19:19:45 +02:00
Ekopalypse
64028eedb8 toml: fix comment ends with crlf (#13097) 2022-01-08 19:16:32 +02:00
Delyan Angelov
70bf200e16 ci: pin sokol-shdc.exe version to latest working (after new commit to floooh/sokol-tools-bin/, shdc fails to compile gouraud.glsl) 2022-01-08 17:56:16 +02:00
688862
83e9585d06 crypto: crypto.aes CBC mode moves to crypto.cipher (#13084) 2022-01-08 17:08:46 +02:00
Delyan Angelov
b778c1d097 net: make listen/bind errors more informative 2022-01-08 17:02:03 +02:00
Ken
9cbfa882e6 ast: support attributes for ast.SumType (#13010) 2022-01-08 17:35:10 +03:00
playX
4d166e3b55 all: add support for -os wasm32 (needs clang-12 installed for now) (#13094) 2022-01-08 11:06:32 +02:00
Delyan Angelov
ec55c0fcd2 docs: add vlib/builtin/wasm_bare to vlib/.vdocignore 2022-01-08 09:25:38 +02:00
playX
ac7e79ffd2 dlmalloc: fix WASM codegen bug (#13090) 2022-01-08 08:40:23 +02:00
Delyan Angelov
95f6bd7fca tools: change default for v complete (autodetect shell) 2022-01-07 23:36:42 +02:00
Delyan Angelov
bb6aabd430 docs: update section about antivirus false positives 2022-01-07 21:18:47 +02:00
Larpon
5cffa1a2e4 sokol: use V type for SG_SHADERSTAGE_[VS|FS] (#13086) 2022-01-07 19:52:44 +02:00
Delyan Angelov
5717066147 ci: fix $tmpl regression detected by gitly tests (after a73e146) 2022-01-07 19:19:31 +02:00
Larpon
3e9c1c1a3a sokol: rename sapp consts, remove sapp prefix (#13083) 2022-01-07 18:01:07 +02:00
Larpon
17911432b9 android: fix and test compilation to raw Android C code (#13080) 2022-01-07 16:57:05 +02:00
Artem
a73e1462f0 tmpl.v: fix of is_html_open_tag function and allow usage of V template sign '@' in JS code (#13067) 2022-01-07 14:31:32 +02:00
Delyan Angelov
d3317cbd4f tests: rename reference_var_followed_block_expr.v to reference_var_followed_block_expr_test.v 2022-01-07 14:11:53 +02:00
Delyan Angelov
571aa1bac9 tests: rename go_wait_with_fn_of_interface_para.v to go_wait_with_fn_of_interface_parameter_test.v 2022-01-07 14:08:44 +02:00
Delyan Angelov
26c63461f4 tests: rename testcase_leak.v to testcase_leak.vv 2022-01-07 14:05:46 +02:00
688862
2b42ea9883 crypto: add a crypto.des module (#13065) 2022-01-07 13:51:37 +02:00
Larpon
7276705684 checker: add support for apk comptime if (#13079) 2022-01-07 13:38:21 +02:00
jeffmikels
6e6d51a1c9 docs: add more documentation to each of the modules in vlib (#13043) 2022-01-07 13:28:50 +02:00
playX
287331bc19 builtin: add builtin/wasm_bare (#13078) 2022-01-07 13:16:06 +02:00
yuyi
c9d8fecc75 cgen: fix string range index in for mut var in (#13076) 2022-01-07 13:00:48 +02:00
yuyi
5bc72c9c01 cgen: fix comptime call in fn call (#13075) 2022-01-07 12:59:27 +02:00
Ken
7dc64de360 checker: fix error for cast to u8 (#13072) 2022-01-07 12:54:11 +02:00
Delyan Angelov
60527a5655 ci: run vfmt over cast_to_u8_test.v 2022-01-06 18:41:52 +02:00
yuyi
1c382ad2b4 checker: fix error for cast to u8 (#13058) 2022-01-06 18:36:31 +02:00
yuyi
1654d8b810 checker: fix generics with nested generic fn inst call (#13059) 2022-01-06 18:33:37 +02:00
Larpon
6dca022caf sokol: fix missing import in sfons. Fixes #13061 (#13062) 2022-01-06 18:21:41 +02:00
Delyan Angelov
8088f462c9 parser: fix parsers producing codegen statements (for [flag] enum MyEnum{}) with mixed scope 2022-01-06 18:02:52 +02:00
Larpon
214853c373 sokol: small fixes to screenshot functions and docs (#13055) 2022-01-06 14:11:40 +02:00
playX
ec91de3504 builtin: use dlmalloc for -freestanding (#13054) 2022-01-06 14:10:37 +02:00
yuyi
fb66ec7cfb cgen: fix codegen for aliases of fixed arrays of structs (fix #13037) (#13049) 2022-01-06 11:54:22 +02:00
kahsa
fca699a439 net: add address_android.c.v to fix compilation for Android (#13052) 2022-01-06 11:48:30 +02:00
kahsa
075cd29c14 sqlite: add busy_timeout() (#13053) 2022-01-06 11:47:20 +02:00
Delyan Angelov
c97f0c59d1 tools: generate index.html instead of .html for v doc -m -f html . 2022-01-06 04:06:33 +02:00
Larpon
3ae4513e2e sokol: update to floooh/sokol from 27-Dec-2021 (4ff3ed7) (#13044) 2022-01-05 18:23:14 +02:00
playX
70a0aab72b vlib: add a dlmalloc module (#12974) 2022-01-05 18:17:47 +02:00
jeffmikels
a60b381d5e docs: adding skeleton README.md files for all vlib modules (#13034) 2022-01-05 18:06:08 +02:00
Delyan Angelov
59357e873d math: move the math.mathutil generic min/max/abs fns to math (#13042) 2022-01-05 18:02:20 +02:00
spaceface
de711da774 cgen: support larger closure parameters (#13040) 2022-01-05 16:22:20 +02:00
Tim Basel
897bbb7da5 cgen: fix cgen removing random chars from parameter_name (#13038) 2022-01-05 13:06:06 +02:00
Delyan Angelov
d3489d4246 builtin: s.trim_prefix/1 -> s.trim_string_left/1, s.trim_suffix/1 -> s.trim_string_right/1 2022-01-05 12:49:22 +02:00
Delyan Angelov
57fa9768d5 checker: update error message for if 'a' in 'abcd' { 2022-01-05 12:21:17 +02:00
yuyi
ba9aad1d92 checker: fix cast to byte in comptime if (#13036) 2022-01-05 09:27:10 +02:00
Delyan Angelov
89ac2a37c5 checker: add error for for x in t {, where t.next() returns multiple values
(Fix #9459).
2022-01-05 00:46:44 +02:00
Delyan Angelov
b3930c3d6a checker: add error for .map() calling a fn with multiple return values (prevent inaccessible tuple leak) 2022-01-04 23:10:58 +02:00
yuyi
6c1ae4f689 ast: simplify mktyp() (#13028) 2022-01-04 18:37:18 +02:00
Delyan Angelov
0f01236e52 strconv: fix assert .f64() == 0 2022-01-04 17:51:48 +02:00
yuyi
b2538e83da checker: fix generic fn using generic type in if expr (#13027) 2022-01-04 16:04:15 +02:00
yuyi
b94c5c2a9c ast: fix fn_type_signature for anon functions with alias arguments (#13024) 2022-01-04 16:02:53 +02:00
yuyi
054bb272df cgen: fix const fixed array of reference var using correct pointer (#13023) 2022-01-04 11:34:07 +02:00
Alexander Medvednikov
59ed4be49a all: update copyright year 2022-01-04 12:21:12 +03:00
Delyan Angelov
feadf777c3 builder: fix a bug in error_context_lines 2022-01-04 10:59:39 +02:00
yuyi
00a0c1886e ast, cgen: fix const fixed array of reference value (#13022) 2022-01-04 11:36:29 +03:00
pancake
4b55800ffd v.eval: add tests and fix runtime cast crash (#13019) 2022-01-03 18:30:42 +02:00
Delyan Angelov
89d92d536a docs: document the v.exe -> vlang.exe workaround for Symantec's paranoia 2022-01-03 18:06:03 +02:00
yuyi
da989e19ca net: fix errors of new_ip(), new_ip6() and ip6.str() (#13020) 2022-01-03 15:10:15 +02:00
Larpon
88a973b617 sokol: type alias all sgl structs, support sgl_context (#13018) 2022-01-03 15:05:24 +02:00
Delyan Angelov
9974495f5e ci: install libgc-dev in toml_ci.yml too 2022-01-03 15:03:43 +02:00
Delyan Angelov
e03d52d322 toml: improve SKIP reporting, fix formatting 2022-01-03 13:25:06 +02:00
Delyan Angelov
ee858568ff toml: ignore CRLF just like LF in line comments, support VTEST_HIDE_OK=1 in tests. 2022-01-03 12:54:16 +02:00
Delyan Angelov
b4111451bf ci: fix alexcrichton/toml-rs task in toml_ci.yml 2022-01-03 11:15:42 +02:00
Delyan Angelov
3aba840af1 ci: show jq version in toml_ci.yml 2022-01-03 10:52:34 +02:00
yuyi
d5b111ec99 net: fix typo in new_ip() (#13017) 2022-01-03 08:45:26 +02:00
penguindark
1ad4fbd841 regex: add a replace_n function (#13016) 2022-01-03 06:32:24 +02:00
Larpon
4d4398fa8a sokol: type alias all gfx structs (#13014) 2022-01-02 20:36:01 +02:00
Delyan Angelov
41e763f79c checker: add error for type StructAlias = Struct struct Struct { field StructAlias } 2022-01-02 15:54:40 +02:00
yuyi
64f1ea6fe9 checker: extract containers.v, struct.v, for.v from checker.v (#13012) 2022-01-02 15:52:19 +02:00
Delyan Angelov
41078bc438 v.eval: fix hardcoded math ops in infix_gen.v, add interpret_test.v 2022-01-02 10:33:21 +02:00
Delyan Angelov
1521d08e84 eval: ignore ast.Module (fixes v interpret file.v regression after 07cf6d9) 2022-01-02 10:09:50 +02:00
Delyan Angelov
9278d4ec19 docs: fix a typo 2022-01-02 09:18:24 +02:00
Alexander Medvednikov
0e1cfd4a28 checker: simplify type sizeof check and fix c2v globals 2022-01-01 19:56:13 +03:00
Delyan Angelov
697eca5ddf tools: ensure git is installed, when doing vpm operations that require it 2022-01-01 15:40:19 +02:00
penguindark
908296cdfb regex: improve errors for edge cases (#13008)
* code cleaning, added more clear errors for dots and ORs

* added failed match index for better find functions, updated tests

* added index in match failed, updated tests

* test cleaning

* test check
2022-01-01 09:21:27 +02:00
pancake
7b4ba66720 js: use JS.String instead of string in builtin javascript functions (#13004) 2022-01-01 09:17:08 +02:00
yuyi
7622ff3f54 checker: check using const var as function (#13006) 2022-01-01 09:15:43 +02:00
yuyi
6438512529 checker: add error for for mut var in string { (fix #12998) (#13000) 2021-12-31 09:54:06 +02:00
yuyi
a0a1807e2b builtin: add charptr str() and change string format (#12973) 2021-12-30 23:34:24 +03:00
Delyan Angelov
b10ff1e41b checker: infer generic interface type in i := Interface(Struct<u32>{}) 2021-12-30 21:24:52 +02:00
Delyan Angelov
ae036b6146 checker: fix infinite recursion on generic interface cast 2021-12-30 19:28:42 +02:00
Delyan Angelov
df8384b62e v.scanner: report the start of unfinished string literals too 2021-12-30 18:29:52 +02:00
Delyan Angelov
93c40e696d all: add support for type MyEnumAlias = MyEnum 2021-12-30 13:42:06 +02:00
Delyan Angelov
bf9f684c59 ast: improve support for type aliases, in TypeSymbol.xyz_info methods 2021-12-30 13:17:10 +02:00
Delyan Angelov
7531f78f67 ast: remove const hack for global_table, use a proper global instead 2021-12-30 13:15:55 +02:00
yuyi
d421f28de4 checker: minor cleanup in cast_expr() (#12995) 2021-12-29 21:48:23 +02:00
Delyan Angelov
4114dd0815 v.builder: fix v -no-retry-compilation -cc tcc -usecache examples/tetris/ 2021-12-29 21:45:01 +02:00
Delyan Angelov
99fdcd2e71 v.builder: fix v -cc tcc -no-retry-compilation build-module vlib/sync/stdatomic 2021-12-29 21:32:30 +02:00
Delyan Angelov
ca5154747e cgen: fix v -usecache examples/news_fetcher.v on macos (.sort() compare_ functions duplication) 2021-12-29 20:15:51 +02:00
Delyan Angelov
537760edcd ci: fix failing macos job (do not test -usecache for now there) 2021-12-29 18:29:08 +02:00
Delyan Angelov
cb34309f6f cgen: fix chained ./v -usecache -o v cmd/v (and all other V programs that use maps) 2021-12-29 17:57:04 +02:00
yuyi
cc577e1bfb parser: check variable redefinition error (#12992) 2021-12-29 13:44:08 +02:00
Delyan Angelov
69c90ef50d hash.fnv1a: add generic fnv1a.sum64_struct/1 and fnv1a.sum32_struct/1 + tests 2021-12-29 12:03:24 +02:00
Delyan Angelov
7c78bf9466 hash.fnv1a: add fnv1a.sum64_bytes and fnv1a.sum32_bytes, add doc comments and tests 2021-12-29 11:27:26 +02:00
Delyan Angelov
9b8cf1ad37 markused: fix V compiler panics with -skip-unused, for code using generics 2021-12-29 09:48:13 +02:00
Hunam
5607cfbd32 datatypes: add a Queue.last() method (#12987) 2021-12-29 08:01:47 +02:00
penguindark
5e5529441c docs: document negative indexed slices, add example for a 'list comprehension' (#12986) 2021-12-28 22:29:11 +02:00
Delyan Angelov
43fee6b3d5 all: fix registration of methods with the same name on different generic structs 2021-12-28 21:42:48 +02:00
Delyan Angelov
730b2a9263 sync: move sync.atomic2 to sync.stdatomic, cleanup 2021-12-28 10:16:22 +02:00
yuyi
c1711b8f05 checker: check string cast to number (fix #12982) (#12983) 2021-12-28 07:55:39 +02:00
Alexander Medvednikov
6176ce9f03 all: c2v fixes 2021-12-28 08:00:56 +03:00
penguindark
dadc965082 regex: implement negation groups, more flexibility for bsls, small fixes (#12981)
* removed memory allocations in cleaning during clear calls

* first test implementation of negative groups, more flexibility for bsls

* fixed bsls failed tests

* fmt

* added \n to regex tests
2021-12-27 22:18:48 +02:00
Delyan Angelov
14648fa41e parser: reduce max_expr_level to 310 (due to more limited stack size on windows) 2021-12-27 20:21:58 +02:00
yuyi
34e175a343 checker: minor cleanup of the fns classification (#12977) 2021-12-27 13:11:10 +02:00
Delyan Angelov
a2eb90ee4e parser: prevent too deep recursions in p.check_undefined_variables 2021-12-27 12:30:17 +02:00
Toby Webb
35418b8413 cgen: fix compile error on locking interface value (#12883) 2021-12-26 20:01:00 +02:00
Delyan Angelov
c26e040d33 ci: bump retry count to 5 for tcp_test.v 2021-12-26 19:05:05 +02:00
yuyi
2e68af22d3 cgen: improve auto_str error messages (#12972) 2021-12-26 18:32:15 +02:00
yuyi
55d9c24063 ast: fix generic fn with multiple return (#12971) 2021-12-26 16:44:41 +02:00
Delyan Angelov
8a10dbcf27 vlib: rename adt to datatypes 2021-12-26 16:01:36 +02:00
Larpon
2210f89ea3 sokol: type alias all sapp structs (#12962) 2021-12-26 13:02:51 +02:00
pancake
04be2465dc cgen: check call argument on methods (#12965) 2021-12-26 11:53:56 +02:00
yuyi
3b5de71e60 builtin: add none str() (fix #12964) (#12967) 2021-12-26 11:41:51 +02:00
yuyi
03864e4ab8 checker: fix cast enum to alias (#12968) 2021-12-26 11:34:20 +02:00
Daniel Däschle
10f63b3cd7 cgen: remove "main" from inline sum type str (#12963) 2021-12-25 23:58:45 +03:00
Daniel Däschle
35282396ec all: inline sum types (#12912) 2021-12-25 18:26:40 +03:00
Miccah
485b392cb3 adt: implement a binary MinHeap data structure (#12956) 2021-12-25 12:03:50 +02:00
yuyi
8764a3a973 checker: check errors of cast to byte (#12961) 2021-12-25 11:34:15 +02:00
yuyi
d0ad79cd8b checker: fix generic array builtin method call (#12957) 2021-12-24 14:42:23 +02:00
yuyi
a83786d867 checker: minor cleanup in cast_expr() (#12954) 2021-12-24 11:38:27 +02:00
Miccah
d69d2c600b adt: implement a doubly linked list (#12950) 2021-12-24 11:19:40 +02:00
yuyi
c0dcd1a9a5 ast: fix reference of alias char type (#12951) 2021-12-24 11:11:20 +02:00
Ikko Ashimine
92bd55ded6 tests: fix typo in common.v (#12952) 2021-12-24 10:47:48 +02:00
Hunam
68452cff76 adt: add queue (#12941) 2021-12-23 18:57:15 +02:00
Hunam
54a6973548 adt: add linked list (#12937) 2021-12-23 18:23:04 +02:00
Delyan Angelov
fa2de89db9 orm: do not order by default, ordering is slow; also fix a bug for tables without defined primary keys 2021-12-23 16:43:22 +02:00
Hunam
d7deda5078 vlib: add an adt module (Abstract Data Types) (#12901) 2021-12-23 15:16:29 +02:00
yuyi
d4f28c88b3 checker: minor cleanup in the checker.v (#12945) 2021-12-23 15:02:09 +02:00
Benjamin Stigsen
546c388b02 gg: renaming drawing functions (#12913) 2021-12-23 13:31:25 +02:00
yuyi
ad1ef6a9e2 cgen: fix map get assign blank var with optional (#12943) 2021-12-23 13:04:36 +02:00
Delyan Angelov
b88a40ad80 ci: cleanup and fix sdl_ci.yml 2021-12-23 13:01:38 +02:00
playX
a2468e1e0c js,os: fix integer arithmetic; add Process.close() and os.is_readable() for VJS; Make tetris run on JS backend (#12940) 2021-12-23 11:36:42 +02:00
yuyi
d3ccdfd75c cgen: fix channel of sumtype (#12938) 2021-12-23 11:26:15 +02:00
lydiandy
b4723c18fc cmd: update vast -t help text (#12939) 2021-12-23 11:23:35 +02:00
Delyan Angelov
db1175e455 parser: handle [noreturn] on methods too 2021-12-22 19:58:37 +02:00
yuyi
1028f0b59e fmt: fix error of generic struct_init using module (fix #12893) (#12935) 2021-12-22 19:11:09 +02:00
Delyan Angelov
86719c5de9 tools: update vast to latest V 2021-12-22 18:13:29 +02:00
Delyan Angelov
e256f1b2aa checker,cgen: stabilise generic method handling (fix a source code ordering issue) 2021-12-22 18:03:46 +02:00
Larpon
b3161b05a3 ci: add sdl workflow for testing vlang/sdl (#12934) 2021-12-22 17:52:47 +02:00
penguindark
278c08704c all: support slices with negative indexes #[start..end] (gated arrays) (#12914) 2021-12-22 16:34:02 +03:00
playX
2b9f993574 gg: add text rendering, keyboard event handling for JS and other fixes (#12932) 2021-12-22 12:26:52 +02:00
yuyi
6eb44f472a cgen: fix multiple return with sumtype (#12930) 2021-12-22 12:09:08 +02:00
yuyi
6a4fa6096e cgen: fix blank ident in for_c_stmt (#12931) 2021-12-22 09:34:26 +02:00
pancake
cb65f2ff44 js: generate es5 methods for valueOf() and toString() (#12928)
Co-authored-by: pancake <pancake@nopcode.org>
2021-12-22 09:20:45 +02:00
zakuro
2693631643 parser: make codegen generate correct module name (#12929) 2021-12-22 10:55:57 +11:00
spaceface
cfb814a0e3 gen: support returning large types from closures on amd64 (#12926) 2021-12-22 00:18:45 +02:00
Delyan Angelov
7b4d83660a examples: reduce progress update rate for path_tracing.v (less string interpolations/mallocs) 2021-12-21 23:43:13 +02:00
playX
b68c217d53 js: remove usage of default arguments for -es5 flag (#12921) 2021-12-21 20:23:40 +02:00
joe-conigliaro
07cf6d9f96 parser/scanner: make codegen impl use own parser. closes #12857 (#12925) 2021-12-21 19:48:06 +02:00
yuyi
fc83f0bfd0 cgen: clean up gen_assign_stmt() (#12915) 2021-12-21 19:23:55 +02:00
Delyan Angelov
5ee5f92cda ci: use github.sha instead of github.ref, so CI runs on master are not canceled early 2021-12-21 19:18:59 +02:00
yuyi
de3665af69 cgen: fix interface method using struct embed (#12924) 2021-12-21 19:16:05 +02:00
Delyan Angelov
794bdfdca7 ci: use concurrency.cancel-in-progress 2021-12-21 19:10:43 +02:00
Delyan Angelov
88435eb769 examples: avoid using go game.run() in Tetris 2021-12-21 16:54:26 +02:00
playX
ade14491d4 gg: add event handling for mouse down/up and mouse leave/out on VJS (#12917) 2021-12-21 12:31:29 +02:00
Delyan Angelov
cc2fcb52d6 tests: fix the shown number of jobs for the test summary 2021-12-21 02:51:26 +02:00
Delyan Angelov
ed2d1286da help: improve v help test 2021-12-20 19:53:39 +02:00
yuyi
460f7c6637 cgen: fix fixed array of interfaces equality (#12908) 2021-12-20 19:09:22 +02:00
yuyi
9f7d71d338 ci: fix ci error of vls build (#12909) 2021-12-20 19:08:22 +02:00
Delyan Angelov
68ada041e6 tests: support VTEST_ONLY_FN=*test_sincos* ./v test . and ./v test -run-only test_sin . 2021-12-20 18:45:04 +02:00
playX
5f0160bf11 js,gg: more work on porting gg to JS backend (#12903) 2021-12-20 16:18:21 +03:00
Delyan Angelov
f81654e3a7 builtin: add s.match_glob(wildcard_pattern) 2021-12-20 14:17:08 +02:00
yuyi
7c85c2ab1f checker: fix error of map selector assign (#12902) 2021-12-20 08:09:15 +02:00
Miccah
d07975335d time: add Duration.str() (#12897)
* time: add str() method to Duration

* add Duration.str tests, move time.infinite to time.v, to be visible to the JS backend

Co-authored-by: Delyan Angelov <delian66@gmail.com>
2021-12-19 19:32:42 +02:00
Delyan Angelov
840a92c14e v.builder: change the default stack size for apps produced by MSVC to 16MB 2021-12-19 18:40:29 +02:00
yuyi
cd0b581445 ast: rename 'table.get_type_symbol()' to 'table.sym()' and more related calls (#12898) 2021-12-19 18:25:18 +02:00
yuyi
c957f59071 cgen: minor cleanup in cgen.v (#12896) 2021-12-19 14:31:04 +02:00
Delyan Angelov
41176c4967 cgen: add bool and complex to c_reserved 2021-12-19 13:44:54 +02:00
Leo Developer
a7019ac86c cgen: fix parallel waiter function generation (#12895) 2021-12-19 13:38:48 +02:00
yuyi
2ab861ef89 cgen: fix generic array of interface method call (fix #12882) (#12888) 2021-12-18 18:08:19 +02:00
yuyi
5e5c78ed37 cgen: minor cleanup of the field order in the Gen struct definition (#12890) 2021-12-18 17:52:33 +02:00
spaceface
de92f819f0 cgen: support closures with any number of parameters of any size on amd64 (#12891) 2021-12-18 17:33:24 +02:00
Benjamin Stigsen
3a504480d9 gg: add draw_arc_empty (#12887) 2021-12-18 12:39:14 +02:00
Sandro Martini
80995f3a2d log: improve logging interface (#12886) 2021-12-18 12:38:43 +02:00
Delyan Angelov
927eecf7c0 ci: retry more return_in_lock_test.v 2021-12-18 10:19:13 +02:00
yuyi
7c255f0ff2 builtin, cgen: fix array of map init with default value (#12885) 2021-12-18 10:07:25 +02:00
ChAoS_UnItY
50d988ebc7 v.parser: forbid unsupported language functions/types in specific backends (#12655) 2021-12-18 10:00:31 +02:00
Benjamin Stigsen
75830f1fe3 gg: add draw_ellipse_filled() + draw_ellipse_empty() APIs (#12869) 2021-12-17 21:19:18 +02:00
pancake
08766da7e8 js: dont use async js_main in '-es5' mode (#12870) 2021-12-17 16:37:19 +02:00
Subhomoy Haldar
4ecdb28f5a tools: add .gitattributes with v init and v new(#12879) 2021-12-17 16:11:19 +02:00
Tim Basel
130d189fce cgen: fix overwriting methods of embedded structs + empty struct for interfaces (#12876) 2021-12-17 15:32:31 +02:00
playX
b482da74e9 gg: move code using C types to c.v files, add js.v files (#12873) 2021-12-17 15:22:09 +02:00
yuyi
66070ec63e cgen: fix error of 'map_a[map_b[key]] += 2' (#12872) 2021-12-17 15:17:08 +02:00
yuyi
c9f6a96936 cgen: fix array of interfaces equality error (#12874) 2021-12-17 14:58:17 +02:00
spaceface
d80dd77adf cgen: support closures on arm32 as well (#12875) 2021-12-17 14:26:24 +02:00
zakuro
e5e3979e45 fmt: fix removal of selective imported types used in type decl (#12868) 2021-12-17 05:20:16 +02:00
zakuro
2f7ac7e407 cgen: fix c error when use reserved keyword as if guard var (#12871) 2021-12-17 04:50:52 +02:00
yuyi
f87f8ec3f7 cgen: fix defer with function variables (fix #12854) (#12866) 2021-12-16 20:58:54 +02:00
Delyan Angelov
5f1eaaf3b1 ci: retry more channel_select_6_test.v 2021-12-16 20:12:40 +02:00
spaceface
c6b902d2b7 cgen: support closures on arm64 (#12863) 2021-12-16 18:02:05 +02:00
spaceface
8a34fb7857 ci: run the full V test suite on arm64 (#12865) 2021-12-16 17:44:21 +02:00
Delyan Angelov
6ff953d936 preludes,builder,cgen: add support for VTEST_RUNNER=tap and -test-runner tap (#12523) 2021-12-16 15:59:46 +02:00
Delyan Angelov
caac89d6ca checker: fix function x is private error in main, for pub const abc = x() in a (sub)module 2021-12-16 12:03:49 +02:00
yuyi
674f99a658 checker: minor clean up in comptime_call() (#12860) 2021-12-16 11:47:47 +03:00
yuyi
d8a333058d checker, cgen: fix generic map with generic type key (#12859) 2021-12-16 09:53:05 +02:00
Delyan Angelov
1261468d8e ci: fix failed windows-msvc task (sokol examples) 2021-12-15 20:18:45 +02:00
Benjamin Stigsen
d90ef1f29f gg: draw_arc fixes (#12827) 2021-12-15 21:17:07 +03:00
yuyi
c44115c67d checker: fix goto label with comptime tmpl (#12853) 2021-12-15 18:48:43 +02:00
Delyan Angelov
2b981b011e ast: fix bug in parsing -Isomething -Danother from #flag and #pkgconfig directives 2021-12-15 17:55:52 +02:00
spaceface
65f12f3217 checker: fix invalid cast warning for flag enums (#12848) 2021-12-15 16:58:25 +02:00
playX
11d2b8b354 js: support -es5 flag (#12846) 2021-12-15 15:47:34 +02:00
Delyan Angelov
df7f2aa8a3 all: support [markused] tags for fns/consts/globals 2021-12-15 14:34:49 +02:00
Delyan Angelov
1a6899e85e cgen: fix building with -no-preludes -no-builtin -skip-unused (part 2) 2021-12-15 13:30:21 +02:00
yuyi
2ce1647ea0 cgen: fix error of embedded struct generating interface_table (#12847) 2021-12-15 13:21:21 +02:00
Delyan Angelov
fa1a7a85f0 cgen: fix building with -no-preludes -no-builtin (part 1) 2021-12-15 12:47:28 +02:00
Larpon
1d41d9daf9 json2: improve readability, add tests utilizing fix #12667 (#12836) 2021-12-15 12:20:05 +02:00
spaceface
5b5d0bbb9c ci: ensure that V can be built on arm64 using tcc (#12841) 2021-12-15 11:17:25 +02:00
spaceface
d13fe7843c v: fix build and failing tests on arm64 (#12840) 2021-12-15 09:00:38 +02:00
yuyi
1c629f4a93 cgen: fix ci error of empty struct init (#12838) 2021-12-15 08:49:30 +02:00
Delyan Angelov
6079448f35 tools: unset VCOLORS before producing reports with v bug 2021-12-14 17:35:03 +02:00
Delyan Angelov
c900dc1053 ci: use -Wno-excess-initializers for clang -cstrict, cleanup cgen 2021-12-14 17:14:45 +02:00
Delyan Angelov
96e9cc62b0 ci: fix clang macos build 2021-12-14 17:06:57 +02:00
Delyan Angelov
70564ae8b2 ci: fix generics test 2021-12-14 17:04:37 +02:00
Delyan Angelov
73e097c1cb Revert "ci: fix clang build error on macos/freebsd"
This reverts commit d7abdd314d.
2021-12-14 16:57:47 +02:00
pancake
a1efde8b10 v: list all js backends in v help build-js (#12835) 2021-12-14 15:42:14 +02:00
Delyan Angelov
d7abdd314d ci: fix clang build error on macos/freebsd 2021-12-14 15:39:08 +02:00
yuyi
eeb7d4a7fd cgen: fix embedded struct init with complex fields (#12831) 2021-12-14 14:55:58 +02:00
Thomas Mangin
99f14a7ead transformer: only enable array optimisation with -prod (#12833) 2021-12-14 13:05:54 +02:00
Delyan Angelov
5365984ef5 ci: use powershell Compress-Archive instead of zip in binary_artifact.yml 2021-12-14 12:20:20 +02:00
Delyan Angelov
2f99022f0f ci: simplify and cleanup binary_artifact.yml 2021-12-14 11:10:46 +02:00
zakuro
eed882950c fmt: remove extra comma of branch instead of parse error (#12814) 2021-12-14 08:14:43 +02:00
yuyi
731015cd9b ci: revert "cgen: fix embedded struct init with complex fields (fix #12823) (#12825)" (#12830)
This reverts commit b4b2a21453.
2021-12-14 08:11:11 +02:00
yuyi
b4b2a21453 cgen: fix embedded struct init with complex fields (fix #12823) (#12825) 2021-12-14 07:15:23 +03:00
Larpon
2a5356670b toml: add as_strings() method to map of Any (#12824) 2021-12-13 21:43:33 +02:00
Benjamin Stigsen
76f6f99bce gg: add draw_ring() (#12817) 2021-12-13 21:03:42 +02:00
Larpon
b1a9bf29db vgret: add support for config via toml and root path (#12821) 2021-12-13 20:58:31 +02:00
playX
cb4c67588c os: add support for signal handling on JS backend (#12818) 2021-12-13 20:18:12 +02:00
yuyi
d5c0bdf954 cgen: clean up interface_table() (#12816) 2021-12-13 13:45:27 +02:00
yuyi
be5823069a cgen: clean up struct_init (#12815) 2021-12-13 13:01:36 +02:00
yuyi
b303588491 cgen: fix struct init with interface field (#12820) 2021-12-13 12:55:46 +02:00
Delyan Angelov
3afbb9e90a all: split all backends into cmd/tools/builders (#12811) 2021-12-12 22:10:43 +03:00
yuyi
57c1faadbe cgen: fix multiple nested embed struct with duplicate field init (#12805) 2021-12-12 19:54:29 +02:00
yuyi
f407d6de02 ast, checker, cgen: fix generics multiple type comptime call (fix #12777) (#12806) 2021-12-12 19:42:40 +02:00
Benjamin Stigsen
ab6e93394f gg: add draw_empty_triangle() (#12804) 2021-12-12 19:41:27 +02:00
Leo Developer
8c1c70db04 checker: fix x.$(field.name) not working outside of $if (#12802) 2021-12-12 03:18:29 +02:00
Delyan Angelov
bf835d47d8 tools: fix v build-examples on windows 2021-12-12 01:20:21 +02:00
Delyan Angelov
79de408ef0 parser,checker: support [generated] module xyz (turns off notices). Use it for infix.v. 2021-12-12 00:58:38 +02:00
Delyan Angelov
9b7a50b1a2 v: split the interpreter to cmd/tools/vinterpret.v 2021-12-12 00:06:44 +02:00
Delyan Angelov
adf353702e v.eval: show sumtype or interface casts return void currently only with -v 2021-12-11 23:45:54 +02:00
Delyan Angelov
23be53e2de tools: build examples/viewer as a project folder 2021-12-11 23:20:08 +02:00
penguindark
d3b769d1bc examples: add an image viewer program (#12797) 2021-12-11 22:18:03 +02:00
Subhomoy Haldar
f0969698e2 cmd: add v bump (#12798) 2021-12-11 22:17:01 +02:00
Leo Developer
2ced182816 cgen: fix order of comptime reflection fields (#12799) 2021-12-11 22:09:47 +02:00
Thomas Mangin
0d0d7323bb transformer: provide direct_memory_access to arrays when safe (#12724) 2021-12-11 21:55:46 +02:00
Delyan Angelov
fe14e2fceb cgen: use c_name() for escaping goto label names too 2021-12-11 19:41:44 +02:00
Wertzui123
9e68a03f94 math: rename small to small_ to prevent C errors (workaround unescaped C labels) (#12796) 2021-12-11 19:35:40 +02:00
Delyan Angelov
24bc2ae406 cgen: add small to c_reserved 2021-12-11 19:14:26 +02:00
Delyan Angelov
cde0cbd5ad ci: fix failing tests-sanitize-address-clang step for vlib/toml/tests/spaced_keys_test.v 2021-12-11 19:03:47 +02:00
Delyan Angelov
b3287f8159 Revert "v.scanner: reduce memory consumption for Scanner.ident_name"
This reverts commit b18cd37e59.
2021-12-11 17:10:01 +02:00
Delyan Angelov
b18cd37e59 v.scanner: reduce memory consumption for Scanner.ident_name 2021-12-11 16:38:20 +02:00
Larpon
ba06eba39c toml: fix implicit allocation overwrite of existing table (#12793) 2021-12-11 15:21:46 +02:00
Leo Developer
9bf777c1ee vfmt: fix eating .zlib in $embed_file('v.png', .zlib) (#12794) 2021-12-11 15:21:26 +02:00
yuyi
7c7cdf8ce7 builtin: clean up array.v (#12784) 2021-12-11 11:17:00 +03:00
Alexander Medvednikov
a58c539ee6 checker: minor fixes 2021-12-11 10:56:37 +03:00
Alexander Medvednikov
19a47abcca checker: split up checker.v: fn.v, if.v, interface.v, match.v, return.v 2021-12-11 10:51:01 +03:00
Alexander Medvednikov
ee6c0a0691 checker: split up checker.v: fn.v, if.v, interface.v, match.v 2021-12-11 10:48:07 +03:00
Larpon
ea1f398f90 ci: add gfx_ci utilizing vgret (#12785) 2021-12-11 10:30:06 +03:00
yuyi
feb12b62dc tests: correct test file name (#12787) 2021-12-11 10:28:44 +03:00
yuyi
ade2a4cd01 cgen: fix multiple embed struct init (#12791) 2021-12-11 10:28:32 +03:00
Alexander Medvednikov
eaf0f9b4c1 checker: split up checker.v: assign.v, orm.v, comptime.v; c2v fixes 2021-12-11 10:23:58 +03:00
yuyi
ed4ecae57d checker: fix notice of eval.infix.v on windows (#12770) 2021-12-10 15:28:32 +02:00
yuyi
9b4329d2f6 ast, checker, cgen: fix interface method with struct embed (#12783) 2021-12-10 14:56:13 +02:00
playX
b116170735 js: add support for Promise.wait() (#12781)
* builtin/js: Change Promise<T,E> to Promise<T>

* js: codegen support for Promise.wait()

* checker: checker support for Promise.wait()
2021-12-10 14:54:20 +02:00
yuyi
7fc9e614a3 ast, parser, checker: fix generic fn in builtin module (#12769) 2021-12-09 21:37:43 +02:00
Larpon
dbe67c688f tools: add a v gret command to aid detecting visual regressions in gg based apps (#12775) 2021-12-09 21:31:55 +02:00
Subhomoy Haldar
4c95127cbc semver: add a Version.str() method with unit tests (#12779) 2021-12-09 21:25:55 +02:00
Alexander Medvednikov
8f9f681e81 checker: move check_types() on top; small c2v fixes 2021-12-09 05:44:41 +03:00
Delyan Angelov
0021fbbaa9 gg: support VGG_STOP_AT_FRAME=120 VGG_SCREENSHOT_FOLDER=. VGG_SCREENSHOT_FRAMES=10,20,30 ./v -d gg_record run examples/gg/bezier_anim.v (#12767) 2021-12-08 22:38:33 +02:00
zakuro
85f3372a32 readline: fix bug that full-width spaces are treated as eof (#12763) 2021-12-08 22:35:21 +02:00
zakuro
7379488cee fmt: fix bug that adds unnecessary module name to generic types (#12758) 2021-12-08 22:33:58 +02:00
yuyi
d88e67a5ec checker: fix const type with raw string literal (#12761) 2021-12-08 22:28:55 +02:00
Larpon
cd96f980cc v complete: add recent additions to cmd/tools, sort list (#12762) 2021-12-08 22:27:07 +02:00
Delyan Angelov
b1622c74b9 net.openssl: fix compilation of vpm.v on FreeBSD 2021-12-08 10:50:24 +02:00
yuyi
e433badcb8 parser, cgen: fix multiple comptime tmpl in one function (#12757) 2021-12-08 11:12:02 +03:00
crthpl
2fbf7fea75 all: initial interpreter code (#12605) 2021-12-08 11:09:10 +03:00
Delyan Angelov
525791fa3a tests: mark semaphore_timed_test.v with vtest retry: 3 2021-12-08 01:09:58 +02:00
penguindark
7a0b63e795 stbi: add image writing functions (#12754) 2021-12-08 00:31:37 +02:00
Ekopalypse
a19dd36473 cgen: ensure the different gdi32 notations are always matched in is_gui_app (#12756) 2021-12-07 22:13:56 +02:00
Jordan Bonecutter
fd4e071621 net.openssl: use a pkgconfig directive, instead of a hardcoded path (#12735) 2021-12-07 22:11:47 +02:00
Delyan Angelov
7bbc70820a tools: make v test vlib and v test-self skip _test.js.v files, when node is not installed 2021-12-07 21:31:29 +02:00
yuyi
c29a3cf6e8 parser: fix (absolute path) error (#12747) 2021-12-07 11:33:53 +02:00
yuyi
f60cf65284 cgen: fix comptime for_in methods call using str_intp (#12746) 2021-12-07 12:12:12 +03:00
playX
1cb06a2de4 js: ast.GoExpr support using promises on JS backend (#12749) 2021-12-07 12:11:54 +03:00
Tim Basel
c23ebec944 parser: support bool values in attributes (#12750) 2021-12-07 12:11:29 +03:00
Delyan Angelov
f86af7237f stbi: add a link_to_libm.c.v helper, to ensure import stbi works always. 2021-12-07 10:16:07 +02:00
Tim Basel
6d14275106 parser: support dot prefix for attributes (#12744) 2021-12-07 01:32:29 +03:00
yuyi
36fbd3c4fa checker: check sumtype as mismatched type (#12743) 2021-12-07 01:31:47 +03:00
Toby Webb
ef16a8ec54 vweb: add json_pretty method (#12745) 2021-12-07 01:31:17 +03:00
Larpon
047f059fb8 examples: use fontstash wrapper calls (#12718) 2021-12-06 23:39:43 +03:00
Delyan Angelov
1cd703d96b fontstash: use #flag darwin -I/usr/local/Cellar/freetype/2.10.2/include/freetype2 2021-12-06 19:08:50 +02:00
Alexander Medvednikov
325e116b7a cgen: 4 byte bool flagg for compatibility with some C software 2021-12-06 12:36:25 +03:00
Toby Webb
09955b7ce8 net.websocket: fix server not listening for IPv4 (#12717) 2021-12-06 11:10:25 +02:00
yuyi
d85111e3dd cgen: fix comptime for_in methods call (#12741) 2021-12-06 10:55:27 +02:00
Delyan Angelov
3ab82a23c5 tools: cleanup the output of V, compiled with -d trace_parser and -d trace_checker 2021-12-06 09:54:53 +02:00
penguindark
89eb5425cd examples: clean file path usage in the examples, move all the fonts in the common assets folder (#12736) 2021-12-06 09:53:46 +02:00
Delyan Angelov
6f5d952d8f tools: implement v ast -t file.v (terse mode) (#12734) 2021-12-06 09:50:44 +02:00
lydiandy
3b7e7c9c46 tools: update vast to latest V (#12733) 2021-12-05 19:45:51 +02:00
Taillook
7d1dec5b44 sync: add sync.ManyTimes (#12729) 2021-12-05 19:44:25 +02:00
yuyi
ae2ae6e6fd cgen: fix match sumtype var aggregate str_intp error (#12732) 2021-12-05 19:21:45 +02:00
Taillook
0c713f6edc sync.once: add Once (#12722) 2021-12-05 18:56:03 +02:00
playX
105d7fcf75 js: support JS.await (#12726) 2021-12-05 13:33:53 +02:00
Delyan Angelov
e4850a007c strings: add Builder.drain_builder/1 utility method 2021-12-05 11:59:18 +02:00
Delyan Angelov
229d2fb667 v.util.timers: improve tracing by supporting -d trace_timers_creation 2021-12-05 11:55:41 +02:00
yuyi
2754368873 ast: correct comments of the find_field_from_embeds (#12723) 2021-12-05 06:21:39 +02:00
Taillook
4b21d3e364 crypto.sha256: add missing documentation of sum (#12716) 2021-12-04 20:16:44 +02:00
penguindark
81a1490e31 builtin: add string.split_any/1 (#12720) 2021-12-04 20:13:40 +02:00
Leo Developer
ace63594bf all: support $embed_file('embed.vv', .zlib) (#12654) 2021-12-04 19:43:19 +02:00
yuyi
0f50ac3260 ast: cleanup struct embeds related methods (#12719) 2021-12-04 18:46:41 +02:00
yuyi
0cb4557a8d ast, checker, cgen: fix nested struct embed method call (#12714) 2021-12-04 14:51:42 +02:00
Delyan Angelov
d59aa14b26 builtin: fix {-7:08b} (interpolation of negative numbers with 0 padding), add tests 2021-12-04 13:11:05 +02:00
Delyan Angelov
89c08c6292 cgen: cleanup the generated code for dump(x) 2021-12-04 11:56:45 +02:00
yuyi
2d43fdb42a ast, checker, cgen: fix nested struct embed error (fix #12659) (#12712) 2021-12-04 11:19:19 +03:00
Larpon
7e6d4ebfe1 toml: add doc string to reflect methods (#12666) 2021-12-03 23:07:44 +02:00
Delyan Angelov
33163238e7 strconv: add a small performance optimisation 2021-12-03 20:14:14 +02:00
yuyi
365b46cad3 cgen: fix match sumtype print var aggregate error (#12667) 2021-12-03 20:00:00 +02:00
Delyan Angelov
4624de6cb5 cgen: support -d no_segfault_handler and -d no_main. Cleanup -d trace_xxx descriptions in CONTRIBUTING.md 2021-12-03 19:01:45 +02:00
Larpon
1d6cc57d9c toml: add reflection method (#12664) 2021-12-03 12:40:46 +02:00
playX
0da7e2f8ab js: make vlib/v/util compile on JS backend (#12660) 2021-12-03 12:25:36 +02:00
Alexander Medvednikov
be5446bfa4 checker: update enum test 2021-12-03 09:07:33 +03:00
Alexander Medvednikov
209747d03e checker: update enum test 2021-12-03 08:43:03 +03:00
Alexander Medvednikov
eca78a2906 checker: allow infix expressions in enum declarations 2021-12-03 07:45:37 +03:00
Delyan Angelov
c4363bc78b builtin: explain and better organise the different cstring_to_vstring/tos/tos_clone/vstring family of conversion functions 2021-12-02 15:46:53 +02:00
yuyi
66a67de8c0 checker, cgen: fix match expr returning optional with error (fix #12556) (#12645) 2021-12-02 12:22:48 +02:00
Larpon
7d0a36dd08 toml: solidify single-line escape validation (#12644) 2021-12-02 12:07:53 +02:00
Larpon
adddac4807 toml: add some meat to README.md (#12649) 2021-12-02 12:01:59 +02:00
Leo Developer
63b0798771 compress: add a new compress.zlib module (#12646) 2021-12-02 12:01:44 +02:00
Larpon
5ab91dd471 toml: support multi-level map keys in arrays-of-tables (#12641) 2021-12-02 11:19:45 +02:00
Larpon
ebfacca252 toml: fix bug in unicode decoding (#12643) 2021-12-02 11:19:12 +02:00
Miccah
799d7b843c net: properly convert IP address C strings to V strings (#12648) 2021-12-02 11:18:14 +02:00
Larpon
9cf7af0c75 toml: add better float validation (#12640) 2021-12-02 11:16:55 +02:00
Ulises Jeremias Cornejo Fandos
f7926ec9a4 vlib/context: add onecontext as submodule (#12549) 2021-12-02 11:15:07 +02:00
yuyi
2144471ce1 cgen: fix generic fn with anon fn in body (#12647) 2021-12-02 10:53:42 +02:00
yuyi
988779846f checker: fix map init with enum keys (#12637) 2021-12-01 18:11:50 +02:00
Larpon
8494e387ec strconv: fix format.md example snippets (#12642) 2021-12-01 17:23:35 +02:00
Delyan Angelov
d7bc2a88f7 builtin: add a non allocating rune.length_in_bytes() method and tests for it 2021-12-01 16:35:13 +02:00
Larpon
b3aedff3f8 toml: convert yaml value checks in iarna test suite (#12629) 2021-12-01 14:43:15 +02:00
pancake
6f297cdfaa js: add missing start_digraph() for the js backend (#12638) 2021-12-01 14:05:18 +02:00
Delyan Angelov
f5d283721e checker: add more string(x) checks, with more detailed replacement suggestions 2021-12-01 11:28:00 +02:00
Delyan Angelov
79cb303a6c sync: improve compatibility with -Wimpure-v 2021-12-01 11:24:51 +02:00
Delyan Angelov
47aa2b1f93 all: fix casting of string(MyString('abc')) and byte(MyByte(123)); improve TypeSymbol handling (#12617) 2021-12-01 09:50:53 +02:00
penguindark
519ca90cfa regex: added default support for long queries (#12635) 2021-12-01 08:38:50 +02:00
Taillook
f86710dcc7 crypto.bcrypt: add doc comments for public bcrypt functions (#12622) 2021-11-30 19:41:59 +02:00
Larpon
6f193c4300 toml: remove obsolete comment from checker (#12626) 2021-11-30 19:40:31 +02:00
yuyi
547f326f33 cgen: cleanup auto_str_methods (#12631) 2021-11-30 19:39:55 +02:00
Thomas Mangin
5e1cd13e39 v help: add build-c help information on how to use brew for libgc (#12633) 2021-11-30 19:39:27 +02:00
Larpon
758ba76d2b toml: update testdata/.gitignore (#12630) 2021-11-30 16:01:20 +02:00
Larpon
5c8e626912 toml: add alexcrichton/toml-rs test suite to CI (#12624) 2021-11-30 15:08:30 +02:00
yuyi
d1b0ce9e0c cgen: fix error of the interface str method (fix #12538) (#12620) 2021-11-30 15:03:44 +02:00
Larpon
7d9028db56 toml: add more checks for table redeclarations (#12615) 2021-11-30 15:01:00 +02:00
Larpon
f50f409ad7 toml: simplify bool keys in scanner and parser (#12625) 2021-11-30 14:26:47 +02:00
pancake
1b691e7612 native: implement for-c and for-in range loops (#12155) 2021-11-30 11:49:30 +02:00
Anton Zavodchikov
05db3533d3 picoev: use net C definitions (#12574) 2021-11-30 11:15:59 +02:00
pancake
8ac7739db8 parser: forbid empty match statements 'match cond.op {else {}}' (#12618) 2021-11-30 09:32:48 +02:00
Delyan Angelov
6749979534 builder: fix the uhm fine module lookup bug (part 1) 2021-11-29 22:54:52 +02:00
Taillook
bbc47562b3 crypto.blowfish: add doc comments for the public API (#12609) 2021-11-29 22:19:52 +02:00
Larpon
14424100e8 toml: comply with BurntSushi @eb989e5 (#12616) 2021-11-29 22:15:22 +02:00
Larpon
83260e5074 docs: add link to shader inclusion example (#12613) 2021-11-29 18:26:32 +02:00
Leo Developer
0f59d88ba6 v.embedfile: make path public (#12614) 2021-11-29 16:32:42 +02:00
playX
ddec89f9ee js,vfmt: fix formatting for JS types; add fetch API (#12608) 2021-11-29 15:32:29 +02:00
yuyi
9825c7e06c ast: fix generic sumtype of alias generic struct (#12611) 2021-11-29 15:12:00 +02:00
Larpon
65e9503556 toml: check for immutable tables (#12612) 2021-11-29 15:10:23 +02:00
Alexander Medvednikov
c14c324125 pref: .o build mode 2021-11-29 05:00:25 +03:00
Delyan Angelov
6d97b0a407 checker: improve checking of a << b, when a and b are numbers (#12589) 2021-11-29 03:48:49 +03:00
ChAoS_UnItY
fe37da31a8 v.transformer: fix string always escaped by transformer (#12603) 2021-11-28 23:53:30 +02:00
yuyi
6d6a23a1c9 checker: remove redundant code of find field with embed (#12600) 2021-11-28 21:31:19 +02:00
Delyan Angelov
87029e5707 encoding.base64: vfmt base64.c.v 2021-11-28 20:37:08 +02:00
Delyan Angelov
31fe02de8c builtin,crypto: fix problems detected by -fsanitize=address,undefined and -fsanitize=memory 2021-11-28 20:35:18 +02:00
Delyan Angelov
b4c52b72cf builtin: change the -d debug_malloc byte pattern to M so it is easier to spot with a plain text terminal. 2021-11-28 19:23:11 +02:00
Leo Developer
9c88317ca6 checker: add a warning if start value is higher than end value (#12602) 2021-11-28 18:46:52 +02:00
Delyan Angelov
5786dd84e6 tests: add a new import_x_json2.v skipped valgrind test 2021-11-28 18:36:05 +02:00
Delyan Angelov
1913de0187 x.json2: fix compilation with -autofree 2021-11-28 18:32:04 +02:00
Larpon
5deb56fc79 docs: add v shader section, add help text (#12594) 2021-11-28 17:17:04 +02:00
Delyan Angelov
969e0dce20 szip: cleanup after tests 2021-11-28 15:30:26 +02:00
Delyan Angelov
dc610a9a80 ci,crypto: fix -cstrict compilation 2021-11-28 15:30:13 +02:00
Larpon
0fc47b50a2 toml: fix date-time and time ms test inconsistency (#12593) 2021-11-28 12:42:32 +02:00
Taillook
783aba4552 vlib/crypto/bcrypt: Add bcrypt (#12595) 2021-11-28 12:40:50 +02:00
Leo Developer
f72d001db5 cgen: fix $embed_file not finding embedded file when using -prod (#12596) 2021-11-28 12:32:05 +02:00
Larpon
1d8ece7ac0 toml: fix, test and optimize nan and inf values (#12592) 2021-11-27 21:26:28 +02:00
Larpon
22043f2df1 toml: fix float checker bug for -0.01 (#12590) 2021-11-27 21:03:26 +02:00
Larpon
d52b62a4f4 toml: improve parsing of bare keys to include - and _ (#12588) 2021-11-27 15:46:05 +02:00
Delyan Angelov
8315e82188 checker: improve naming for .stmts() and c.stmts_ending_with_expression(), add a better explanation for their purpose 2021-11-27 08:09:36 +02:00
Delyan Angelov
deaeffc4db checker: add a check for unused x << y expressions (where x != array) (#12586) 2021-11-27 07:38:35 +02:00
Joe Conigliaro
12585e88e1 checker: remove obsolete/slow const ordering code. close #12544 2021-11-27 05:36:27 +11:00
Larpon
4383cf7de5 toml: add iarna/toml-spec-tests to CI tests (#12583) 2021-11-26 19:15:01 +02:00
pancake
89bab98833 native: implement a working hello world compilation for w64 (#12577) 2021-11-26 19:03:15 +02:00
Larpon
04b030b7ab toml: add 1MB file parsing test to CI (#12582) 2021-11-26 18:11:14 +03:00
Larpon
253e38d9d7 toml: support implicit array of tables key change (#12580) 2021-11-26 15:06:28 +02:00
Delyan Angelov
6299a73e90 builder: prepare for v -b native -os windows run file.v 2021-11-26 12:05:58 +02:00
Sandro Martini
85633fe546 tests: test more edge cases for interfaces (#5292) 2021-11-26 11:10:03 +02:00
yuyi
cf274f262c checker, cgen: fix fn type call of match expr (#12579) 2021-11-26 09:52:20 +02:00
Larpon
a59eabc4ab toml: clean up and improve spaced and dotted key parsing (#12576) 2021-11-25 16:51:54 +02:00
playX
f584e70cf2 js: add fixes for generic structures and functions; add promise API; refactor modules (#12575) 2021-11-25 16:49:53 +02:00
yuyi
ac3910b8c2 checker: merge comptime_const_eval.v and noreturn.v into checker.v (#12573) 2021-11-25 12:41:26 +02:00
Larpon
9a2c563735 toml: add conversion of ast inf and nan to Any (#12567) 2021-11-25 12:33:54 +02:00
Eragon
fb3a793a27 tools: add "skip to content" link for screan reader and tui browsers (#12571) 2021-11-25 02:53:02 +02:00
Larpon
11d70624af toml: streamline value() api (#12568) 2021-11-24 20:39:22 +02:00
Larpon
f825306cff toml: workaround #9507 (#12566) 2021-11-24 20:36:15 +02:00
playX
b0bc112168 jsdom, examples: add more WebGL APIs; add interactive 3D cube example running on VJS (#12562) 2021-11-24 20:31:39 +02:00
Larpon
ff95cf18d4 toml: expand short date time milliseconds in decoder (#12564) 2021-11-24 14:49:23 +02:00
yuyi
6f46fc2170 checker, cgen: fix for_in_mut iterator val (#12563) 2021-11-24 14:43:37 +02:00
Thomas Mangin
cbf4a5b58c docs: fix typos in vscode documentation (#12565)
The task configuration file is tasks.json not task.json
2021-11-24 14:24:36 +02:00
yuyi
43a1d2cfea ast: cleanup table.v (#12561) 2021-11-24 09:56:56 +02:00
pancake
70ff00efbb bootstrapping: fix building V on OpenBSD (#12558) 2021-11-24 09:46:46 +02:00
Ulises Jeremias Cornejo Fandos
ff911986e7 ci: add tasks for checking that vsl and vtl are not broken by updates to V (#12559) 2021-11-24 09:45:13 +02:00
Delyan Angelov
8e0de2036d net: use vmemset(&hints, 0, int(sizeof(hints))), instead of zeroing the fields 1 by 1 2021-11-24 09:34:48 +02:00
yuyi
e42db5bee2 ast: fix vtl compile error of generic array type cname (#12555) 2021-11-23 20:11:51 +02:00
Delyan Angelov
87f7a6d99f ci: update toml_ci.yml's TOML_TESTS_PINNED_COMMIT to 8baf830 2021-11-23 16:59:23 +02:00
Larpon
1be6aed16e toml: support checking and decoding quoted keys (#12552) 2021-11-23 16:59:07 +02:00
Larpon
0779b5fd8e toml: fix implicit array allocation (#12553) 2021-11-23 16:51:24 +02:00
Larpon
49cd1b3d59 toml: make value of +nan/-nan decode to nan (#12542) 2021-11-23 16:23:16 +02:00
playX
12ffe04212 jsdom, builtin/js: WebGL W.I.P; Added support for casting V arrays to typed arrays (#12551)
* builtin/js: TypedArray support

* jsdom: WebGL W.I.P
2021-11-23 14:51:59 +02:00
Larpon
e9efed02f0 toml: fix decoding most large number values (#12541) 2021-11-23 13:23:16 +02:00
Larpon
3f0e532660 toml: fix unicode and escape value decoding (#12534) 2021-11-23 11:02:43 +02:00
yuyi
13a2d547b4 checker: fix vtl compile error (#12550) 2021-11-23 10:55:15 +02:00
zakuro
93bdff5589 fmt: remove unnecessary paren in assert stmt (#12546) 2021-11-23 07:30:54 +02:00
yuyi
fbe2b5cb58 checker: check argument type error of the generics fn declaration (#12539) 2021-11-22 22:39:20 +02:00
Delyan Angelov
bf7074cad4 ci: disable the tcc32 windows tasks for now 2021-11-22 22:05:09 +02:00
Delyan Angelov
83fee01f6e make.bat: add -g flag to improve diagnostics reports on windows 2021-11-22 22:00:14 +02:00
Delyan Angelov
d431145a39 v.util,tools: use os.join_path_single 2021-11-22 21:42:55 +02:00
Delyan Angelov
bd9564e38b ci: fix failing ttf_test.v after making char unavailable for variable names 2021-11-22 18:28:25 +02:00
Delyan Angelov
42b97ef888 ci: add -ladvapi32 for bootstrapping with gcc/clang on windows 2021-11-22 17:07:39 +02:00
Delyan Angelov
278be77c11 ci: use wine64 explicitly in ci_cross.yml 2021-11-22 16:59:21 +02:00
yuyi
f37eb6a932 checker: check invalid fn parameter name (#12540) 2021-11-22 16:51:58 +02:00
Delyan Angelov
6914763493 vc: reduce further the average vc commit diff size 2021-11-22 16:46:28 +02:00
Delyan Angelov
1bbbba5813 ci: improve ci_cross.yml 2021-11-22 16:36:26 +02:00
Delyan Angelov
759f3d28b7 ci: improve diagnostic messages for cloning tcc on windows 2021-11-22 16:24:56 +02:00
Delyan Angelov
5e8288528a ci: fix v -b js vlib/builtin/js/array_test.js.v 2021-11-22 15:11:33 +02:00
Delyan Angelov
6a252ed015 os: implement a JS version of os.join_path_single too 2021-11-22 15:03:05 +02:00
Delyan Angelov
7a0dc60d04 os: re-add the leak in os.join_path (the os.join_path(x, ...arr) case should be handled by V). Add a memleak free os.join_path_single version. 2021-11-22 14:40:55 +02:00
Delyan Angelov
5e1782bf9c tests: add more common patterns of os function usage in the -autofree test import_os_and_use_its_constants.v 2021-11-22 13:37:06 +02:00
Delyan Angelov
c3b8e5e181 ci: fix compilation on FreeBSD 2021-11-22 09:32:13 +00:00
Delyan Angelov
84aa05f8fb ci: fix macos build 2021-11-22 11:07:26 +02:00
Delyan Angelov
fe48380e85 os: cleanup; ci: fix a segfault in the tcc32 job when calling pref.vexe_path() -> os.real_path(os.executable()) 2021-11-22 10:32:10 +02:00
Delyan Angelov
e77a11001e os: make init_os_args_wide (windows), more simillar to the current init_os_args (unix) 2021-11-21 23:04:30 +02:00
Delyan Angelov
c7bd74e0f8 ci: fix build, remove [manualfree] from os.vmodules_paths for now 2021-11-21 22:34:38 +02:00
Delyan Angelov
1aaac13a60 cgen: make os less special, fix an -autofree leak on just import os
* Improve documentation of v.util.Surrounder

* Remove `os` from the list of "no auto free" `builtin` mods

* Fix -autofree freeing of `const x = []string{}`.

* Add a valgrind regression test.

* Implement os.getenv_opt in vlib/os/environment.js.v too.
2021-11-21 21:50:10 +02:00
Delyan Angelov
117c99d938 v.util: add Surrounder.builder_write_befores and Surrounder.builder_write_afters methods for writing to an existing strings.Builder 2021-11-21 20:56:47 +02:00
kahsa
480f3876ee gg: fix system_font_path (#12533) 2021-11-21 19:12:15 +02:00
playX
243e66a106 js,jsdom: Canvas & context API; Added TypeSymbol.is_js_compatible & temporary hacks for JS ifaces (#12526) 2021-11-20 21:28:11 +02:00
Delyan Angelov
258d0d6df7 cgen: make dump(x) use a single write call, fix memleaks for autogenerated .str() methods of nested structs (#12529) 2021-11-20 20:55:19 +02:00
Larpon
f1dd0e3355 toml: add value decoding (#12521) 2021-11-20 19:48:44 +02:00
Larpon
4b9e8e243c toml: support arrays in value key query syntax (#12527) 2021-11-20 19:45:17 +02:00
Ned
82010e729d checker: fix "unregistered" variadic interface call arguments (#12525) 2021-11-20 18:15:20 +02:00
Delyan Angelov
90ba856107 cgen: fix dump(x) with fn (x &Type) str() string { 2021-11-20 13:12:03 +02:00
Delyan Angelov
24ffc1ffb2 os: fix os.rmdir_all for folders with recursive symlinks 2021-11-20 10:28:12 +02:00
Larpon
1bbc73384c toml: fix memory corruption when returning new date/time types (#12507) 2021-11-19 20:35:11 +02:00
Larpon
a894a6cf36 toml: fix parsing of alphanumeric keys (#12517) 2021-11-19 20:34:21 +02:00
yuyi
eec8788333 checker: fix generics fn infer nested generic fn (#12519) 2021-11-19 20:31:55 +02:00
Subhomoy Haldar
2794aa623a tools: include vls.log in the .gitignore files for new V projects (#12522) 2021-11-19 19:23:35 +02:00
Delyan Angelov
b576181a66 cgen: fix const x := opt() or {} side effect interference when the consts are in different files in the same module too 2021-11-19 19:02:33 +02:00
Delyan Angelov
e275220f05 cgen: fix const x := opt() or {} side effect interference with parallel cgen 2021-11-19 18:15:06 +02:00
Delyan Angelov
762a7fde2a os: add os.getenv_opt/1 2021-11-19 17:47:45 +02:00
yuyi
c2eb909c9b cgen: fix multiple matches in one expr (#12516) 2021-11-19 13:52:28 +02:00
pancake
80a4ff9900 native: handle some more statements and dont echo warnings (#12518) 2021-11-19 13:50:44 +02:00
Delyan Angelov
fa995ca537 checker: add an error for x.method({}) calls, when method expects a struct 2021-11-19 13:30:45 +02:00
pancake
9eac656e55 native: support passing a directory, instead of just a .v file (#12512) 2021-11-19 10:30:46 +02:00
Larpon
76cf11e6b5 toml: add Any.default_to() method (#12506) 2021-11-19 10:26:45 +02:00
pancake
b367ed9ba3 native: support defining functions in any order (#12511) 2021-11-19 10:25:42 +02:00
yuyi
d498c365c2 checker: cleanup infer_fn_generic_types() (#12515) 2021-11-19 10:24:03 +02:00
Delyan Angelov
24ba660367 bitfield,flag: document the remaining functions 2021-11-18 20:15:26 +02:00
Larpon
96554fad71 toml: improve number conversion (#12509) 2021-11-18 19:46:19 +02:00
Delyan Angelov
3caeadfa0d cgen,vfmt: support [weak] tags for functions and globals 2021-11-18 18:32:39 +02:00
Larpon
7fba3e65e9 toml: support empty tables (#12504) 2021-11-18 15:39:44 +02:00
Larpon
24ea15c8f0 toml: remove fixed value tests from skip list (#12503) 2021-11-18 13:57:14 +02:00
kahsa
0ec02e3247 sqlite: add enum result code (#12505) 2021-11-18 13:56:15 +02:00
Larpon
7ec70d5477 toml: small refactor, move all json functionality to submodule (#12502) 2021-11-18 13:27:59 +02:00
Alexander Medvednikov
5bf28c5287 cgen: handle c2v fn casts 2021-11-18 11:58:00 +03:00
playX
1edb3e559e js,jsdom: make JS structs plain objects; add more DOM API support for jsdom (#12501) 2021-11-18 10:09:53 +02:00
Larpon
409321327b toml: don't use time.Time for time representation (#12498) 2021-11-18 07:44:24 +02:00
zakuro
b5e410e408 fmt: format explicit map init with parameter (#12499) 2021-11-18 08:34:30 +03:00
Don Park
ae54cd78f5 json2: encode ascii chars < 0x20 in json (#12494) 2021-11-18 08:34:00 +03:00
zakuro
26fbf1885d checker: report error for test functions that have parameters (#12500) 2021-11-18 08:33:28 +03:00
Larpon
3b612899bf toml: eat first nl if present in multiline strings (#12496) 2021-11-17 23:48:29 +02:00
Larpon
81455acd29 toml: simplify Doc.to_any() method (#12495) 2021-11-17 20:58:06 +02:00
Larpon
2f5fae06ee toml: fix a few string value tests (#12493) 2021-11-17 20:54:48 +02:00
Delyan Angelov
2733319879 term: fix a leak in _test.v files in the default test runner without -autofree 2021-11-17 20:39:08 +02:00
Larpon
dbf469e000 toml: move to_burntsushi functionality (#12492) 2021-11-17 17:25:50 +02:00
Larpon
7cdc906683 toml: fix scanning of short unicode escapes (#12491) 2021-11-17 17:24:40 +02:00
yuyi
3e1fb22a04 checker: format checker.v (#12490) 2021-11-17 15:57:17 +02:00
yuyi
1370516f53 checker: check struct field using 'any' type (#12489) 2021-11-17 11:42:05 +02:00
playX
2eb02ff5a7 jsdom, js: start refactoring jsdom; improve JS interfaces; add two attributes for them (#12488) 2021-11-17 11:41:33 +02:00
Delyan Angelov
6ac109a7c3 builtin: add a [has_globals] tag for all the .v files, with global declarations in them 2021-11-17 10:29:06 +02:00
Larpon
bd9ac598f7 toml: add support for validation of structure and values (#12481) 2021-11-17 08:30:40 +02:00
yuyi
5a89c0a480 ast: change CompFor to ComptimeFor (#12482) 2021-11-17 08:29:43 +02:00
yuyi
927df948ae cgen: fix generic struct free() (#12487) 2021-11-17 08:18:46 +03:00
Khalyomede
11ce26b3f6 sqlite: make constants public (#12485) 2021-11-17 05:45:50 +03:00
Alexander Medvednikov
49a36515dc checker, cgen: c2v fixes 2021-11-16 20:56:50 +03:00
yuyi
2984751a57 checker: fix the argument mismatch of fn call (#12479) 2021-11-16 17:19:02 +02:00
Delyan Angelov
3fab0a5d05 cgen: fix codegen for for k,v in map_of_pointers { 2021-11-16 17:03:58 +02:00
Delyan Angelov
045579fd8a parser: use the [has_globals] module attribute, remove the parser global_enabled_mods whitelist (part 2) 2021-11-16 11:44:36 +02:00
Delyan Angelov
f0f5f97e9f parser: support a [has_globals] module attribute, to eliminate a parser whitelist (part 1) 2021-11-16 11:34:26 +02:00
kahsa
3f37ab2ef2 gg: fix system_font_path on Linux (#12477) 2021-11-16 12:14:35 +03:00
yuyi
bede0587ad cgen: fix string interliteral of the comptime selector (#12475) 2021-11-16 08:45:47 +02:00
yuyi
9565adf597 checker: check invalid map variable name (#12474) 2021-11-16 08:42:49 +02:00
Larpon
2f75ce0d4c toml: use json2 to encode output from .to_json() (#12470) 2021-11-16 08:41:37 +02:00
Larpon
7b9cca7524 toml: add convenience convertion of Doc to map[string]toml.Any (#12473) 2021-11-15 19:00:09 +02:00
yuyi
c28041cecc all: cleanup/rename all comp_ names to be comptime_ (#12467) 2021-11-15 15:47:29 +02:00
Charles WANG
1d003228cb tests: update generics_method_str_overload_test.v to return a generic type, instead of Gen<G>. (#12465) 2021-11-15 15:36:54 +02:00
Larpon
cbdb270d2f toml: upgrade the module to 100% BurntSushi test suite parsing compatibility (#12466) 2021-11-15 15:36:14 +02:00
Larpon
78662c800c toml: fix parsing formatting on Windows with crlf line endings (#12468) 2021-11-15 15:35:30 +02:00
playX
a8a1e9381f strconv,js: f64_to_str works on JS backend now; Fix BigInt usage in infix expressions (#12464) 2021-11-15 14:13:44 +02:00
Delyan Angelov
1d2b16dde2 js: support [if userflag?] fn tags 2021-11-15 13:23:27 +02:00
Delyan Angelov
7b723262e4 tools: support VJOBS=1 VTEST_FAIL_FAST=1 ./v test . 2021-11-15 11:44:54 +02:00
zakuro
5e75c89b71 checker: allow noreturn in if expr (#12462) 2021-11-15 10:29:58 +02:00
yuyi
d8479f107f cgen: fix typeof comptime selector (fix #12461) (#12463) 2021-11-15 10:23:49 +02:00
playX
e3d98b1b28 js,strconv: port some functions to JS backend, improve rune.str() (#12460) 2021-11-14 21:06:58 +02:00
yuyi
460f4523aa checker: check array pop immutable (#12458) 2021-11-14 21:00:22 +02:00
yuyi
fb997eb5fe cgen: fix comptime for in field selector (#12457) 2021-11-14 20:58:22 +02:00
Delyan Angelov
61b99e1915 vfmt: handle comments right after interface fields 2021-11-13 13:42:17 +02:00
Larpon
9c508237bd toml: support for [a."b.c"] quoted keys (#12444) 2021-11-13 11:17:35 +02:00
playX
6c32c544e1 js,parser: allow declaring methods on JS interfaces for easier FFI (#12447) 2021-11-13 11:08:17 +02:00
yuyi
3bb1c3f930 checker, cgen: fix for in iterator of generic struct (#12441) 2021-11-12 14:29:01 +02:00
Delyan Angelov
50a608aab3 os: remove unnecessary heap allocation from os.execute 2021-11-12 11:45:37 +02:00
Delyan Angelov
c6b8b0bb0a ci: make test_execute in os_test.v more robust 2021-11-12 11:24:37 +02:00
MrsHerobrine
1c17ba82ac tools: fix the batch script for v symlink, if the vexe path contains spaces on windows (#12443) 2021-11-12 10:29:57 +02:00
Delyan Angelov
fcecf527ec ci: fix failing os_test.v on the CI 2021-11-12 10:27:35 +02:00
Delyan Angelov
20d63de136 os: fix os.execute for command output that contains 0 bytes 2021-11-12 09:39:15 +02:00
Larpon
4b42dcad8e toml: support complex array-tables-array constructs (#12438) 2021-11-11 18:30:34 +02:00
Delyan Angelov
6c5dfc5c2f examples: fix initial clock size on hdpi displays 2021-11-11 18:09:57 +02:00
Delyan Angelov
4728b975e3 examples: use app.gg.quit() instead of exit(0) 2021-11-11 17:45:22 +02:00
Delyan Angelov
9cb378bb6b examples: reduce the memory usage of the clock example, without -autofree & -gc boehm 2021-11-11 17:39:02 +02:00
Larpon
c8cb1bf6b4 toml: check for single-key reassignment in inline tables (#12436) 2021-11-11 14:57:11 +02:00
Larpon
35f00c9f91 toml: check for text after comma in arrays (#12435) 2021-11-11 14:55:51 +02:00
yuyi
6f55439930 tests: supplement tests for different types of generic parameters (#12432) 2021-11-11 14:45:55 +02:00
playX
a4c57ba56e js: support JS interfaces (#12426) 2021-11-11 14:36:32 +02:00
Larpon
015cfdb49f toml: add excerpt to value parse errors (#12429) 2021-11-11 07:29:38 +02:00
Larpon
dbd5acd5ba toml: small start -> end word use change (#12428) 2021-11-11 07:28:46 +02:00
Larpon
69fa87ad24 toml: add date and time checks (#12427) 2021-11-11 07:27:41 +02:00
zakuro
823a3ab838 fmt: fix removal of selective imported types used as type parameter (#12431) 2021-11-11 07:15:30 +02:00
yuyi
72a7d5a559 checker: minor cleanup in method_call (#12430) 2021-11-11 07:12:59 +02:00
Delyan Angelov
8a971c3bf7 ci,vweb: fix hard coded data in vweb_test.v 2021-11-10 18:41:25 +02:00
Delyan Angelov
637ebe5d42 examples: improve examples/vweb/file_upload 2021-11-10 18:26:16 +02:00
Delyan Angelov
3c6356ba36 ci: fix request_test.v (add missing \r to hardcoded post data) 2021-11-10 18:16:15 +02:00
Delyan Angelov
466ced2876 net.http: fix multipart/form-data file upload handling 2021-11-10 17:31:41 +02:00
Larpon
66e53279c2 toml: check for more wrong line ending cases (#12424) 2021-11-10 15:03:51 +02:00
yuyi
d5e767f389 checker, cgen: fix alias of map keys() (#12422) 2021-11-10 13:04:59 +02:00
playX
194b3647e2 js,checker: allow casting JS primitives to V primitives and vice-versa (#12420) 2021-11-10 11:37:16 +02:00
Delyan Angelov
6c244d3065 cgen: improve diagnostic for a v compiler panic in dicordv 2021-11-10 08:12:12 +02:00
yuyi
8f4180ea09 parser: check generic parameters error of generic struct declaration (#12418) 2021-11-09 09:25:57 +02:00
Delyan Angelov
3f841edec1 v.util: make get_vtmp_folder() return /tmp/v_{uid} by default (see https://github.com/vlang/v/discussions/11796) 2021-11-09 08:25:19 +02:00
yuyi
08667c5645 pref: allow running a .vsh script with just v build.vsh gcc, instead of v run build.vsh gcc (#12409) 2021-11-08 15:18:11 +02:00
Taras
15242d8082 docs: add description of how to use a custom table name to the ORM example – (#12408) 2021-11-08 12:22:42 +02:00
yuyi
758c18a906 cgen: fix for in mut val in array.index() (#12410) 2021-11-08 11:12:10 +02:00
yuyi
1211029926 cgen: avoid generating typedef generic array type (#12407) 2021-11-07 21:24:30 +02:00
yuyi
c8ff9e39b5 checker: cleanup generic struct init (#12406) 2021-11-07 18:47:38 +02:00
Delyan Angelov
bc98da9111 ast: speed up the frequently called methods .find_field, .find_method etc 2021-11-07 18:07:04 +02:00
yuyi
9ec1262734 ast: fix generic nested struct init (#12405) 2021-11-07 17:06:37 +02:00
Delyan Angelov
1c12186701 v.token,ast,scanner,parser: use a KeywordsMatcher lookup for builtin_type_names searches too 2021-11-07 16:39:40 +02:00
Delyan Angelov
80242c8041 builtin,ast: apply small performance improvements, suggested by hotspot 2021-11-07 13:30:44 +02:00
playX
d8f971ffb5 jsdom: add Path2D API, All CanvasRenderingContext2D methods (except image methods) (#12404) 2021-11-07 10:06:28 +02:00
Delyan Angelov
852d85b3a9 gg: cleanup the minimal gg program more 2021-11-07 09:16:49 +02:00
Delyan Angelov
32b74dd348 gg: simplify the minimal gg application even more with context.user_data = context 2021-11-06 18:24:19 +02:00
Delyan Angelov
8be64ef80e gg: improve font loading diagnostics with -d debug_font 2021-11-06 17:15:17 +02:00
playX
5f3dcde358 jsdom,builtin: add all methods for DOMMatrix; add conversion methods to convet from/to JS types (#12395) 2021-11-06 15:52:24 +02:00
Delyan Angelov
7a9ba9f41f ci: pin burntsushi/toml-test to their latest master for now 2021-11-06 15:47:49 +02:00
Larpon
d2d67e9f4d toml: add new inline-table duplicate-key test to skip list (#12399) 2021-11-06 15:19:40 +02:00
Larpon
9b00564d98 toml: panic if access fails to a key that was checked (#12384) 2021-11-05 14:14:50 +02:00
Larpon
24cd619ff8 toml: fix parsing array of tables (#12388) 2021-11-05 12:08:40 +02:00
Larpon
db65b65f3c toml: disallow spacing between (array of tables) key syntax (#12382) 2021-11-05 11:29:25 +02:00
Larpon
c3b389cde9 toml: rename sub_key -> dotted_key (#12383) 2021-11-05 11:28:54 +02:00
lydiandy
b963aff8e8 vast: update to latest V (#12387) 2021-11-04 19:57:51 +02:00
Alexander Medvednikov
7ea57bfa1e builtin: make map.keys() public 2021-11-04 19:09:37 +03:00
Alexander Medvednikov
ace9444108 checker: more c2v fixes 2021-11-04 18:43:02 +03:00
Larpon
1999fb9a95 toml: remove some skipped tests related to recent formatting update (#12380) 2021-11-04 14:27:14 +02:00
Larpon
fc7f4c5b1f toml: disallow multiline keys (#12381) 2021-11-04 14:26:25 +02:00
yuyi
59e21c2068 cgen: fix array of threads wait (fix #12350) (#12378) 2021-11-04 14:24:58 +02:00
yuyi
73e25ccb3c checker: check generic struct field fn args type mismatch (#12379) 2021-11-04 10:18:36 +02:00
Delyan Angelov
a27833ed0d all: support volatile field Type in struct declarations 2021-11-04 09:45:50 +02:00
Larpon
1a54817c81 toml: parse formatting (#12374) 2021-11-04 09:15:50 +02:00
playX
2b4154910c jsdom, checker: add more methods for CanvasRenderingContext2D, fix interop check for JS methods (#12372) 2021-11-03 16:54:28 +02:00
Delyan Angelov
c4e282a0c8 parser: check fn args in declarations too with -Wimpure-v
`v -Wimpure-v examples/2048/` now passes cleanly.
2021-11-03 16:20:24 +02:00
yuyi
4bafc5042b checker: check generic struct field fn args error (#12373) 2021-11-03 10:20:39 +02:00
Larpon
45c938bdec toml: streamline scanner.at() return type, fixes #12344 (#12370) 2021-11-03 10:18:09 +02:00
Larpon
bd5e2db460 toml: add Parser.peek(n) method (#12369) 2021-11-03 10:15:40 +02:00
Larpon
99fd84dfe4 toml: fix hex values starting with a, e or E and comments ending with crlf (#12367) 2021-11-02 19:07:27 +02:00
yuyi
3fdbfca202 cgen: fix for in with mutable structs (#12368) 2021-11-02 18:40:13 +03:00
yuyi
639cbfa0d1 checker: fix generics with assign nested generic fn call (#12366) 2021-11-02 10:12:26 +02:00
yuyi
0952af606c checker: fix comptime if T is interface (#12365) 2021-11-02 09:35:01 +02:00
Delyan Angelov
4ed6fb0e9b tools: cleanup a dump() from vwatch.v 2021-11-02 09:29:12 +02:00
crthpl
1d1793ec34 fmt: correctly format segment offsets (#12364) 2021-11-02 08:04:41 +02:00
Wertzui123
9aba00cd08 doc: update github link to libsodium (#12360) 2021-11-02 03:35:54 +03:00
yuyi
dcf230ca24 checker: fix nested generic method call (#12353) 2021-11-01 15:41:54 +03:00
null
0ab133a563 doc: fix typo (#12357)
changed `submiting` to `submitting`.
2021-11-01 15:41:07 +03:00
yuyi
da65680acf checker: fix comptime if expr of sync.threads (#12356) 2021-11-01 09:41:04 +02:00
Lucas Jenß
51f5841b6e checker: do not deref non-pointer types in fn_signature_using_aliases (#12340) 2021-11-01 02:26:15 +03:00
Lucas Jenß
28cada3fd5 docs: fix some typos (#12341) 2021-10-31 14:12:04 +02:00
Delyan Angelov
6937074e7a strings,builder: reduce V cgen and parser memory consumption, fix strings.Builder leak (#12342) 2021-10-31 12:58:55 +02:00
Miccah
ce9f26c589 examples/vweb: use map instead of string in call to app.json (#12338) 2021-10-31 12:31:49 +02:00
czkz
81b95ece51 docs: improve the docs by provide better examples and describe module publishing (#12308) 2021-10-31 11:32:31 +02:00
Delyan Angelov
579d5ae649 builtin,checker: add array.flags. Allow changing it in unsafe {} blocks 2021-10-31 11:04:56 +02:00
Wertzui123
612e742c1f examples: remove unneeded workaround (#12336) 2021-10-30 18:49:54 +03:00
Delyan Angelov
a7d4236337 sync,strings,cgen: reduce memory consumption in cgen 2021-10-29 22:29:56 +03:00
Xiao
7e0f2fcda9 docs: update VS Code debugger configuration descriptions (#12335) 2021-10-29 18:06:28 +03:00
Delyan Angelov
1785b184b9 readline: improve README.md with working examples 2021-10-29 17:36:17 +03:00
Delyan Angelov
d1acca3e52 ci: fix ./v -cg -cstrict -o v cmd/v job failures for clang 2021-10-29 17:21:53 +03:00
yuyi
d5642b6134 cgen: fix error of nested match expr (#12334) 2021-10-29 17:14:49 +03:00
Delyan Angelov
71392111f8 ci: fix cross compilation of vc/v.c 2021-10-29 17:12:05 +03:00
Delyan Angelov
4c67c01e72 parser,util: improve libleak false positive detection rate 2021-10-29 16:42:55 +03:00
Delyan Angelov
3d800b12e8 scanner: small optimisation of the ident_name hot loop 2021-10-29 16:18:34 +03:00
Delyan Angelov
b86c79329b os, builtin: reduce leaks without -autofree 2021-10-29 15:49:30 +03:00
Lucas Jenß
f801ef5e17 checker: disallow mut keyword in right-hand side of assignment (#12318) 2021-10-29 12:03:05 +03:00
playX
a32dae335a js: fix interfaces behaviour & disable struct deep copy for now (#12333) 2021-10-29 11:23:40 +03:00
Louis Schmieder
d33f7d12f7 orm: fix time struct in sql stmt (#12298) 2021-10-28 22:31:41 +03:00
Larpon
5e4594a121 toml: isolate, fix and regress-test sumtype cast causing memory corruption (#12329) 2021-10-28 19:57:30 +03:00
playX
fa02418a55 js: copy variables passed to closures (#12328) 2021-10-28 19:31:56 +03:00
yuyi
0e95e4d7b4 ast, cgen: fix generic method str() overload (#12330) 2021-10-28 19:03:17 +03:00
Delyan Angelov
475a2f9b43 ci: fix failing vlib/orm/orm_test.v 2021-10-28 17:33:18 +03:00
Delyan Angelov
4d0f6767b1 builtin: use malloc instead of calloc for []Type{cap: size} 2021-10-28 17:18:03 +03:00
Delyan Angelov
2c3e44eb20 strings: use memdup_noscan in Builder.str() 2021-10-28 17:00:16 +03:00
Larpon
a987440e2f toml: add UTF header support, add BOM tests (#12326) 2021-10-28 16:38:49 +03:00
Delyan Angelov
99e71d0868 scanner: preallocate space for tokens to reduce the number of allocations in the hot loop 2021-10-28 16:23:24 +03:00
Larpon
5ecaa160a7 toml: fix paths in skipped tests for Windows compatibility (#12323) 2021-10-28 15:56:56 +03:00
Delyan Angelov
8014235e0e scanner: speed up text_scan by using a specialised keywords matcher, instead of a generic V map of keywords 2021-10-28 15:41:13 +03:00
Delyan Angelov
b1bb1d361a ci: vfmt parser.v 2021-10-28 10:51:55 +03:00
Delyan Angelov
1b6cccaf6d parser,checker: allow a goto label right after return 2021-10-28 10:40:31 +03:00
ChAoS_UnItY
8cd01e0eac cgen: fix error caused by fixed size array init syntax with variable it (#12314) 2021-10-28 02:20:49 +03:00
Delyan Angelov
8fd66994c7 ci: comment out the main body in draw.js.v for now 2021-10-28 02:18:38 +03:00
playX
cfecb62299 js: DOM API. Part 1 (#12296) 2021-10-27 23:18:09 +03:00
Delyan Angelov
0ff23eeb74 ci: fix failing assign_expr_channel_push.out 2021-10-27 22:54:41 +03:00
Delyan Angelov
f79bc8619a scanner: remove unused .line_ends field 2021-10-27 22:37:00 +03:00
Larpon
bc3827ae15 toml: improve array parsing (#12322) 2021-10-27 20:26:33 +03:00
Lucas Jenß
43fbc68f1e checker: disallow <- (channel push) on right-hand side of assignment (fix #12309) (#12321) 2021-10-27 17:53:50 +03:00
Delyan Angelov
159a9c3070 markused: fix -skip-unused on programs with generic methods (fix #12306) 2021-10-27 17:22:26 +03:00
Larpon
462d097bf5 toml: small clarification on utf8_max const (#12320) 2021-10-27 16:41:22 +03:00
yuyi
943a807d30 parser: implement generics method with auto multi generic types (#12312) 2021-10-27 15:41:13 +03:00
Darío Hereñú
e5c759eb91 docs: fix typos (line 22, 26, 28, 34, 50, 107) (#12310) 2021-10-27 15:31:18 +03:00
Larpon
d53bb54c0a toml: implement checks for UTF-8 validity (#12313) 2021-10-27 15:28:46 +03:00
Wertzui123
ea6d2d53db parser: disallow for mut in range (fix #12234) (#12277) 2021-10-27 14:55:36 +03:00
Larpon
6eaacd3391 toml: improve checker documentation (#12315) 2021-10-27 14:31:29 +03:00
Lucas Jenß
d7fd4a563b parser: remove commented out debug statement (#12316) 2021-10-27 14:30:22 +03:00
Larpon
1b9eef74aa toml: improve inline-table parsing (#12307) 2021-10-26 17:00:41 +03:00
Larpon
c526752419 toml: remove unused enum (#12304) 2021-10-26 16:58:58 +03:00
Larpon
9a3967bd7d toml: improve comment support (#12305) 2021-10-26 16:58:05 +03:00
Larpon
52df19ef61 toml: check for invalid placement of underscores around exponent (#12303) 2021-10-26 13:49:25 +03:00
Andreas Schoeller
f14dabc6bd math.big: add a new greatest-common-divisor-algo for big.Integer, also add a benchmark for it (#12261) 2021-10-26 11:10:13 +03:00
yuyi
f62b2dcfa7 table: fix generic method with multi generic types (#12297) 2021-10-26 11:00:27 +03:00
Delyan Angelov
508f29c101 docs: document the purpose of the [params] trailing struct tag 2021-10-26 10:53:14 +03:00
Miccah
655b5c563a net.http: use [params] for Config structs (#12299) 2021-10-26 10:45:27 +03:00
Delyan Angelov
06796a6119 ci,toml: add the new float/trailing-us-exp.toml to the ignored skip list for now 2021-10-26 10:42:40 +03:00
Delyan Angelov
5b325b99e8 docs: give a concrete example of bounds access check, and error propagation with x := arr[idx] ? 2021-10-25 17:19:24 +03:00
yuyi
ac99007cab table: fix generic sumtype instantiations (#12288) 2021-10-25 15:22:41 +03:00
kahsa
77a1e3dedb gg: improve system_font_path on linux (#12290) 2021-10-25 15:16:29 +03:00
Amund Tenstad
18da724a9f examples: prevent a 180 turn in snek (#12286) 2021-10-25 10:57:05 +03:00
Bakul Shah
cc2847f6ff builtin: fix compilation with -gc boehm on some FreeBSD versions (#12289) 2021-10-25 10:24:08 +03:00
Delyan Angelov
45c1c1ab41 ci: fix import_symbol_private_err.vv and its .out file (time.since is no longer private) 2021-10-24 22:06:32 +03:00
Delyan Angelov
49ebba535e time: implement pub fn since(t Time) Duration 2021-10-24 21:36:28 +03:00
Delyan Angelov
bb71089b70 os: make the os_test.v functions more robust on windows (normalise the returned paths before comparing them) 2021-10-24 19:54:00 +03:00
Delyan Angelov
e99b699ac6 os: make os.mkdir_all more robust (honor / on windows too), add a test for it 2021-10-24 19:16:46 +03:00
Delyan Angelov
f34daf9ff4 os: add os.walk_with_context/3 and a test for it 2021-10-24 19:12:14 +03:00
Delyan Angelov
e34046a0e1 os: remove pub from impl_walk_ext 2021-10-24 18:48:54 +03:00
Delyan Angelov
d1c4b470bc os: make os.ls('') return an error, make os.walk_ext more memory efficient on deep hierarchies, add tests for os.walk_ext 2021-10-24 18:44:13 +03:00
Delyan Angelov
d9c6c9a7df http: cleanup download_file, remove unimplemented download_file_with_progress 2021-10-24 17:19:44 +03:00
playX
2eae4cf63e js: fix optional error propagation (#12283) 2021-10-24 15:56:44 +03:00
Delyan Angelov
c340906280 cgen: cleanup vinit_string_literals, _vcleanup and reload_so declarations 2021-10-24 15:29:42 +03:00
zakuro
242b99340d vfmt: fix bug where duplicated comma is placed before comment in array init (#12281) 2021-10-24 12:05:34 +03:00
penguindark
47a2301139 regex: add OR error, if sourounded by char classes, and a test (#12278) 2021-10-24 11:54:51 +03:00
Delyan Angelov
e45cd02029 mysql: always use #include <mysql.h>, rely on pkgconfig to get the correct include folder 2021-10-23 21:22:10 +03:00
Delyan Angelov
008d15dcb5 builder,pref: add support for -no-builtin (useful for writing Linux kernel modules) 2021-10-23 12:53:53 +03:00
Delyan Angelov
aa22751d26 vlib: remove unused glm module (#12274) 2021-10-22 22:23:14 +03:00
playX
864d6eae6b js: codegen & vlib fixes, replace the Game of Life CLI example (#12272) 2021-10-22 22:03:19 +03:00
Larpon
8a4756819a toml: disallow unclosed arrays (#12273) 2021-10-22 20:30:29 +03:00
Larpon
506924b01c android: hide printf hijack for android logging behind define (#12269) 2021-10-22 19:59:25 +03:00
Larpon
8273c0582b toml: check for illegal characters, fix all related skipped tests (#12270) 2021-10-22 19:57:32 +03:00
Larpon
eb364f0301 toml: check for exponents starting with an underscore (#12271) 2021-10-22 19:56:43 +03:00
Delyan Angelov
eed94c727c os: move C struct declarations in their own _default.c.v files (#12268) 2021-10-22 17:08:08 +03:00
Delyan Angelov
0401b5ece0 mysql: fix compilation with libmariadb-dev, but no libmysqlclient-dev installed 2021-10-22 16:44:08 +03:00
Larpon
76ff708cf8 toml: squash recently fixed invalid tests (#12266) 2021-10-22 13:38:36 +03:00
Subramani
0d7057dd44 readme: improve wording, fix typos (#12250) 2021-10-22 08:18:01 +03:00
Larpon
cc2ef4188d toml: support parsing (+/-)nan and (+/-)inf (#12256) 2021-10-22 08:16:47 +03:00
Alexander Medvednikov
47313cbf27 doc: clean up array init docs 2021-10-22 07:23:45 +03:00
ChAoS_UnItY
5b69593766 cgen,js: fix missing break in switch case, generated by match with range branches (#12260) 2021-10-21 22:30:05 +03:00
czkz
da7dad07a3 builder: fix sigint handling for v run (#12246) 2021-10-21 16:40:32 +03:00
Larpon
909ed76b8f toml: check binary, octal and hexadecimals literals (#12255) 2021-10-21 16:37:38 +03:00
Delyan Angelov
a85707246f help: document -skip-unused in the v help output. 2021-10-21 16:33:04 +03:00
a-iga
1ba839dc3b openssl: change read_into to read (#12251) 2021-10-21 14:13:04 +03:00
Larpon
a84b1a53ec toml: fix bin, oct and hex capital identifier check (#12254) 2021-10-21 14:12:17 +03:00
czkz
5607224be6 docs: improve os.ProcessState markdown rendering (#12245) 2021-10-21 11:19:01 +03:00
yuyi
ff02c19827 table, builder, checker: cleanup unwrap_generic (#12241) 2021-10-21 05:48:02 +03:00
playX
57c79770b3 js: port more methods (os, builtin) (#12238) 2021-10-20 16:02:21 +03:00
Lance Fredrickson
7c1fff3495 builder: pass -std=gnu99 to the C backend under linux (#12236) 2021-10-20 14:26:25 +03:00
05st
3e52d54586 cgen: fix match expr when evaluating to sumtype (#12237) 2021-10-20 11:52:11 +03:00
Delyan Angelov
ef0eaeee08 ci: fix broken js tests 2021-10-19 20:05:27 +03:00
Alexander Medvednikov
a8ced46564 sokol: fix a typo 2021-10-19 17:18:49 +03:00
ChAoS_UnItY
ab350d52ec cgen: support RangeExpr while emitting enum switch case (#12226) 2021-10-19 17:02:22 +03:00
Alexander Medvednikov
d8ea9e4969 sokol: move _sapp_macos_resize_window 2021-10-19 16:58:39 +03:00
Alexander Medvednikov
45534b512b time: move pure V function from time.c.v 2021-10-19 16:03:45 +03:00
Delyan Angelov
f2cda1a529 parser: update p.inside_or_expr consistently (fix v fmt -w vls/analyzer/symbol_registration.v) 2021-10-19 13:36:10 +03:00
yuyi
6aca360507 parser: fix checking unexpected name (#12233) 2021-10-19 12:27:59 +03:00
playX
c1aa782a6c js,checker: fix some modules build for v -b js self, fix or block check in ast.CallExpr (#12231) 2021-10-19 12:11:54 +03:00
Delyan Angelov
39c3817ce4 readme: add a section for installing openssl so linking to it when answering is easier. 2021-10-19 09:43:29 +03:00
czkz
a84a6d1fb1 docs: fix typos, cleanup wording (#12227) 2021-10-18 21:03:27 +03:00
xiao xigua
108644d260 vweb: add file method to vweb.Context, make the existing json method generic (#12211) 2021-10-18 18:25:06 +03:00
Delyan Angelov
e9aa18fcc8 roadmap: mark parallel cgen and interface embedding as done 2021-10-18 17:50:05 +03:00
lydiandy
3af53e29c9 doc: update the interface sections (#12225) 2021-10-18 14:24:09 +03:00
Delyan Angelov
b23984a211 builder: only print the thirdparty object rebuilding line with '-v' 2021-10-18 13:28:09 +03:00
ChAoS_UnItY
53c2e262f1 cgen & jsgen: generate when possible a switch from match x { (#12216) 2021-10-18 10:59:52 +03:00
playX
a3de67de28 js: support WASM interoperability using wasm_import/wasm_export fn tags (#12212) 2021-10-18 10:56:21 +03:00
lydiandy
2070839722 io: pub the RandomReader interface (#12222) 2021-10-18 10:51:36 +03:00
Delyan Angelov
5dd3864617 markused: fix v -skip-unused cmd/tools/vpm.v regression after 98b2bdb 2021-10-18 08:43:56 +03:00
Delyan Angelov
735c961682 autofree: add skipped string_plus_string_plus.v sample 2021-10-17 19:46:35 +03:00
Delyan Angelov
6e4bda3741 strconv: fix string builder leaks in format_dec_old, format_es_old, format_fl_old, v_sprintf 2021-10-17 19:46:34 +03:00
Delyan Angelov
1313dcf601 gg: fix leak in draw_image_with_config 2021-10-17 19:46:34 +03:00
lydiandy
98b2bdb410 io: cleanup ReaderWriter interface (#12218) 2021-10-17 19:39:51 +03:00
czkz
3a073329ff builder: use os.new_process() instead of os.system() in v run (#12214) 2021-10-17 19:01:34 +03:00
yuyi
a006090b08 ast: minor cleanup of register_type_symbol (#12213) 2021-10-17 15:50:42 +03:00
czkz
29f068997b math: add fn clamp (#12205) 2021-10-17 06:42:40 +03:00
05st
fd3a10ab43 checker: fix mut check bypass with for in loops (#12208) 2021-10-17 06:41:39 +03:00
Alexander Medvednikov
e6b7ab8b9d net.http: authority header 2021-10-17 06:40:19 +03:00
Larpon
678e3a210d tools: add vshader (#12195) 2021-10-16 22:10:48 +03:00
Larpon
bff7cc5f20 thirdparty: remove patch marks in sokol_gfx.h (#12198) 2021-10-15 19:36:44 +03:00
Delyan Angelov
dee4ffbc99 builder: make -usecache rebuild cached, but changed modules, and their dependants (#12193) 2021-10-15 12:22:59 +03:00
yuyi
c108e01917 checker: fix generic fn return types with generic struct (#12186) 2021-10-15 11:50:10 +03:00
yuyi
27cd21e459 cgen: fix infix ops, for cross assignments of types with overloaded operators (#12192) 2021-10-15 11:32:58 +03:00
playX
814b4ebb4c term: get_terminal_size() for js_node, term.clear() for all js backends (#12189) 2021-10-15 10:10:40 +03:00
playX
d3887c1568 time: fix sys_mono_now for the JS backend (#12187) 2021-10-15 09:22:15 +03:00
czkz
c29a5cdedb term: fix readme typo (#12180) 2021-10-15 06:08:31 +03:00
ChAoS_UnItY
4d1307f29b all: index accessor in array init expression (#12181) 2021-10-15 03:57:49 +03:00
Carlos Esquerdo Bernat
6d62574e7f tutorials: fix argument type (#12182) 2021-10-15 02:24:22 +03:00
yuyi
c9b2f878b3 parser, checker: optimize checking generic struct type mismatch (#12179) 2021-10-15 00:11:31 +03:00
Ulises Jeremias Cornejo Fandos
4490d5ed29 context: cleanup the tests and the documentation (#12175) 2021-10-14 13:32:42 +03:00
Delyan Angelov
4c2cb1b6df vdoc: prevent leaking to the docs the pure_v_but_overriden_by_ prefix 2021-10-14 11:47:50 +03:00
yuyi
05885059bd cgen: remove the extra generated parentheses of single in_expr (fix #12158) (#12168) 2021-10-14 11:38:16 +03:00
ChAoS_UnItY
6f629d1a6a transformer: eliminate unreachable branches & redundant branch expressions in MatchExpr (#12174) 2021-10-14 02:15:52 +03:00
nyx-litenite
5b9553d5c4 orm: fix last_id() call in mysql (#12173) 2021-10-13 21:24:07 +03:00
Larpon
5bfa3d5530 sokol: add screenshot function to OpenGL based backends (#12169) 2021-10-13 21:22:58 +03:00
yuyi
97e999768a checker: fix generic fn return array of generic struct (#12170) 2021-10-13 21:21:32 +03:00
playX
d373eba79b js: implement more functions for JS backend (#12167) 2021-10-13 09:40:14 +03:00
pancake
ade5774313 native: fix return a+b infix construction (#12161) 2021-10-12 19:38:17 +03:00
Delyan Angelov
6c728cf389 js: add draft support for -skip-unused (hello_world.v works) 2021-10-12 19:34:37 +03:00
pancake
1d2b56d71d native: fix example exit((1,2)->(a,b)return a+b) (#12154) 2021-10-12 18:51:28 +03:00
pancake
347ebe5fd3 native: append .exe, when using the native backend on windows (#12159) 2021-10-12 18:49:42 +03:00
pancake
a0a0ae85eb native: add support for pe64 when -os windows is used (#12149) 2021-10-12 10:43:40 +03:00
playX
22962dd2d2 js: change codegen for match statement, speedup string.split_into_lines (#12157) 2021-10-12 09:52:16 +03:00
Alexander Medvednikov
cfc56b24fb vweb: fix [post] route matching 2021-10-12 08:18:04 +03:00
Alexander Medvednikov
555e8cada6 tutorials: update the vweb tutorial with the new form parsing syntax 2021-10-12 07:17:49 +03:00
Alexander Medvednikov
da58ba0d5c vweb: populate action method params with form values 2021-10-12 07:10:12 +03:00
Anton Zavodchikov
4d7bb95c2f vweb: add a vweb_global attribute (#12064) 2021-10-12 06:35:36 +03:00
pancake
5eba02ea94 native: fix stackframe bug on return statements (#12153) 2021-10-12 06:03:44 +03:00
penguindark
0fafefc078 regex: bug fix on find groups indexes (#12152) 2021-10-12 06:03:23 +03:00
Delyan Angelov
3c8be0db72 tests: reduce maxn in builder_test.js.v to just 1000 for now (runs in under 200ms, vs ~240s before that) 2021-10-11 19:57:35 +03:00
Delyan Angelov
9fabf9f20c checker: check for x := Abc { f: fn () ? {} } mismatch, when f is fn () 2021-10-11 19:20:41 +03:00
Delyan Angelov
6c6bb08547 tools/vast: update vast to latest V 2021-10-11 15:52:06 +03:00
Alexander Ivanov
0386f2bbea checker: add an interface check for mutability, fixes #1081, fixes #7038 (#11963) 2021-10-11 15:41:31 +03:00
ChAoS_UnItY
d0c961ebc0 transformer: eliminate unreachable branches in IfExpr and fold more expressions and statements (#12135)
* v: fix using constant as length in fixed array

* format test file

* v/trasnformer: discard unreachable if branches

* transform more expressions and statements

* replace IfExpr with EmptyExpr when all branches were eliminated

* fix typo

* fix gens

* only allows branch elimination on if expression statement

* fix native gen

* fix handling of multi branch ifs in the native backend, also allow for `if true {}`

Co-authored-by: KyleLin921021 <43753315+KyleLin921021@users.noreply.github.com>
Co-authored-by: Delyan Angelov <delian66@gmail.com>
2021-10-11 14:29:17 +03:00
Ulises Jeremias Cornejo Fandos
35b301f73c math: add some benchmark tests (#12142) 2021-10-11 14:20:07 +03:00
05st
3e02cfd528 cgen: fix in op usage on array of sumtypes without cast (#12141) 2021-10-11 14:17:04 +03:00
Delyan Angelov
ceb24bc32e tests: show the number of parallel jobs used while testing 2021-10-11 13:10:55 +03:00
yuyi
1831eccd5e checker: check generic struct using in non-generic fn (#12136) 2021-10-11 02:46:44 +03:00
05st
e69df54a36 cgen: fix multi-return in if/match exprs (#12139) 2021-10-11 02:45:01 +03:00
Ulises Jeremias Cornejo Fandos
0f7dfb984a math: remove the C backend for f64 functions (#12121) 2021-10-10 11:21:48 +03:00
yuyi
83bc9b35b1 ast: fix checking generic fn call with fntype arg mismatch (#12132) 2021-10-10 11:14:19 +03:00
Yeuda By
8d5931c96c orm: fix a typo (#12131) 2021-10-10 03:47:35 +03:00
ChAoS_UnItY
3647fc6633 parser: perform constant folding before checking size of fixed array (#12126) 2021-10-10 01:55:25 +03:00
yuyi
093cab6f56 checker: check generics struct init that types mismatch (fix #12115) (#12120) 2021-10-09 15:03:37 +03:00
pancake
7a6491b9b0 native: initial implementation of C.syscall (#12098) 2021-10-09 15:01:30 +03:00
Delyan Angelov
d14b5d0c11 ci: reduce flakyness of vlib/v/pref/options_test.v on ubuntu 2021-10-09 12:58:21 +03:00
Delyan Angelov
32ea53960e v doc: show a proper error message instead of panic on v doc -m file.v 2021-10-09 11:56:37 +03:00
playX
e267106220 math: implement logarithm function in pure V (#12111) 2021-10-09 11:17:09 +03:00
Delyan Angelov
23e679475c time: sanity check parsed date/times 2021-10-09 11:05:49 +03:00
yuyi
3c7c11e55b cgen: fix sumtype with none type (fix #12101) (#12102) 2021-10-09 03:32:37 +03:00
05st
43931be451 math: sqrti, powi, factoriali (#12072) 2021-10-08 22:07:44 +03:00
05st
cd5b304cbf cgen: add interface case for gen_struct_equality_fn (#12094) 2021-10-08 19:04:24 +03:00
playX
a8ace2c41c math: implement pow in pure V (#12105) 2021-10-08 17:44:55 +03:00
Delyan Angelov
60add6cc28 ci: fix failing tests 2021-10-07 19:22:08 +03:00
Alexander Medvednikov
c356e347f5 pref: do not allow -prod with v run 2021-10-07 16:13:58 +03:00
playX
33a1006cc5 js: comptime&assert improvements, more byte and strings.Builder methods ported (#12096) 2021-10-07 15:55:47 +03:00
Larpon
42359d8915 toml: fix error return in value parsing (#12097) 2021-10-07 15:51:18 +03:00
Delyan Angelov
fbe54e49f5 tools: support v fmt -w -backup file.v 2021-10-07 13:59:49 +03:00
Larpon
09cc0c7247 gg: use sgl.begin_points for pixels + improve pixels example (#12085) 2021-10-07 10:46:57 +03:00
Larpon
d2d70450a5 gg: use sgl.begin_triangles when drawing triangles (#12083) 2021-10-07 10:45:21 +03:00
Larpon
53aa4eba0d sokol: add sg_isvalid wrapper to gfx (#12081) 2021-10-07 10:41:57 +03:00
Larpon
f454d30318 gg: use sgl.begin_triangles when drawing triangles (#12083) 2021-10-07 03:45:23 +03:00
Larpon
42c088896a gg: mute font print on Linux, use flag debug_font instead (#12082) 2021-10-07 03:45:02 +03:00
pancake
32259af2c9 v.parser: improve error message when no arch is set 'asm{}' (#12093) 2021-10-07 03:44:27 +03:00
Delyan Angelov
e53682320c v.gen.c: fix compiling go f(x) for x of the same struct in different .v files with parallel cgen 2021-10-06 22:12:21 +03:00
yuyi
0d53705776 v.checker: check fn returning void type (fix #12076) (#12078) 2021-10-06 21:04:33 +03:00
yuyi
5f736dd768 v test-cleancode: remove interop_test.v from the exceptions list (#12084) 2021-10-06 20:53:50 +03:00
yuyi
963233687e v.fmt: fix fmt of 'fn(mut a &int)' (#12075) 2021-10-06 20:51:38 +03:00
yuyi
f1742a6f62 v.ast: change 'type.to_ptr()' to 'type.ref()' (#12086) 2021-10-06 20:49:39 +03:00
Wertzui123
77c18f4435 cgen: fix alphabetic order of ast statement generation (#12080) 2021-10-06 14:32:42 +03:00
playX
b2945e916f js: add initial support for runes (#12077) 2021-10-06 10:43:49 +03:00
Delyan Angelov
115493781b tests: make the output of coutput_test.v more accurate/easily reproducible in case of failures 2021-10-06 10:15:18 +03:00
Delyan Angelov
5bc8b4dadb os: implement support for VOPEN_URI_CMD env override for os.open_uri 2021-10-06 06:33:04 +03:00
Delyan Angelov
2526aca75f tests: fix typo in coutput_test.v (thanks Jalon) 2021-10-06 00:33:01 +03:00
Delyan Angelov
efa1092199 v.gen.c: add coutput tests for the [console] codegen to prevent future regressions 2021-10-06 00:14:16 +03:00
Delyan Angelov
aa8915bdf6 v.gen.c: fix [console] handling for sokol programs on windows with parallel cgen 2021-10-05 23:57:14 +03:00
Delyan Angelov
443fa50244 docs: cleanup the Test files section a little 2021-10-05 22:49:51 +03:00
Delyan Angelov
6d2c1f7e2c v.gen.c: enable again parallel cgen for -g, make -g more robust 2021-10-05 21:51:49 +03:00
crthpl
7cf9c198fe asm: add segment addressing and fix [10] (#12068) 2021-10-05 18:57:15 +03:00
Delyan Angelov
514443a019 ci: comment out a failing assert in the tests for os.notify 2021-10-05 16:01:54 +03:00
Delyan Angelov
eef8017281 ci: reduce flakyness of notify_test.v, by re-trying it 3 times 2021-10-05 15:50:38 +03:00
Delyan Angelov
ccb5f1d563 tests: support // vtest vflags: -prod in coutput_test.v.
Use it, to add a `-prod` test for `$embed_file()`,
to prevent future codegen regressions.
2021-10-05 15:44:12 +03:00
Delyan Angelov
e23d61d99e v.pref: disable the parallel cgen when -g is given for now (the line numbers/paths are wrong) 2021-10-05 15:08:28 +03:00
Delyan Angelov
92f2e5bad2 v.gen.c: fix compilation with -prod, for files using $embed_file() (regression after parallel cgen in 85b58b0) 2021-10-05 15:06:17 +03:00
Delyan Angelov
b4d1429ef0 tests: rename as_cast_literal.v to as_cast_literal_test.v 2021-10-05 11:57:57 +03:00
yuyi
7bc3e67e24 fmt: fix import with symbols (fix #12065) (#12069) 2021-10-05 11:44:48 +03:00
05st
7555b337b9 cgen: fix expr_as_cast for int/float literals (#12067) 2021-10-05 09:53:05 +03:00
playX
8d1ba52d0c js: fix string.bytes codegen, readline, add tests for strings (#12060) 2021-10-04 18:28:30 +03:00
yuyi
e94e08475d cgen: format shared structs (#12062) 2021-10-04 18:27:38 +03:00
yuyi
03269f9854 cgen: fix error of reference struct str() (#12061) 2021-10-04 09:58:50 +03:00
Larpon
a8c2c419cd builtin: improve malloc panic messages (#12054) 2021-10-03 20:27:46 +03:00
Delyan Angelov
bfb8116623 ci: let process_test.v repeatedly fail 3 times, before consider it failed 2021-10-03 20:26:38 +03:00
yuyi
82e6d6e51d cgen: fix threads array wait without go calls (fix #12009) (#12050) 2021-10-03 18:24:44 +03:00
Larpon
b62520af9e os: fix rare crash in read_file. Fix #12052 (#12053) 2021-10-03 18:24:06 +03:00
Anton Zavodchikov
895daf297f vweb: router refactor (#12041) 2021-10-03 16:26:44 +03:00
Ekopalypse
9be16eba63 v.gen.c: add tests to ensure the same calling convention is used on exported functions for -m32/-m64 (#11977) 2021-10-03 15:47:08 +03:00
spaceface
9b6e07e2a6 cgen: support index and in for sumtype/interface arrays (#12051) 2021-10-03 15:44:13 +03:00
yuyi
10caf4a84a cgen: cleanup generated thread wait code (#12048) 2021-10-03 10:52:29 +03:00
playX
9145cd66ec js: add more tests to builtin/js and implement more builtin functions (#12049) 2021-10-03 10:08:21 +03:00
05st
129c81f34d cgen: implement eq operator for interfaces (#12047) 2021-10-03 09:04:05 +03:00
05st
f282e64fe3 arrays: add binary_search, lower_bound, and upper_bound array operations (#12045) 2021-10-03 08:14:39 +03:00
Nicolas Sauzede
117091452b os: workaround _ = C.pipe(&pipeset[0]) gcc warning warning: ignoring return value of pipe declared with attribute warn_unused_result (#12046) 2021-10-03 08:09:08 +03:00
05st
86a5e72c74 v.checker: fix return type checking being skipped for mutable method receivers (#12043) 2021-10-02 23:26:46 +03:00
Delyan Angelov
02e4aa0f0e v.checker: fix panic for a, b, c = fn_returning_several_maps() 2021-10-02 18:40:35 +03:00
Delyan Angelov
0916806350 ci: do not use htonll and ntohll on windows, use the portable versions instead. 2021-10-02 18:21:16 +03:00
Delyan Angelov
9a4dbc25ca ci: fix failing conv_test.v on windows 2021-10-02 15:51:48 +03:00
Anton Zavodchikov
4c8094d0d9 net.http: make public errors and parse_form (#12038) 2021-10-02 15:28:35 +03:00
Anton Zavodchikov
600880660a net.http: add a deprecated attribute for un/escape functions (#12037) 2021-10-02 15:19:32 +03:00
Delyan Angelov
c86935309e v.gen.c: fix compilation of if c_struct_1 != c_struct_2 { 2021-10-02 15:12:18 +03:00
05st
cc4af235f3 cgen: fix if-expression code generation if it evaluates to propagating optional / or block (#12032) 2021-10-02 14:30:04 +03:00
Delyan Angelov
552daea04f tools: fix the output of v run cmd/tools/oldv.v d329e1d -c "./v file.v" 2021-10-02 14:13:17 +03:00
Delyan Angelov
d1d4877348 net.conv: add a test for the nth16/nth32/nth64/htn16/htn32/htn64 functions 2021-10-02 13:26:09 +03:00
playX
82f187e5e0 js: fix rand build, properly use key values on map, add rand.string (#12020) 2021-10-01 21:23:49 +03:00
05st
60ecbec8ea cgen: fix closure code gen with if statement in definition (#12028) 2021-10-01 16:52:34 +03:00
Alexander Ivanov
cb149bfa00 checker: show errors for index calls to values which are not functions, fixes #11539 (#12024) 2021-10-01 15:17:02 +03:00
zakuro
ce0867f40c vfmt: fix removal of selective imported type used in map (#12030) 2021-10-01 15:14:21 +03:00
Delyan Angelov
41de0c3c6a ci: fix v -cc gcc -cstrict examples/pico/pico.v 2021-10-01 13:49:38 +03:00
Delyan Angelov
6f7c3a7cdf ci: do brew install openssl on the macos job, reduce flakyness of tcp_test.v 2021-10-01 13:13:05 +03:00
Delyan Angelov
2bdba5ed73 net: fix declarations of C.htonl/C.htons/C.ntohl/C.ntohs in aasocket.c.v 2021-10-01 12:57:47 +03:00
Delyan Angelov
149517ced4 v.builder,v.gen: time Builder.front_stages.parse_files, Builder.resolve_deps, Gen.sort_structs 2021-09-30 20:49:19 +03:00
Alexander Medvednikov
4a6d161c08 orm: postgres fixes 2021-09-30 20:00:27 +03:00
Larpon
8705db5844 toml: fix scanner escape collecting in literal strings (#12022) 2021-09-30 16:04:21 +03:00
Alexander Medvednikov
d4b3c65c45 cgen: a minor optimization; checker: a c2v fix 2021-09-30 12:51:53 +03:00
cindRoberta
6cffcf515a docs: add the topics Hoistings and Closures (#12021) 2021-09-30 12:43:26 +03:00
Wertzui123
e3d379a1eb builtin: add byte.repeat() and rune.repeat() (#12007) 2021-09-30 09:32:20 +03:00
Louis Schmieder
f9ceb12e22 checker: fix orm cast check (#12018) 2021-09-30 00:43:08 +03:00
Alexander Medvednikov
d374c347e5 ci: fix gitly test 2021-09-30 00:08:28 +03:00
Larpon
e3d3727c0c toml: fix 7 escape tests (#12017) 2021-09-29 19:28:09 +03:00
Alexander Medvednikov
c2f535fee1 ci: run the gitly web server test 2021-09-29 19:26:49 +03:00
playX
4333a53f28 js: support running .js.v tests in v test-self, fixes for array methods & codegen (#12011) 2021-09-29 15:33:14 +03:00
Larpon
4ff061927b toml: easier scanner configuration (#12016) 2021-09-29 14:53:06 +03:00
yuyi
f2c710d306 cgen: fix fn mut args with interface type (#12012) 2021-09-29 13:54:23 +03:00
yuyi
8789cc422c v.ast: fix fmt of 'bytestr' to '&byte' (#12014) 2021-09-29 13:53:46 +03:00
Larpon
d39fec3479 toml: fix unbalanced quoted tests (#12006) 2021-09-29 10:19:49 +03:00
Delyan Angelov
24c1d552d7 ci: vfmt vlib/v/gen/c/cgen.v 2021-09-29 08:58:27 +03:00
André Diego Piske
8dde9d4a7b cgen: fixes for ... in with index (#11995) 2021-09-28 19:35:07 +03:00
yuyi
5d3795e876 cgen: fix the C codegen error for '_ = map[key]' (fix #11999) (#12000) 2021-09-28 18:45:50 +03:00
Delyan Angelov
86694ddc85 ci: bump up fetch-depth to 10 for the bootstrapping CI jobs 2021-09-28 18:43:33 +03:00
Larpon
bc4aad5fb4 toml: add quote details to ast.Quoted (#11997) 2021-09-28 17:40:03 +03:00
Delyan Angelov
a03693e881 ci: extract bootstrapping tests into their own .yml file 2021-09-28 17:38:03 +03:00
Delyan Angelov
85c38bac34 ci: make the bootstrapping failure detection more sensitive 2021-09-28 17:17:55 +03:00
Delyan Angelov
87fe15e39f ci: fix typo 2021-09-28 15:30:05 +03:00
Delyan Angelov
3467ab1551 ci: fix the g++ build and the alpine-musl task 2021-09-28 15:29:00 +03:00
Delyan Angelov
9bf6d57032 ci: remove make.bat --verbose usages from the .yml files 2021-09-28 13:11:55 +03:00
Delyan Angelov
c8f1e6b5b6 ci: simplify make.bat, make it verbose to fix errors easier 2021-09-28 13:03:07 +03:00
Delyan Angelov
d07a96ede8 v.gen.c: fix v examples/hello_world.v on FreeBSD 2021-09-28 12:00:34 +03:00
Delyan Angelov
8f4fe61381 v.pref: only show the disabling parallel cgen message when -no-parallel was not given and -prealloc was 2021-09-28 11:52:27 +03:00
Delyan Angelov
975550f912 ci: add -lpthread on FreeBSD's makefile 2021-09-28 11:42:14 +03:00
Delyan Angelov
d31c9250d3 ci: further makefile bootstrapping fixes 2021-09-28 11:38:33 +03:00
Delyan Angelov
97eb0fc74f ci: workaround linking on macos (missing sem_timedwait) 2021-09-28 11:27:47 +03:00
Delyan Angelov
9e2607db57 sync: rename sync_macos.c.v to sync_darwin.c.v 2021-09-28 11:12:03 +03:00
Delyan Angelov
858161bbc4 ci: fix makefiles 2021-09-28 11:02:05 +03:00
Delyan Angelov
6b40ead54d fix ./v -cc g++ run examples/concurrency/concurrency_http.v 2021-09-28 10:35:02 +03:00
Delyan Angelov
bf0b86774a fix for the "v.c should be buildable with no warnings" step in v test-all 2021-09-28 10:34:54 +03:00
crthpl
85b58b03a3 cgen: parallelize (#10844) 2021-09-28 10:28:04 +03:00
Ken
a17b943e87 builtin: add method byte() for string (#11998) 2021-09-28 10:08:10 +03:00
Ulises Jeremias Cornejo Fandos
c151e075e1 context: update ValueContext to handle Any value and more Key types, use closures (#11993) 2021-09-27 17:52:20 +03:00
yuyi
d6a4bce2ef checker: fix generic array.map with generic callback fn (#11991) 2021-09-27 17:50:15 +03:00
Larpon
2ee873d6ca toml: fix invalid bad-multiline test (#11996) 2021-09-27 17:42:20 +03:00
yuyi
4e1ebca0cb ci: remove vls master branch test (#11992) 2021-09-27 07:11:18 +03:00
Delyan Angelov
105e76f321 ci: bump up perf-regressions limits to 251ms for hw, and 1501ms for v -o v.c cmd/v, to avoid false positives :-| 2021-09-26 22:36:58 +03:00
Wertzui123
07d65b2aab builtin: move byte methods from rune.v to int.v (#11987) 2021-09-26 22:34:25 +03:00
czkz
6967a47e07 net.openssl: fix typos in comments (#11988) 2021-09-26 22:33:10 +03:00
Delyan Angelov
6a2ef733de v.parser: add a generated .all(.flag1|.flag2) method to [flag] enums
Unlike `.has(.flag1|.flag2)`, which is true, for any of `.flag1` or `.flag2`,
the new method `.all()` tests whether *all flags* are set at the same time.
2021-09-26 21:40:44 +03:00
Rémi
09dfc3f301 arrays: add a generic arrays.concat(os.args,'abc','xyz') function (#11985) 2021-09-26 19:41:50 +03:00
yuyi
4c01627e00 cgen: cleanup stmt_path_pos processing (#11983) 2021-09-26 15:51:18 +03:00
yuyi
d93737dd34 cgen: fix assign map get to blank (fix #11508) (#11982) 2021-09-26 13:07:51 +03:00
Louis Schmieder
6391f3d2da orm: fix other int types (#11981) 2021-09-26 11:17:56 +03:00
yuyi
e09860731f cgen: fix if expr with complex nested array call (#11979) 2021-09-26 07:35:48 +03:00
Larpon
da47638f42 toml: correct documentation (#11976) 2021-09-26 07:34:47 +03:00
playX
863dd0b23e js: array improvements (#11952) 2021-09-26 07:33:53 +03:00
penguindark
f3757a7cd1 strconv: float memory leak fix (#11980) 2021-09-26 07:33:35 +03:00
yuyi
d329e1decd cgen: fix if expr with nested array calls (fix #11953) (#11973) 2021-09-25 20:38:33 +03:00
Larpon
13b2aa701c toml: rename ast.Node -> ast.Value (#11974) 2021-09-25 20:31:02 +03:00
Anton Zavodchikov
80c15607da json: assert encoded struct with a sumtype (#11970) 2021-09-25 20:29:52 +03:00
Larpon
970768288d gg: expose sapp_desc.swap_interval via gg.Config (#11975) 2021-09-25 15:06:56 +03:00
Miccah
956fdffd96 net.http: allow custom headers in post_multipart_form (#11971) 2021-09-25 10:09:49 +03:00
Ruofan XU
4fbf3fdf03 examples: make the binary search tree example generic (#11968) 2021-09-24 21:17:26 +03:00
Larpon
5541ec8670 vlib: add toml module + tests (#11964) 2021-09-24 21:13:52 +03:00
Ruofan XU
834cf40ab2 cgen, fmt, scanner: fix and use nested lambda in scanner (#11967) 2021-09-24 18:21:22 +03:00
Ekopalypse
400ab7876b ast: fix fixed array typedef generation issue (#11962) 2021-09-24 17:01:42 +03:00
Anton Zavodchikov
c75271fcb7 cgen: json sumtype inlining (#11961) 2021-09-24 16:49:00 +03:00
yuyi
430677a0c0 cgen: format generated C code of nested array call (#11955) 2021-09-23 19:56:12 +03:00
Delyan Angelov
ad58fe8249 ci: mark cancel_test.v with vtest retry: 3 2021-09-23 14:55:10 +03:00
zakuro
b354f9ae9a cgen: fix c error of if-expression when debug mode (#11950) 2021-09-23 14:52:32 +03:00
Delyan Angelov
4a0d00fb30 io.util: simplify random number generation in util.v 2021-09-23 14:20:39 +03:00
Delyan Angelov
afc3531945 ci: work around a failing g++ compilation (order of methods in an interface dispatching table matters for C++ compilers) 2021-09-23 14:08:50 +03:00
Delyan Angelov
ece5fa183c fast.v: freebsd fixes 2021-09-23 13:48:41 +03:00
Delyan Angelov
930b95f76c v.gen.c: fix uninitialised value usages regression after e5fb4e4 2021-09-23 12:24:03 +03:00
Delyan Angelov
8837712f2b rand: fix leaks with -autofree 2021-09-23 12:24:03 +03:00
Delyan Angelov
79e33d92f1 v.markused: remove hash.init() function (map fn usages are detected more precisely) 2021-09-23 12:24:02 +03:00
trollkarlen
b52f79e137 log: add temporary get_level() (#11946) 2021-09-23 12:05:11 +03:00
Alexander Ivanov
4d0f835548 checker: fix detection of invalid insertions, fixes #3600 (#11945) 2021-09-23 11:59:43 +03:00
Alexander Medvednikov
27f5c35bde autofree: test returning optionals 2021-09-23 09:18:01 +03:00
yuyi
b8935551f1 cgen: fix nested array call (#11948) 2021-09-23 08:50:37 +03:00
Alexander Medvednikov
7b60367512 autofree: free reference types with -experimental for now 2021-09-23 04:35:09 +03:00
Ruofan XU
52b53f17b2 scanner: clean up scanning of > (#11943) 2021-09-23 02:24:23 +03:00
Delyan Angelov
bf2569a9a8 all: support mut volatile x := 123 declarations (#11940) 2021-09-22 13:06:30 +03:00
yuyi
76e360ce86 cgen: format the generated C code for array map/filter/all/any methods (#11936) 2021-09-22 09:24:36 +03:00
yuyi
e5fb4e4845 cgen: fix if expr with array call (fix #11557) (#11569) 2021-09-22 02:21:18 +03:00
Alexander Ivanov
b9720f5d9e cgen: fix struct init with multiple branches, fixes #11564 (#11570) 2021-09-22 00:46:07 +03:00
yuyi
2f3925a0cf fmt: format vlib/v/token/token.v (#11568) 2021-09-21 23:29:53 +03:00
yuyi
de4c0c237b cgen: fix if infix expr with array.all/any() (#11567) 2021-09-21 16:20:41 +03:00
yuyi
108a01d65f fmt: fix unnecessary line break in array init (fix #11448) (#11562) 2021-09-21 16:20:09 +03:00
yuyi
d6fa6a459c checker: fix generic sumtype method (#11565) 2021-09-21 16:19:43 +03:00
ChAoS_UnItY
95136cbfc7 all: add unsigned shift operators (#11536) 2021-09-21 14:02:17 +03:00
penguindark
e4bd2306da sokol: upgrade to latest version, add program icon support (#11559)
* updated sokol_gfx.h to the last version: 16d7b2e

* merged sokol_app and update enums.v

* added missing icons structs

* try to fixing Mac keyboard problems

* added v patch marker to sokol_app.h

* upgrade for sokol_gl.h, sokol_fontstash.h

* manage sgl_load_default_pipeline

* added load_default_pipeline() for sokol coherence

* vfmt sapp_structs.c.v

Co-authored-by: Delyan Angelov <delian66@gmail.com>
2021-09-21 09:55:06 +03:00
Alexander Medvednikov
49886b8c40 examples: add a missing vweb header 2021-09-21 08:13:42 +03:00
Alexander Medvednikov
f6bdc6b87e tmpl: fix <div> inside <div> 2021-09-21 07:54:10 +03:00
Enzo
b2ecca3966 all: remove size_t (#11478) 2021-09-21 02:12:38 +03:00
Alexander Medvednikov
4aa99e4303 tmpl: add a <div> test 2021-09-21 02:11:33 +03:00
Ruofan XU
1430ebc5e3 scanner: cleanup scanning of > (#11558) 2021-09-21 00:57:05 +03:00
Anton Zavodchikov
d51f8ed878 v.gen.c: use unmangled variant name for encoding sumtype values in json (#11554) 2021-09-20 21:19:16 +03:00
ChAoS_UnItY
077c55d0c8 encoding.utf8: add pub fn is_letter(r rune) bool (#11547) 2021-09-20 21:16:50 +03:00
Delyan Angelov
5cf0ee46b3 v.pref,v.builder: support overriding the C cross compiler by setting VCROSS_COMPILER_NAME 2021-09-20 19:57:43 +03:00
El Koulali András
9c4507d115 cgen: fix illegal character encoding with rune consts above 127 (#11550) 2021-09-20 10:45:42 +03:00
Delyan Angelov
1de4f1af2e ci: reduce chance of spurious go_wait_option_test.v failures by retrying it 3 times 2021-09-20 10:32:40 +03:00
05st
f9f4867c25 tmpl: fix $tmpl comptime operation only working in return statement (#11541) 2021-09-19 23:22:26 +03:00
Rémi
2534946ead json: support sumtypes (#11549) 2021-09-19 21:36:26 +03:00
Delyan Angelov
7bd145d88a os,net: cleanup deprecated @VROOT usages 2021-09-19 16:24:24 +03:00
Ruofan XU
b343f19bec v.scanner: fix ambiguity of two-level generics and shift-right (#11540) 2021-09-19 16:22:28 +03:00
Delyan Angelov
76f70d51f3 ci: fix another options_test.v failute, refactor for readability 2021-09-19 08:49:52 +03:00
Delyan Angelov
b5d8c53a0c v.gen.c: fix the :X string interpolation format for isize/usize on 64bit systems 2021-09-19 05:09:03 +03:00
Alexander Medvednikov
6799f3ac5c orm: verify column name in updates 2021-09-19 04:49:29 +03:00
Rémi
e76be4ba37 checker: temporary error for optional struct fields (#11293) (#11534) 2021-09-18 23:22:24 +03:00
Delyan Angelov
0b4e03ad5c ci: fix the failing new options_test.v on the ubuntu job 2021-09-18 21:10:41 +03:00
Delyan Angelov
6b2cc9c5cf v.pref: add a simple options_test.v to check for -cflags regressions 2021-09-18 16:08:15 +03:00
yuyi
8501217a4e cgen: add gen_free_for_type_array/map() (#11530) 2021-09-18 15:18:32 +03:00
Delyan Angelov
f5efa93570 ci: disable tests-sanitize-address-msvc for now 2021-09-18 15:14:17 +03:00
Delyan Angelov
0a7fb34613 checker: simplify noreturn.v 2021-09-18 13:43:15 +03:00
czkz
396eede4db math: fix typos (#11533) 2021-09-18 12:23:31 +03:00
Delyan Angelov
740af306c0 ci: use quotes for "/fsanitize=address" in tests-sanitize-address-msvc 2021-09-18 12:08:09 +03:00
Delyan Angelov
df8a4a03a0 tests: support // vtest retry: 4 for marking flaky tests 2021-09-18 11:48:32 +03:00
Delyan Angelov
eec930b86a os: turn some panics into return error() 2021-09-18 10:45:04 +03:00
Delyan Angelov
209b159554 ci: fix tests-sanitize-address-msvc job (pass proper /fsanitize=address option) 2021-09-18 10:05:35 +03:00
yuyi
39ad6da506 checker, cgen: generate .free() methods for custom structs automatically (#11529) 2021-09-18 09:38:42 +03:00
Delyan Angelov
2eeba4758a v.builder: fix -cc msvc -cflags /O2 and support CFLAGS and LDFLAGS env vars 2021-09-18 09:14:21 +03:00
Alexander Medvednikov
219a764a83 autofree: only free user reference types 2021-09-18 06:32:25 +03:00
Alexander Medvednikov
6d47dd22df autofree: free references 2021-09-18 04:19:16 +03:00
yuyi
44ec8a8cd4 v.fmt, v.gen.js: use 'if foo in [TypeA, TypeB]' in fmt.v and js.v (#11524) 2021-09-17 21:59:16 +03:00
Delyan Angelov
bd65ceb463 v.markused: remove __print_assert_failure from all_fn_root_names 2021-09-17 21:47:22 +03:00
Ruofan XU
9180647f99 scanner, fmt: fix multi-level generics (#11517) 2021-09-17 21:44:31 +03:00
Alexander Ivanov
30e53c95c7 checker: handle if _likely_(x is Interface) { from #11485 (#11519) 2021-09-17 21:01:12 +03:00
yuyi
fb75d528eb builder: remove panics, when cleaning up tmp files after tests (#11525) 2021-09-17 20:56:33 +03:00
czkz
816c6c62b5 os: fix documentation typo in args.v (#11526) 2021-09-17 20:55:16 +03:00
Michele Zenoni
92bb292113 examples: add Rule 110 example (#11516) 2021-09-17 03:24:28 +03:00
Vincent Laisney
273154c1ae math.big: add Newton and Karatsuba algorithms (#11487) 2021-09-16 19:31:07 +03:00
yuyi
467afad065 cgen: use if foo in [TypeA, TypeB] in cgen.v (#11518) 2021-09-16 19:26:53 +03:00
JalonSolov
1688148828 flag: switch panics to optionals (#11515) 2021-09-16 19:25:05 +03:00
Delyan Angelov
0a18690a4f v.gen.c: fix assert f().len == 1 calling f() twice (closes issue 11501) 2021-09-16 19:01:35 +03:00
playX
c175b4fd48 v.gen.js: refactor code, fix alias codegen, -stats now again works with tests on the JS backend (#11512) 2021-09-16 14:00:15 +03:00
Miccah
ead5e66afd net.http: add post_multipart_form function (#11511) 2021-09-16 07:34:07 +03:00
Dialga
f295469fac net.urllib: make unescape() autofree compatible (#11510) 2021-09-16 07:09:20 +03:00
yuyi
d5e00b0920 checker, cgen: fix generic arrays sum() (#11502) 2021-09-16 07:08:28 +03:00
yuyi
09ded16e3d checker: use 'if foo in [TypeA, TypeB]' in checker.v (#11494) 2021-09-16 07:08:14 +03:00
playX
7d1776b84d js: equality method generation for V types (#11503) 2021-09-16 07:07:48 +03:00
Alexander Medvednikov
d00808660f json: omitempty 2021-09-16 07:02:43 +03:00
Delyan Angelov
5bc6cc9512 v.checker: fix spurious warning for if x := map_of_sumtypes[k] {} 2021-09-15 15:42:28 +03:00
JalonSolov
7145461cc5 arrays: switch panics to optionals (#11497) 2021-09-15 15:17:55 +03:00
yuyi
ef690dc06b testing: remove panics when cleaning up after test runs (#11505) 2021-09-15 15:15:46 +03:00
Ekopalypse
41fc4c55c6 v.builder: simplify target architecture logic for msvc (#11491) 2021-09-14 17:47:26 +03:00
ChAoS_UnItY
0c0e28df6e arrays: add more modern array operation functions (#11488) 2021-09-14 16:49:23 +03:00
yuyi
9554470985 checker, cgen: fix generic operator overload of 'cmp' (#11489) 2021-09-14 16:20:02 +03:00
yuyi
8862c3af0f all: implement if foo in [Foo1, Foo2, Foo3] (#11486) 2021-09-14 15:56:12 +03:00
Alexander Medvednikov
12ec900d20 checker: fix the void type check 2021-09-14 01:02:32 +03:00
Daniel Däschle
b63ec8fbcf checker: require params attribute to use struct as keyword arguments in function (#11135) 2021-09-14 00:05:30 +03:00
Alexander Medvednikov
ae41d1d3c6 builtin, cgen: more -nofloat fixes 2021-09-13 19:06:19 +03:00
Alexander Medvednikov
8fc0b486a2 builtin: fix string interpolation when compiling with -nofloat 2021-09-13 18:40:32 +03:00
Alexander Medvednikov
c99281709b pref: define nofloat comptime define 2021-09-13 18:35:21 +03:00
Alexander Medvednikov
04d4431299 checker: remove another unnecessary error 2021-09-13 18:35:08 +03:00
Alexander Medvednikov
cfcc57f5d3 checker: remove unnecessary "no methods" error; builder: skip float.c.v with -nofloat 2021-09-13 18:14:26 +03:00
ChAoS_UnItY
2ced845e30 arrays: add chunk and window functions (#11476) 2021-09-13 16:13:32 +03:00
playX
b9dfc89aa9 js: prefix V builtin functions, so they do not overlap with JS (#11483) 2021-09-13 11:44:55 +03:00
Ulises Jeremias Cornejo Fandos
480fe8041a math.stats: update math.stats using generics (#11482) 2021-09-13 10:20:38 +03:00
yuyi
30029eaf5d checker, cgen: fix generic operator overload (fix #11472) (#11479) 2021-09-13 09:49:28 +03:00
Enzo
012da10517 ast, fmt: cleanup (#11477) 2021-09-13 04:08:58 +03:00
yuyi
cd7d482c3b checker: fix generic array append (#11475) 2021-09-12 15:09:11 +03:00
Enzo
ccf6285f82 checker: allow mut arg on C functions (#11430) 2021-09-11 14:25:38 +03:00
playX
5b619b99c2 v.gen.js: Interfaces support, fix for error propagation & panic stacktraces (#11471) 2021-09-11 14:24:47 +03:00
Alexander Medvednikov
90e04d03b2 net.http: fix request_test.v 2021-09-11 06:16:00 +03:00
Ekopalypse
f9eb14d914 builder: remove fPic argument from windows builds (#11467) 2021-09-11 04:48:02 +03:00
zakuro
fb20a92b1e fmt: fix a bug that break generics call in string inter (#11468) 2021-09-11 04:47:22 +03:00
Sam Kravitz
145467050d doc: fix typo in Array slice (#11469) 2021-09-11 04:46:51 +03:00
Alexander Medvednikov
1546090131 vweb: remove a duplicate function parse_multipart_form 2021-09-11 04:21:10 +03:00
playX
07bd61582c js: fix strconv build, BigInt infix fix (#11464) 2021-09-11 00:11:36 +03:00
Alexander Medvednikov
36fedd28b9 docs: deference operator 2021-09-10 22:53:05 +03:00
Enzo
c8471528ce fmt: format long sum-types with a line for each type (#11461) 2021-09-10 20:56:55 +03:00
Alexander Medvednikov
5c4385a472 cgen: nofloat for kernel code 2021-09-10 20:54:48 +03:00
Delyan Angelov
5010d18f27 examples: use double buffering for mandelbrot.v, to remove flickering on m1 2021-09-10 19:46:10 +03:00
Delyan Angelov
fa0983128f examples: add a mandelbrot viewer example 2021-09-10 18:59:39 +03:00
Daniel Däschle
be0c54caf9 checker: require or block for sumtype map (#11089) 2021-09-10 16:07:39 +03:00
yuyi
af75789bbf parser: fix reference var followed by block expr (#11456) 2021-09-10 15:31:09 +03:00
yuyi
91c6eeeae5 cgen: fix b := &[5, 6, 7] (#11457) 2021-09-10 14:30:30 +03:00
Delyan Angelov
6ea750da8d v test-all: add a v run examples/v_script.vsh step too 2021-09-10 12:45:52 +03:00
Delyan Angelov
bdd053fcf1 v.builder: fix ./v examples/v_script.vsh on windows (this quickfix is thanks to yuyi98) 2021-09-10 12:30:40 +03:00
Delyan Angelov
48f0ef0a33 ci: ignore patch problems for vinix-kernel.yml 2021-09-10 12:19:05 +03:00
Delyan Angelov
7143b8ab37 v.checker: allow assigning pointers to fn variables (fix vinix compilation) 2021-09-10 11:48:36 +03:00
Alexander Medvednikov
afeb1525a1 native: rename cgen to code_gen to avoid confusion with cgen 2021-09-10 03:17:53 +03:00
Alexander Medvednikov
0370d4f268 native: fix macho test 2021-09-09 23:00:54 +03:00
Dialga
66ef27a776 tmpl: fix escaping @ (#11452) 2021-09-09 20:27:24 +03:00
Alexander Medvednikov
ab3adf3346 checker: no longer allow automatic dereferncing in a = b 2021-09-09 20:21:01 +03:00
Alexander Medvednikov
d1e9aa49ea net.http: in memory cert verification 2021-09-09 19:55:57 +03:00
Vincent Laisney
c8d4a64512 math.big: fix subtract_digit_array (#11451) 2021-09-09 14:56:20 +03:00
Enzo
1a2d5f65fb builtin: add size_t.str() again (#11446) 2021-09-09 10:50:35 +03:00
Enzo
e57b068df0 os: add open_uri/1, use it in v bug (#11450) 2021-09-09 10:48:53 +03:00
Delyan Angelov
4faa0f8487 v.checker: add checks for .free() methods 2021-09-09 09:54:06 +03:00
playX
72089c4feb js: use prefixed names for functions and global symbols (#11387) 2021-09-08 20:30:46 +03:00
Subhomoy Haldar
96d4a0777f math.big: fix comparison and add tests (#11449) 2021-09-08 20:30:20 +03:00
Alexander Medvednikov
4a2728e1bf checker: verify json.decode type 2021-09-08 14:49:02 +03:00
Alexander Medvednikov
55451baa03 builtin: i32 alias 2021-09-08 14:49:02 +03:00
yuyi
e5360e164a fmt: remove unnecessary parentheses after return (fix #11423) (#11435) 2021-09-08 14:19:53 +03:00
Enzo
bef3390f36 builtin: fix compilation (#11445) 2021-09-08 14:19:21 +03:00
Vincent Laisney
43fae5de74 bigint: division (#11386) 2021-09-08 14:16:35 +03:00
Enzo
56ad5d72ef builtin: add .str method for i/usize (#11441) 2021-09-08 13:41:08 +03:00
Enzo
e3b65092d6 parser: deprecate size_t (#11443) 2021-09-08 13:09:32 +03:00
Ruofan XU
892971024e parser: fix generic detection of foo < bar<T>() (#11434) 2021-09-08 05:54:15 +03:00
Enzo
cc8ee5fb84 all: introduce isize and usize (#11437) 2021-09-08 05:53:39 +03:00
Alexander Medvednikov
577fedfce1 net.http: fix a bug with ? in new_request 2021-09-08 05:11:02 +03:00
Dialga
00433ba460 net.urllib: avoid a double free in set_path() when compiled with -autofree (#11427) 2021-09-07 21:11:03 +03:00
Enzo
79c2bca401 v.scanner: fix error messages with unexpected token ? (#11428) 2021-09-07 20:46:56 +03:00
yuyi
bee5e7de03 v.gen.c: fix generics array delete (#11429) 2021-09-07 20:40:21 +03:00
pancake
ddc62ab0d3 native: native prints (#11426) 2021-09-07 15:44:15 +03:00
Delyan Angelov
0b6d585b07 v.gen.c: allow overriding of the == operator on C.Struct type aliases 2021-09-07 12:02:01 +03:00
Delyan Angelov
aec016bb14 v.builder: change exit code of v -check file.v to 0, when file.v is clean from any errors. 2021-09-07 07:29:45 +03:00
Ned Palacios
aedb6b8e84 v.builder: implement a -check mode, that runs only the parser + the checker, without codegen (#11414) 2021-09-07 07:17:53 +03:00
Delyan Angelov
823c9a3c84 ci: fix vinix-build job after commit 9776274 in vinix 2021-09-07 07:13:42 +03:00
Xavier Noria
2533f06e1b regex: define the predicate matches_string (#11422) 2021-09-07 07:01:23 +03:00
cindRoberta
f2f7abe2f4 match as alternative to if and unless (#11407)
* match as alternative to if and unless

* Update docs.md

* Update docs.md

* Update docs.md
2021-09-07 06:38:39 +03:00
Dialga
905c292a81 tmpl: enforce stricter line checking for html interpolation (#11413) 2021-09-07 02:21:23 +03:00
penguindark
bd10a63839 builtin: string interpolation: binary format support (#11421) 2021-09-07 00:12:54 +03:00
Dialga
fae0f8d821 tracev: fix running v tracev from directory with space (#11419) 2021-09-07 00:12:05 +03:00
Delyan Angelov
83d492bcb8 ci: add a v.c can be compiled and run with -os cross step on the macos job too 2021-09-06 20:38:51 +03:00
Delyan Angelov
f5a22f15d9 time: fix ./v -o vcross -os cross cmd/v on macos 2021-09-06 19:50:16 +03:00
Delyan Angelov
c6ff687e8a term: do not put the unused c_line field in C.termios in declarations_linux.c.v (breaks BSD build) 2021-09-06 19:15:47 +03:00
Delyan Angelov
166dd61e90 Revert "Revert "term: obtain the cursor position via termios.h (#11372)""
This reverts commit 0376cbf6bd.
2021-09-06 19:04:14 +03:00
Alexander Medvednikov
0376cbf6bd Revert "term: obtain the cursor position via termios.h (#11372)"
This reverts commit af28d09630.
2021-09-06 18:21:55 +03:00
AAAA
af28d09630 term: obtain the cursor position via termios.h (#11372) 2021-09-06 17:24:39 +03:00
Lathanao
78c26e69cf builtin: fix the string.index_any method (#11310) 2021-09-06 15:06:37 +03:00
yuyi
6084c0fc54 checker, cgen: fix complex generic sumtype (fix #11392) (#11400) 2021-09-06 03:15:53 +03:00
Dialga
87f38bf6e7 tmpl: don't trim whitespace and escape \ (#11393) 2021-09-06 03:12:53 +03:00
Dialga
2cfc6e007d test: allow testing files from a relative directory (#11391) 2021-09-06 03:11:58 +03:00
penguindark
438bdd1b0b regex: fix #11404 (#11406) 2021-09-06 03:11:38 +03:00
Wertzui123
e5c4c408b5 readline: fix typo (#11405) 2021-09-06 03:11:25 +03:00
Alexander Medvednikov
71f1be5388 checker: fix a typo 2021-09-05 18:46:14 +03:00
yuyi
3fd2dd45a4 checker: do now allow type name shadowing (#11401) 2021-09-05 18:34:21 +03:00
zakuro
51410b0922 docs: add example for map's .keys() method (#11397) 2021-09-05 18:23:04 +03:00
zakuro
aefe267970 fmt: fix removal of selective imported generic type (#11395) 2021-09-05 17:59:35 +03:00
Delyan Angelov
6b55b6d417 ci: add more details for diagnosing the sporadically failing init_global_test.v 2021-09-05 16:19:00 +03:00
penguindark
f1cba44154 examples: add a gg drag'n'drop example (#11403) 2021-09-05 16:14:38 +03:00
yuyi
48e65a7bb2 checker: check type in match range (fix #11337) (#11389) 2021-09-05 04:50:43 +03:00
penguindark
724942c4e6 regex: bug fixes (#11394) 2021-09-05 04:48:59 +03:00
yuyi
87934ecf39 cgen: fix variable name are 'array' or 'string' (fix #10991 #11343) (#11378) 2021-09-04 19:51:45 +03:00
AAAA
289e77d51b term: group related functions (#11371) 2021-09-04 19:49:47 +03:00
yuyi
5181031480 builtin: check array.sort_with_compare() arg mismatch (#11385) 2021-09-04 15:02:05 +03:00
Dialga
9b983bdd95 net.urllib: fix double free in escape() (#11390) 2021-09-04 14:57:09 +03:00
yuyi
923ef733c0 checker: disallow array sort with fancy args for now (#11388) 2021-09-04 14:34:29 +03:00
Paul Dardeau
0115a51de4 makefiles: rename as requested in issues tracker (#11380) 2021-09-04 14:32:42 +03:00
pancake
4503ff337b v help: enumerate all js_* backends (#11383)
Co-authored-by: pancake <pancake@nopcode.org>
2021-09-04 11:03:21 +03:00
zakuro
19a43db2de fmt: fix removal of comment before embed in struct (#11384) 2021-09-04 11:02:04 +03:00
Delyan Angelov
91f7be98d0 builtin.js.v: run vfmt 2021-09-03 14:13:36 +03:00
Delyan Angelov
96ef553f59 checker: check sumtype common fields for mutability when assigning too 2021-09-03 13:33:25 +03:00
playX
a4df418a68 js: support [export: 'AnotherName'] for FnDecl codegen (#11377) 2021-09-03 13:00:24 +03:00
yuyi
67ab5b858b checker: fix checking fn prototype mismatch (#11369) 2021-09-03 12:26:46 +03:00
yuyi
939a6417ce cgen: fix reserved keywords as struct field (#11370) 2021-09-03 12:18:45 +03:00
playX
08c517c966 strconv,v.gen.js: proper optionals returns, strconv compiles to the JS backend (#11364) 2021-09-03 12:16:07 +03:00
srp-at-ah
227d12f1ac tutorial: fix missing & in README.md (#11363) 2021-09-02 09:30:05 +03:00
Larpon
bd33eaa3b8 os: add function to expand "~" to home directory (#11362) 2021-09-01 16:32:28 +03:00
penguindark
63ff5690ff sokol.sapp,gg: add support for drag & drop events (#11359) 2021-09-01 09:21:27 +03:00
Delyan Angelov
56993b9e2d net.http: support passing client certificates in http.fetch (#11356) 2021-09-01 01:43:35 +03:00
Enzo
d1974f500f cgen: cleanup Gen.cc_type (#11357) 2021-08-31 23:55:37 +03:00
Adam Oates
1b262c4f1d vweb: show correct page on http error 404 (#11355) 2021-08-31 21:36:26 +03:00
Subhomoy Haldar
dadfda9400 math.big: implement big.integer in V (#11352) 2021-08-31 19:21:00 +03:00
playX
f8aaf4bf67 js: fix strings module (#11353) 2021-08-31 17:10:19 +03:00
Delyan Angelov
a208138283 v.markused: support a const used as default value in struct init 2021-08-31 15:55:32 +03:00
Delyan Angelov
f68bdb7805 v.markused.walker: support for x in struct{} iterators 2021-08-31 15:15:05 +03:00
Delyan Angelov
e72af5e2ee examples: fix 404 status code for not found pages in examples/http_server.v 2021-08-31 12:13:58 +03:00
Delyan Angelov
37b4553f52 v.parser: fix running math programs, from V installed in folders containing .v 2021-08-31 09:16:12 +03:00
zakuro
ebed01c946 v.tests: add a test_ fn, that returns an optional (#11340) 2021-08-31 08:50:26 +03:00
Alexander Medvednikov
b72a2de931 0.2.4 2021-08-30 22:25:14 +03:00
playX
a9b705bfd8 js: fix printing, make builtins for result and option types behave correctly (#11336) 2021-08-30 20:47:18 +03:00
Delyan Angelov
f33f216698 v.markused: fix compilation with -prod -skip-unused of programs that embed files 2021-08-30 17:57:33 +03:00
penguindark
8dcb27a11d sokol: expose the toggle_fullscreen and is_fullscreen functions (#11339) 2021-08-30 17:10:14 +03:00
Delyan Angelov
9496fcdfe1 v.builder: fix compilation with tcc on FreeBSD 13.0 2021-08-30 13:21:49 +00:00
yuyi
f44eb88a8d vfmt: fmt '!(a in/is b)' to 'a !in/is b' (#11335) 2021-08-30 09:45:36 +03:00
playX
61ac7b671d js: add initial support for optional types, IfGuardExpr codegen for if (#11332) 2021-08-29 14:27:17 +03:00
yuyi
985fe85de2 checker: show concretes type name in error message (#11333) 2021-08-29 12:08:57 +03:00
Daniel Däschle
ac442abc11 checker: allow noreturn in match expr (#11126) 2021-08-29 11:57:11 +03:00
yuyi
4ce9ad6a56 util/module: fix mod_path_to_full_name() (#11329) 2021-08-29 11:56:05 +03:00
yuyi
8be2be8311 all: change 'if !(a in b)' to 'if a !in b' (#11330) 2021-08-29 11:55:18 +03:00
playX
118c5fdcd8 js: fix -stats compilation of tests, proper alias codegen (#11327) 2021-08-28 16:57:33 +03:00
Delyan Angelov
25bf68e2f1 ci: os.chdir() fixes for windows jobs 2021-08-28 16:21:46 +03:00
Delyan Angelov
f41939f005 ci: fix deprecations.out (time is now > 2021/08/28 00:00:00) 2021-08-28 13:02:59 +03:00
Alexander Medvednikov
cf4081e2dd all: more chdir/chmod fixes 2021-08-28 12:52:48 +03:00
Delyan Angelov
2b92ccecb5 ci: fix v build-examples and v build-tools 2021-08-28 12:44:03 +03:00
Steve Phillips
8a49a06201 v up: update os.chdir call to handle error (#11328) 2021-08-28 12:34:10 +03:00
yuyi
e90a624738 checker: fix generic fn infer variadic parameter with arrays (#11324) 2021-08-28 10:32:51 +03:00
Alexander Medvednikov
f731060caf all: update chmod/chdir usages 2021-08-28 10:23:01 +03:00
Alexander Medvednikov
29f550158e all: update chdir usages 2021-08-28 09:39:18 +03:00
Alexander Medvednikov
853d3cb83e os: make chmod() return error 2021-08-28 09:37:24 +03:00
Alexander Medvednikov
858ba25d55 os: make chdir() return error 2021-08-28 09:35:39 +03:00
Larpon
e85311c2ba gg: change draw_cubic_bezier* call signatures for speed and to match *_poly (#11323) 2021-08-27 16:52:05 +03:00
William Gooch
4d5521bbf7 scanner: clarify the float literal warning (#11313) 2021-08-27 16:49:29 +03:00
Delyan Angelov
c954c2834a net: add -d trace_tcp support for more TcpConn methods; support again -d net_blocking_sockets too 2021-08-27 13:10:34 +03:00
crthpl
a85467eb0f cgen: fix expr in shared_array (#11319) 2021-08-27 11:48:32 +03:00
Delyan Angelov
5f90d5702e v test-self: support skipping specific tests for amd64/!amd64 (closure_test.v on m1 for now) 2021-08-27 09:47:04 +03:00
Delyan Angelov
16455a7660 fmt: preserve local fn parameter, when a module const with the same name is declared 2021-08-27 09:22:53 +03:00
playX
bdf11d969a js: add basic support for running tests, fix string.replace_each (#11314) 2021-08-26 15:20:54 +03:00
Delyan Angelov
403da9f36e docs: fix v check-md . on macos 2021-08-26 11:11:48 +03:00
Delyan Angelov
db194abeac os: merge os.c.v and os_c.c.v 2021-08-26 10:01:55 +03:00
yuyi
187c1c160b parser: minor cleanup in comp_call() (#11311) 2021-08-26 07:57:10 +03:00
yuyi
b635ff80de fmt: format '1.' to '1.0' (#11312) 2021-08-26 07:18:27 +03:00
Alexander Medvednikov
714fa3215c scanner: make the 1. float error a warning for now 2021-08-25 16:58:54 +03:00
playX
109d5d5847 js: os now compiles to the JS backend, more builtins & minor codegen fixes (#11302) 2021-08-25 14:40:53 +03:00
yuyi
f257a23313 checker: check non-generic struct init (#11300) 2021-08-25 14:40:40 +03:00
Ned Palacios
50d1e9aa2b mssql: fix c function definition parameters (#11307) 2021-08-25 14:39:56 +03:00
yuyi
4d078edb72 scanner: no longer allow 1. float literals (#11301) 2021-08-25 14:39:37 +03:00
Wertzui123
ee961b26e7 tools: fix v doctor markdown in v bug (#11296)
Github needs separate lines for the start/end markers
2021-08-25 01:13:25 +03:00
yuyi
96398efd2b checker: check array insert/prepend arguments (#11295) 2021-08-24 20:28:05 +03:00
Fabricio Pashaj
0bf9197f41 net.http: add a close method to immediatly close the listener of a started http.Server, add more tests (#11248) 2021-08-24 19:21:24 +03:00
pancake
3c85a03b8a v.gen.native: initial support for the asm statement in the native backend (#11292) 2021-08-24 15:30:41 +03:00
pancake
57b148032f v.gen.native: initial support for cast statements (#11291) 2021-08-24 15:26:49 +03:00
Larpon
833bf2cf15 gg: add cubic Bézier curves + examples (#11286) 2021-08-24 06:35:27 +03:00
Lukas Neubert
3249f8f0e7 cgen: properly cast to sumtypes in array prepend and insert (#11289) 2021-08-24 06:25:09 +03:00
Alexander Medvednikov
4824b409b1 builder: simplify the C error message 2021-08-24 06:24:35 +03:00
Adam Oates
83e2a84c21 encoding: add base58 support (#11288) 2021-08-24 06:22:46 +03:00
playX
d78e7e3b2b js: codegen fixes, W.I.P os availability for JS backend (#11281) 2021-08-23 14:25:02 +03:00
Larpon
47278b4a7d doc: document [flag] enum attribute (#11282) 2021-08-23 14:23:59 +03:00
Benjamin Stigsen
76205cff2b gg: add scaling to draw_convex_poly (#11276) 2021-08-23 13:38:29 +03:00
lydiandy
f87a638ddc tools/vast: update vast to latest V (#11279) 2021-08-23 13:37:49 +03:00
Miccah
51d7aede68 net.http: render each header value on a newline (#11270) 2021-08-23 00:38:09 +03:00
Benjamin Stigsen
352df873d5 gg: add scaling to draw_empty_poly() (#11272) 2021-08-23 00:37:20 +03:00
Ulises Jeremias Cornejo Fandos
1cfc4198f5 vlib/math: Add a pure V backend for vlib/math (#11267) 2021-08-23 00:35:28 +03:00
playX
dd486bb0fb js: match support (#11269) 2021-08-22 19:36:49 +03:00
yuyi
b80777df4b table: fix alias of sumtype method_call (#11268) 2021-08-22 17:20:10 +03:00
Delyan Angelov
ec196cfcd1 all: support overriding individual function from .v files in .c.v or .js.v files. 2021-08-22 15:51:26 +03:00
Simon
ed06c47a51 net: remove sockets if they already exists (#11264) 2021-08-22 13:38:02 +03:00
yuyi
2e28c9a4d6 checker: remove a duplicate check (#11265) 2021-08-22 12:09:14 +03:00
penguindark
fde934cd93 builtin: optimize hex() (#11261) 2021-08-22 11:10:24 +03:00
playX
2f6b2dd189 js: math.big support, f{32,64}_bits,from_bits support, typeof(expr).name support (#11260) 2021-08-21 17:18:57 +03:00
yuyi
0d81d0c0c6 table, checker: fix sumtype array appending aggregate type values (fix #11197) (#11258) 2021-08-21 17:18:01 +03:00
pancake
02d823fa6e v.gen.native: support infinite loops for {} in amd64 and arm64 (#11254) 2021-08-20 14:23:15 +03:00
pancake
82b16453e4 v.gen.native: improve error messages for unsupported features (#11253) 2021-08-20 14:21:05 +03:00
Alexander Medvednikov
c9d6242c6d json: top level array test 2021-08-20 11:41:09 +03:00
yuyi
e87cf8bac6 checker: cleanup checker.v (#11251) 2021-08-20 10:25:16 +03:00
Delyan Angelov
b5f8a04778 examples/mini_calculator.v: handle ctrl-d gracefully 2021-08-20 10:07:41 +03:00
yuyi
6201e78201 checker: fix generic struct with non-generic interface in generic fn (#11252) 2021-08-20 09:28:26 +03:00
Hualin Song
4fb570522a json: fix json.decode bug for u64 values greater than 2^31 (#11238) 2021-08-20 09:14:55 +03:00
playX
1570e613b5 math: inf,nan,fmod for the JS backend (#11246) 2021-08-20 01:14:49 +03:00
Benjamin Stigsen
70a658a265 gg: set_pixels() (#11236) 2021-08-20 01:14:25 +03:00
yuyi
a440b43630 checker, cgen: fix generic struct with non_generic interface (#11240) 2021-08-20 01:13:48 +03:00
Miccah
2cb0db633d vweb: use Response struct for 302 response (#11245) 2021-08-20 01:13:36 +03:00
spaceface
67e8031a08 cgen: fix interface parameters in fn type aliases (#11247) 2021-08-20 01:12:31 +03:00
Jordan Liese
a9fb24cb5f vweb: fix missing newline in redirect header string (#11242) 2021-08-19 14:58:57 +03:00
Miccah
6991a3c8d5 net.http: add graceful shutdown .stop() method to the http.Server struct (#11233) 2021-08-19 11:19:49 +03:00
Leo Developer
7bffabbce2 vdoc: add -comments and new comment merger (#11221) 2021-08-19 10:20:43 +03:00
Alexander Medvednikov
337c325109 roadmap: remove fn == 0 2021-08-19 08:19:26 +03:00
Delyan Angelov
fe08e1c504 strings: add Builder.write_rune/1 and Builder.write_runes/1 methods 2021-08-19 07:18:09 +03:00
Alexander Medvednikov
26b77515b9 builtin: optimize []rune.string() 2021-08-19 06:58:53 +03:00
Delyan Angelov
0cbc77d881 Revert "vpm: support v install ui https://github.com/vlang/markdown (git urls by default), cleanup vpm.v (#11189)"
This reverts commit eee71cebd4.
2021-08-18 18:58:24 +03:00
Stefan Schroeder
6983f74a9d example: add an animated analog clock (#11231) 2021-08-18 17:40:20 +03:00
yuyi
3d22dc1608 all: fix formating Foo<A,B> to Foo<A, B> (#11225) 2021-08-18 17:17:21 +03:00
div72
881510e7ce cgen: fix enum print (#11218) 2021-08-18 17:11:12 +03:00
div72
2bf1015ae1 os: add File.read_into_ptr (#11219) 2021-08-18 17:08:41 +03:00
JalonSolov
b3c641f7d5 time: use &C.time_t instead of &time_t in C fn declaration (#11232) 2021-08-18 17:05:43 +03:00
spaceface
d2ce1f74d6 ast.table: fix aggregate field type equality check (#11210) 2021-08-18 14:09:54 +03:00
mahdi ramezaan zaade
eee71cebd4 vpm: support v install ui https://github.com/vlang/markdown (git urls by default), cleanup vpm.v (#11189) 2021-08-18 14:05:10 +03:00
yuyi
e07678d6f3 checker: check using redundant parentheses (#11228) 2021-08-18 13:49:50 +03:00
spaceface
09e854c064 cgen: small interface conversion fix (#11229) 2021-08-18 13:47:57 +03:00
Delyan Angelov
7a3fe3ca70 ci: enable again ./fast -clang in .cirrus.yml (it should work now in FreeBSD 13) 2021-08-18 13:10:12 +03:00
Delyan Angelov
9ca99c6f93 v.builder: add -Wl,--allow-multiple-definition when targeting FreeBSD 2021-08-18 12:57:44 +03:00
playX
0121c8b4fd v.gen.js: fix method calls and other codegen parts, rand module compiles (#11205) 2021-08-18 11:33:37 +03:00
yuyi
c51f83efba checker: fix match expr type mismatch (#11220) 2021-08-18 08:52:01 +03:00
JalonSolov
1dee4f25fd vweb: add more common mime types (#11226) 2021-08-18 08:51:18 +03:00
spaceface
7d9969ac17 all: support runtime interface conversions (#11212) 2021-08-17 21:00:27 +03:00
spaceface
7c9a1defa4 fmt: preserve method receiver mutability in interface decls (#11222) 2021-08-17 19:39:53 +03:00
Delyan Angelov
f96b81b53a ci: fix failing vweb_test.v 2021-08-17 18:57:04 +03:00
yuyi
e1c762a616 cgen: fix assert fn_call with parentheses (fix #11207) (#11214) 2021-08-17 18:21:15 +03:00
Alexander Medvednikov
f8174c381c net.http: simplify fetch() 2021-08-17 09:17:03 +03:00
Miccah
19abe8c750 math.big: add from_bytes function (#11213) 2021-08-17 09:12:39 +03:00
pancake
90b25e7a4b os: filesystem level locking api (#11191) 2021-08-17 08:21:33 +03:00
yuyi
8521e227b4 cgen: fix if expr of multi stmts (#11208) 2021-08-16 21:48:58 +03:00
Delyan Angelov
405ed584a1 v.vmod: return errors instead of panic-ing 2021-08-16 16:54:41 +03:00
Louis Schmieder
0d30667ab5 orm: fix orm unique lists (#11198) 2021-08-16 14:59:23 +03:00
Louis Schmieder
482eecbc13 cgen: fix comptime selector reserved field names (#11199) 2021-08-16 14:58:23 +03:00
Leo Developer
b417d3c043 v.readline: fix key delete panic'king on linux (#11204) 2021-08-16 12:28:40 +03:00
Miccah
d235de63e2 math: add egcd function implementing the extended Euclidean algorithm (#11203) 2021-08-16 11:49:50 +03:00
yuyi
90b052b1db v.gen.c: fix error of if_expr in infix_expr (#11200) 2021-08-16 11:23:19 +03:00
Delyan Angelov
d7490abe19 ci: fix binary_artifact.yml 2 2021-08-16 11:20:39 +03:00
Delyan Angelov
9aa84082fd cleanup binary_artifact.yml, remove failing build-linux-arm64 job 2021-08-16 11:13:50 +03:00
Delyan Angelov
f8d6fe7a8b ci: skip running fast on FreeBSD 13 for now 2021-08-16 10:13:44 +03:00
Delyan Angelov
46ede3fb98 v check-md: reduce false positives for too long lines in various cases (real problems are easier to spot now) 2021-08-16 10:12:29 +03:00
Delyan Angelov
e28dc0489d ci: fix ./v check-md README.md 2021-08-16 08:37:13 +03:00
Alexander Medvednikov
e09d3eef5f tools/fast: fix uploading 2021-08-16 08:33:53 +03:00
Alexander Medvednikov
22b1fca793 tools/fast: minor fixes 2021-08-16 08:26:50 +03:00
Alexander Medvednikov
20ca038a56 ci: build hello world with -usecache 2021-08-16 06:42:43 +03:00
Alexander Medvednikov
fadfc3b457 gg: format a line 2021-08-16 06:36:23 +03:00
Alexander Medvednikov
7f2d6b779d readme: add a link to vinix 2021-08-16 06:35:26 +03:00
Alexander Medvednikov
58999423b7 readme: add vinix info 2021-08-16 06:34:13 +03:00
Alexander Medvednikov
765759817d ci: run fast.v with clang on freebsd 2021-08-16 06:30:35 +03:00
Alexander Medvednikov
eb1ac5b30d time: use i64 in unix() 2021-08-16 06:28:54 +03:00
Lukas Neubert
1c847e04c8 fmt: fix malformed import for incorrect module lookup paths (#11192) 2021-08-16 05:15:32 +03:00
Miccah
60f21f065f encoding.hex: remove strconv dependency (#11196) 2021-08-16 04:59:21 +03:00
Benjamin Stigsen
022503a107 gg: fix top left corner pixel not being drawn (#11202) 2021-08-16 04:59:05 +03:00
Miccah
ea4f6fd48f encoding: add a hex sub-module (#11193) 2021-08-15 21:42:51 +03:00
playX
4cde618582 js: fix builtin casts & global declarations with no initializer (#11187) 2021-08-15 18:10:06 +03:00
playX
659f823c5c js: initial work on porting rand module to JS backend (#11188) 2021-08-15 18:09:51 +03:00
Delyan Angelov
6ee77724e8 cmd/tools/gen1m.v: fix unused variable warnings in 1m.v 2021-08-15 16:04:45 +03:00
Delyan Angelov
0be20f1556 v.pref: keep the -error-limit option for now too 2021-08-15 13:46:50 +03:00
Leo Developer
b3094b0667 checker: abort prematurely on too many errors (#11185) 2021-08-15 13:41:51 +03:00
Delyan Angelov
6bc44acc70 Revert "ci: cleanup .cirrus.yml"
This reverts commit c26d82cc1a.
2021-08-15 12:22:36 +03:00
Delyan Angelov
c26d82cc1a ci: cleanup .cirrus.yml 2021-08-15 12:20:43 +03:00
Delyan Angelov
5da13ac5b1 ci: do not run fast on the FreeBSD runner for now 2021-08-15 12:11:52 +03:00
Delyan Angelov
344f13d6de ci: cleanup .cirrus.yml 2021-08-15 12:03:09 +03:00
Delyan Angelov
e0451c5b33 cmd/tools/fast/fast.v: use clang instead of tcc on the cirrus ci build ¯\_(ツ)_/¯ ... 2021-08-15 12:00:51 +03:00
Delyan Angelov
1a5c4b18ec cmd/tools/fast/fast.v: do not use -no-std and -no-rsp anymore (tcc is the most recent on the CI runner now) 2021-08-15 11:52:11 +03:00
Delyan Angelov
e64a9fa592 freebsd_build_tcc.sh: use an explicit --cc=clang 2021-08-15 11:43:25 +03:00
Delyan Angelov
3c553f16ed ci: use gmake in freebsd_build_tcc.sh 2021-08-15 11:32:40 +03:00
Delyan Angelov
d4af86738b ci: try using freebsd_build_tcc.sh again on the FreeBSD runner 2021-08-15 11:27:45 +03:00
Delyan Angelov
0dde8ab0e5 cmd/tools/fast/fast.v: use -no-std for tcc too 2021-08-15 11:21:25 +03:00
Delyan Angelov
6843b85063 ci: fix clang -std=c99 -D_DEFAULT_SOURCE -o v vc/v.c warnings 2021-08-15 11:12:48 +03:00
Delyan Angelov
eef7eea7bc v.pref, v.builder: support -no-std (skips passing -std=c99 to the C backend) 2021-08-15 11:05:06 +03:00
Delyan Angelov
b1186cca3f cmd/tools/fast/fast.v: use -no-rsp for tcc (which may be much older on freebsd) 2021-08-15 10:47:44 +03:00
Delyan Angelov
f7cbcc241a v.pref, v.builder: support -no-rsp (pass C options directly to the C compiler backend, without writing response files) 2021-08-15 10:47:44 +03:00
Delyan Angelov
7494d7f6c7 ci: just rely on the freebsd's tcc being recent enough :-| 2021-08-15 10:06:04 +03:00
Delyan Angelov
1e7c9ad8d0 ci: do use freebsd_build_tcc.sh on the freebsd runner 2021-08-15 09:59:24 +03:00
Delyan Angelov
15eff279f4 ci: fix .cirrus.yml (tab => spaces) 2021-08-15 09:51:42 +03:00
Delyan Angelov
e3bd793f43 ci: add a script to install tcc from source on freebsd so it can be run the freebsd job 2021-08-15 09:49:56 +03:00
Delyan Angelov
c225bb8465 ci: install tcc on the freebsd runner too 2021-08-15 09:38:34 +03:00
Alexander Medvednikov
e6d79f2fa7 ci: run fast.v on freebsd 2021-08-15 09:27:17 +03:00
Alexander Medvednikov
f1244bd7f1 ci: do not upload fast.v results 2021-08-15 09:22:01 +03:00
Delyan Angelov
f67e5d12e5 v.gen.c: fix v_typeof_interface_idx codegen (add static ) 2021-08-15 09:15:33 +03:00
Alexander Medvednikov
1bfb525ce1 tools/fast: improve uploading to gh pages and print errors 2021-08-15 09:03:19 +03:00
Delyan Angelov
3ffa6c1664 v.pref: fix ./v -usecache -cg run examples/hello_world.v 2021-08-15 08:35:41 +03:00
Alexander Medvednikov
40efe4f620 ci: freebsd (cirrus) 2021-08-15 08:18:59 +03:00
yuyi
d3cf53ec41 cgen: fix a bug with autofree in if expr (#11182) 2021-08-15 07:55:27 +03:00
Delyan Angelov
d540b3f1a8 v.util: improve formatted_error by adding cached_file2sourcelines, so .split_into_lines is called just once (important for long source files with many errors) 2021-08-14 23:01:30 +03:00
Leo Developer
f6d7170e77 checker: changes related to warn/error limit (#11184) 2021-08-14 22:14:13 +03:00
Delyan Angelov
1743ad05c0 v.util: add a small cache for util.read_file, so reading individual source files is done just once 2021-08-14 21:59:28 +03:00
Leo Developer
8a8a0932f7 all: add limit to accumulated errors / warnings (#11183) 2021-08-14 19:49:21 +03:00
Delyan Angelov
deb26b92b9 cgen: support typeof(x).idx, as well as iface.type_idx() (#11178) 2021-08-14 17:22:25 +03:00
Subhomoy Haldar
8dc043ba2c builtin: fix minor C fn definitions (#11180) 2021-08-14 17:19:27 +03:00
Delyan Angelov
900c37aa65 v.gen.c: support T.typ - an int for the type index of the generic type T (#11175) 2021-08-14 08:48:25 +03:00
penguindark
fb3671107e regex: bug fix about \w \W backslash chars (#11176) 2021-08-14 08:47:12 +03:00
playX
b72d1e5e86 v.gen.js: implement u64 and i64 with BigInt (#11174) 2021-08-13 21:24:10 +03:00
Delyan Angelov
34d39ccb64 builtin: fix leak in rune.str(), fix leaks in most assert x == y statements in tests (#11091) 2021-08-13 18:37:34 +03:00
Subhomoy Haldar
0bd68bf5a2 builtin: rename invalid parameter names in C fn declarations (#11173) 2021-08-13 17:03:39 +03:00
mahdi ramezaan zaade
5bd602d0a7 vpm: install directly from git/hg (#11166) 2021-08-13 12:28:30 +03:00
playX
aa14fd1b05 v.gen.js: support operator overloading (#11171) 2021-08-13 10:06:59 +03:00
yuyi
083a90148d tests: supplement multi-instances generic testing (#11170) 2021-08-13 08:38:20 +03:00
yuyi
579aa7b1b5 v.checker: fix multi insts of generics fn with generic struct (#11161) 2021-08-12 22:58:02 +03:00
Delyan Angelov
576664e31f gg,sokol,stbi,gx,fontstash: cleanup for -Wimpure-v 2021-08-12 22:42:42 +03:00
Delyan Angelov
8fbd8f790d os: cleanup for -Wimpure-v 2021-08-12 21:53:29 +03:00
Delyan Angelov
47884dfd1f builtin: move C. calls to .c.v files (#11164) 2021-08-12 21:46:38 +03:00
playX
c9e9556a92 js: array.delete_last() (#11160) 2021-08-12 19:39:33 +03:00
Miccah
1a7ba6f6d4 vweb: fix catchall route (#11168) 2021-08-12 19:05:50 +03:00
FireRedz
a8905e2788 gg: add a color field to gg.DrawImageConfig (#11158) 2021-08-12 11:11:38 +03:00
Daniel Däschle
6dbc6f233b v.parser: add checks for interoperability (C. or JS.) function declarations (#11140) 2021-08-12 10:47:24 +03:00
yuyi
89a8854e57 v.parser: fix generics type name in if_expr (#11156) 2021-08-12 10:19:06 +03:00
Daniel Däschle
e089d66225 vdoc: imrpove font spacing in the generated html docs (#11159) 2021-08-12 10:15:18 +03:00
zakuro
9c74fb0449 cli: fix bug that caused help to panic (#11157) 2021-08-12 09:25:28 +03:00
Daniel Däschle
12fb4655f5 vdoc: use nicer font (#11151) 2021-08-12 09:21:31 +03:00
penguindark
6771b7fea9 regex: added documentation about multiple dots syntax error (#11147) 2021-08-12 08:54:57 +03:00
yuyi
90adf4d092 v.checker: fix multi insts of generics struct with array (#11142) 2021-08-11 16:59:13 +03:00
Delyan Angelov
a64a4d932c v.checker: turn interface field ... must be initialized to a notice temporarily 2021-08-11 16:39:41 +03:00
Enzo
9d4d0a9894 v.gen.c: generate the closure helper for the choosen target platform, not the current one (#11134) 2021-08-11 14:09:40 +03:00
Enzo
2c856c20c1 doc: document closures (#11139) 2021-08-11 14:01:09 +03:00
div72
8c2f7901aa cli: have a posix mode to handle -- (#11133) 2021-08-11 12:26:17 +03:00
wilesun
18be9e52be log: avoid using string__plus memory leak (#11128) 2021-08-11 09:26:02 +03:00
playX
70124d2d23 js: time module: implement utc,now,local (#11138) 2021-08-11 09:22:53 +03:00
Shobi
012b3f0f64 orm: refactor insert part of orm_stmt_gen (#11121) 2021-08-10 23:31:09 +03:00
Enzo
da53f818df all: initial support for closures (x64 / linux-only) (#11114) 2021-08-10 21:27:15 +03:00
pancake
2cfb8fd697 native: document arm64 registers with comments (#11122) 2021-08-10 21:15:32 +03:00
yuyi
aceaaa681d ast: fix formatting fn variadic of reference param (#11130) 2021-08-10 21:14:37 +03:00
Daniel Däschle
2ae77c1998 v.scanner: fix escaped backslash after string interpolation (#11118) 2021-08-10 17:04:42 +03:00
Delyan Angelov
0ed7b000ec ci: do not run examples/build_examples.vsh temporarily (fixes failing macos job) 2021-08-10 15:29:14 +03:00
playX
8d6903a65a time: move C backend specific code into .c.v files (#11125) 2021-08-10 14:34:53 +03:00
yuyi
11794039e2 v.gen.c: fix fn variadic of reference param (#11115) 2021-08-10 10:36:11 +03:00
pancake
e7b8cf17e5 v.gen.native: add support for assert statements for amd64 (#11117) 2021-08-10 10:29:44 +03:00
Enzo
1588fe7967 ci: run sanitized CI when "vtest*" tools are modified (#11112) 2021-08-09 17:05:15 +03:00
Enzo
506c30a291 builtin: remove methods that can be autogenerated (#11109) 2021-08-09 15:42:31 +03:00
Enzo
1a555ab898 v.gen.c: fix generation for string.index (#11106) 2021-08-09 07:39:15 +03:00
Daniel Däschle
a64b191ce5 checker: forbid multiple pointer yields (#11105) 2021-08-09 02:11:53 +03:00
yuyi
eed8c4671f cgen: fix fn mut arg of array (#11104) 2021-08-09 01:49:30 +03:00
Daniel Däschle
52a3360a47 vpm: fix show command (#11093) 2021-08-09 01:49:17 +03:00
playX
7a67a08d2f js: implement codegen for array.sort and implement .any,.all (#11100) 2021-08-09 01:46:40 +03:00
yuyi
1f3f7705a2 cgen: fix struct_init with fixed array field (#11099) 2021-08-08 10:54:52 +03:00
Alexander Medvednikov
03ed32f805 ast: bring back Table.free() for now 2021-08-08 07:07:06 +03:00
Alexander Medvednikov
eaf8b63dd2 cgen: fix a c2v bug with variadics 2021-08-08 06:23:22 +03:00
Gavin Zhao
5e7cf56755 doc: add note on converting byte to escaped string (#11098) 2021-08-08 04:52:05 +03:00
Delyan Angelov
e32c65c322 ci: fix TcpConn.set_blocking on windows 2021-08-07 23:27:25 +03:00
Delyan Angelov
b22c335496 net: add TcpConn.get_blocking/0, TcpConn.set_blocking/1 methods, change TcpConn.read_line to set the connection to blocking, if it was not already 2021-08-07 23:21:55 +03:00
Daniel Däschle
9af65d8830 checker: protect against assigning to a typeless variable (#11094) 2021-08-07 18:09:07 +03:00
yuyi
1d3786ff1e v.parser: fix if a == Abc{} { (#11092) 2021-08-07 18:05:22 +03:00
playX
94c321c80d v.gen.js: port fully the array test suite & add fixes (#11073) 2021-08-07 17:58:49 +03:00
Uwe Krüger
c560d58f1e cgen: use heuristic to detect circular reference in auto str (#11090) 2021-08-07 14:56:09 +03:00
Delyan Angelov
7d3476cbca ci: fix tests-sanitize-address-clang job (regression after 9995f6c) 2021-08-07 14:37:51 +03:00
Sebastian Schicho
9995f6cca1 encoding.base64: speed up encoding and decoding (#11055)
* add new function headers

* new encoding function

* rename to decode_micro and add helper functions

* implement new decoding function

* add test for buffer to buffer decoding

* - add notice to GO code
- v fmt base64.v

* implement new decoding function

* fix base64_memory_test.v by commenting a few lines

* vfmt base64.v

* add some more asserts to base64_memory_test.v

* remove unused decoding function

* add bounds check, when detecting the padding

* use union for storing the decoded data

Co-authored-by: Delyan Angelov <delian66@gmail.com>
2021-08-07 00:09:55 +03:00
Caden Haustein
cf0767ad6c v: add constant folding AST transformation (#11085) 2021-08-06 23:19:18 +03:00
yuyi
ec39e38e14 cgen: fix generic method on alias struct receiver (#11080) 2021-08-06 21:26:54 +03:00
Daniel Däschle
3b116d2455 cgen: support embedded struct fields on sumtype common fields (#11084) 2021-08-06 21:26:19 +03:00
Dialga
25d49bc615 orm: handle empty fields (#11083) 2021-08-06 21:25:38 +03:00
alula
e1cc1665dc cgen: push function arguments in fn_args() (#11086) 2021-08-06 20:01:20 +03:00
Delyan Angelov
4f2fe50b9b ci: disable running gitly for now (timeouts because of shared deadlock since 91ade5b) 2021-08-06 17:31:55 +03:00
Uwe Krüger
e89bed3e25 ci: temporarily deactivate test case for #11061 (fixes CI timeouts) (#11079) 2021-08-06 12:46:56 +03:00
Louis Schmieder
a4358a6801 orm: fix unique fields (#11045) 2021-08-06 06:21:59 +03:00
zakuro
490dec222f fmt: keep char literal, ' (#11060) 2021-08-06 06:21:28 +03:00
yuyi
b95224aa20 vself: fix command line args (#11072) 2021-08-06 06:21:00 +03:00
Daniel Däschle
91ade5bf8c cgen: fix shared field init (#11061) 2021-08-06 05:11:03 +03:00
Enzo
44bacfc931 cgen: fix optional generation order (#11070) 2021-08-06 03:57:34 +03:00
Enzo
7346aeca5f cgen: refactor array sort generation (#11067) 2021-08-06 03:55:48 +03:00
Daniel Däschle
8d2567740b parser: make [..] work (#11064) 2021-08-06 03:54:24 +03:00
yuyi
c30cda3daf v.gen.c: fix error of println(alias of struct) (#11062) 2021-08-05 20:20:10 +03:00
yuyi
11784279ba checker: check fn_call().sort() (fix #11040) (#11056) 2021-08-04 21:23:22 +03:00
Daniel Däschle
f59119485a v.parser: add check for existing type on sum type declaration (#11054) 2021-08-04 18:14:16 +03:00
Daniel Däschle
310b51c883 vlib: remove unused os2 module (#11053) 2021-08-04 17:56:08 +03:00
Delyan Angelov
f9c279d11d v.checker: make calling a deprecated fn an error, 180 days (6 months) after its deprecation date (#10682) 2021-08-04 17:41:00 +03:00
Delyan Angelov
efa8dcf4d2 time: turn Time.unix to i64, so it can represent times before 1970-01-01, fix time operators, add more tests (#11050) 2021-08-04 13:12:02 +03:00
Delyan Angelov
1bf6d04e37 ci: fix failing program_test.v due to deprecation warnings 2021-08-04 12:58:06 +03:00
yuyi
5162c257a2 v.parser: minor cleanup in parse_type.v (#11047) 2021-08-04 12:49:36 +03:00
playX
8743b616a0 v.gen.js: codegen fixes, add a few builtins, port more array tests (#11049) 2021-08-04 12:46:24 +03:00
Daniel Däschle
800c0e5092 vlib: remove deprecated map{} usages as well as deprecated functions (#11035) 2021-08-04 12:44:41 +03:00
yuyi
b870f7a6f1 cgen: fix array sort error (#11046) 2021-08-04 06:31:57 +03:00
yuyi
2eb11110d6 cgen: fix autofree error of array init with string variable (fix #10427) (#11041) 2021-08-04 03:39:20 +03:00
Daniel Däschle
815c4b7420 all: rename generic_struct_inst to generic_inst (#11044) 2021-08-04 03:37:27 +03:00
Delyan Angelov
c13ba6d4b6 ci: fix ci.yml syntax 2021-08-03 18:55:23 +03:00
Leo Developer
3677391329 vdoc: add v/preludes_js/ to .vdocignore (#11039) 2021-08-03 18:52:45 +03:00
Alexander Medvednikov
a39962a6b9 tutorials: fix blog.v code formatting 2021-08-03 16:13:41 +03:00
pancake
00d4c7082e native: add support for print, eprint and eprintln (#11034) 2021-08-03 16:04:31 +03:00
Alexander Medvednikov
80976e640c vweb: remove init_server() from all examples, tutorials, and tests 2021-08-03 16:03:16 +03:00
Alexander Medvednikov
f879b3e221 ci: run gitly 2021-08-03 15:41:52 +03:00
playX
0455632b1f v.gen.js: fix prefix, postfix and assign codegen and add more array tests (#11031) 2021-08-03 14:59:46 +03:00
Delyan Angelov
0ebad47d2a v doc: fix an infinite recursion in v doc . executed in /tmp. Add tests for v.doc.get_parent_mod/1 . 2021-08-03 13:36:58 +03:00
yuyi
fd58e9f819 cgen: fix auto str for map of reference struct (fix #11024) (#11028) 2021-08-03 08:03:00 +03:00
Enzo
fc193bebf2 builtin: add documentation for builtin array functions (#11023) 2021-08-03 06:25:33 +03:00
Louis Schmieder
a55ba08fad orm: fix time (#11026) 2021-08-03 05:17:00 +03:00
Leo Developer
6dcf72fe9b cgen: dont generate function if its flag is false (#11021) 2021-08-03 03:17:22 +03:00
Yuval Greenfield
820669b011 math.fractions: make the numerator and denominator public (#11018) 2021-08-02 18:50:11 +03:00
Florian Blasius
69f31d8d5c checker: check int literal to enum cast (fix #10125) (#10348) 2021-08-02 07:12:29 +03:00
RotoDhoulmagus
b88b17aca5 docs: fix a typo in the Module import aliasing section (#11017) 2021-08-02 07:11:03 +03:00
shadow
eca7af107a examples: fix static vweb assets example (#11008) 2021-08-01 21:46:30 +03:00
pancake
dbf5c976a3 v.gen.native: support more ifs constructs for amd64 (#11007) 2021-08-01 20:19:02 +03:00
Miccah
cc9463401e http: change server handler from function to interface (#10994) 2021-08-01 15:50:11 +03:00
playX
836ac54d12 v.gen.js: add more array tests and fixes (#11014) 2021-08-01 14:08:49 +03:00
playX
77e9ed417f v.gen.js: fix segfault when anonymous function is declared with assertion (#11009) 2021-08-01 07:27:44 +03:00
Delyan Angelov
33e4dc3ad3 ci: fix coutput_test.v on windows by fixing -o - on windows 2021-08-01 00:27:06 +03:00
Uwe Krüger
6068777e03 parser/checker: deduce type of global from initialization expression (#11005) 2021-07-31 16:35:19 +03:00
Lukas Neubert
c1f3eb6014 make.bat: clean-all --> cleanall (#11011) 2021-07-31 16:33:24 +03:00
Delyan Angelov
e374ffb590 checker: add an early checker error for node.left_types.len != node.left.len in assignments 2021-07-31 14:57:29 +03:00
Delyan Angelov
9082712e10 ci: skip coutput_test.v on windows temporarily 2021-07-31 14:17:33 +03:00
Delyan Angelov
d82d41d804 os: fix os.dir, os.base, os.file_name, when the argument contains / on windows 2021-07-31 13:52:54 +03:00
Delyan Angelov
1231e5df20 debug coutput_test.v on windows 2021-07-31 13:27:28 +03:00
Delyan Angelov
456a19f6d4 ci: fix coutput_test.v on windows 2021-07-31 13:16:33 +03:00
Delyan Angelov
d2e28e8fc5 docs: describe how coutput_test.v works 2021-07-31 12:29:22 +03:00
Delyan Angelov
08016ab374 v.gen.c: add vlib/v/gen/c/coutput_test.v, to ease testing of produced C output 2021-07-31 12:14:56 +03:00
Delyan Angelov
033b027361 v.gen.c: use const type* const_x for const_x &type fn args 2021-07-31 08:42:40 +03:00
Delyan Angelov
2158597831 ci: ignore changes in .md files for the vinix-build job 2021-07-31 06:33:32 +03:00
JalonSolov
dbacf9cfab doc: add calling V from C to toc (#11006) 2021-07-31 02:31:15 +03:00
Alexander Medvednikov
19c11bace9 doc: document calling V from C 2021-07-31 01:44:24 +03:00
Delyan Angelov
0675079b98 ci: skip const_comptime_eval_before_vinit_test.v with MSVC 2021-07-30 21:46:59 +03:00
Delyan Angelov
26b7712bbe tests: add a regression test for the comptime evaluated consts, using a _constructor function 2021-07-30 20:33:08 +03:00
Louis Schmieder
0bb587c8c2 checker: fix defer ident handling & fix defer optional error message (#10975) 2021-07-30 20:29:06 +03:00
Uwe Krüger
a7c2aaf35b cgen: initialize globals directly for simple cases (#11002) 2021-07-30 19:20:45 +03:00
Delyan Angelov
f67922782e ci: fix tools using import math, for const x = i64(-9223372036854775807-1) fails 2021-07-30 17:56:46 +03:00
Delyan Angelov
06d1422a05 ast,checker,cgen: support simple const x = u16(0x53) without using _vinit() 2021-07-30 17:22:27 +03:00
Delyan Angelov
afb7168a64 hash: move dummy map initialisation into an fn init(){}, so users do not have to do it explicitly to be compatible with -skip-unused 2021-07-30 13:25:37 +03:00
Hunam
0f09228adb vdoc: fix wrong escaping in HTML docs (#10638) 2021-07-30 12:00:03 +03:00
Delyan Angelov
6674d65397 ci: describe more precisely for which modules the sanitised jobs will run 2021-07-30 11:37:19 +03:00
playX
a7ca051016 v.gen.js: fix for array filter, add more tests and other fixes (#10999) 2021-07-30 11:17:11 +03:00
Delyan Angelov
ab6ab519e6 ci: only run sanitized jobs on changes to the compiler itself (vlib/v/) 2021-07-30 11:11:09 +03:00
Delyan Angelov
c31397e17d tests: fix v test-self running locally 2021-07-30 09:26:05 +03:00
Alexander Medvednikov
ec92964bb0 checker: make interface init check a warning for now 2021-07-30 03:32:02 +03:00
Delyan Angelov
7d5b6d2b48 fix running v run file.v in a current working folder containing a run/ subfolder 2021-07-30 03:28:54 +03:00
Delyan Angelov
44892fd942 os: let os.dir("/xyz") return "/" (fixes compiling .v files in /) 2021-07-30 03:28:53 +03:00
Louis Schmieder
7c504920e1 checker: fix negative values for unsigned integers (#10976) 2021-07-30 03:27:59 +03:00
Daniel Däschle
6fa8e4269e checker: force interface init (#10910) 2021-07-30 03:18:20 +03:00
blackshirt
1eac351f25 math.big: change the return value of divmod to (quotient, remainder) (#10993) 2021-07-30 02:28:32 +03:00
pancake
6337325676 v.gen.native: improve few x64 generators (#10996) 2021-07-30 01:26:49 +03:00
pancake
5a6d17786c v help build: replace x64 backend reference with native (#10995) 2021-07-30 01:25:16 +03:00
Uwe Krüger
44d8dcc418 ci,globals: hot fix for hanging test case (#10997) 2021-07-29 22:06:08 +03:00
Delyan Angelov
c7ecb18f52 ci: bump timeout-minutes from 60 minutes to 121 minutes for normal 'fast' jobs 2021-07-29 18:04:02 +03:00
Delyan Angelov
0b46d62199 ci: bump timeout-minutes for the sanitize jobs to 180 2021-07-29 16:29:53 +03:00
Lukas Neubert
1e255d3ab1 fmt: cleanup redundant generic types code (#10990) 2021-07-29 15:21:10 +03:00
Delyan Angelov
ae05ab880e ci: fix ubuntu-tcc job 2021-07-29 14:25:33 +03:00
yuyi
57f30668e3 v.checker: fix a.map(voidfn(it)) (#10985) 2021-07-29 11:43:56 +03:00
playX
75c41252d9 js: add more tests & add array prepend codegen (#10988) 2021-07-29 11:39:36 +03:00
Uwe Krüger
08aa6c08f6 all: more improvements for global variables (#10986) 2021-07-29 10:57:31 +03:00
Delyan Angelov
7547882c11 ci: fix failing fn_args.vv (use zu8 as a temporary name of the unaliased u8 type, since uu8 is already used in fn_args.vv as a function name) 2021-07-29 10:14:55 +03:00
Delyan Angelov
7a9b326200 ci: fix -cstrict rebuilding of V with clang 2021-07-29 09:54:52 +03:00
Delyan Angelov
066dd023d2 Revert "Revert "ci: minor optimization in the cancel workflow (#10978)""
This reverts commit 7704685458.

The real reason is not that PR, but just github being flaky lately :-| .
2021-07-29 09:28:42 +03:00
Alexander Medvednikov
b79dd7f0b3 builtin: re-enable u8 alias 2021-07-29 06:46:12 +03:00
Alexander Medvednikov
09df5adbdd builtin: re-gen v.c 2021-07-29 06:45:04 +03:00
Alexander Medvednikov
1343ec7444 builtin: fix temporary u8 alias 2021-07-29 06:42:22 +03:00
Alexander Medvednikov
0b9b80e0c9 cgen: register u8 2021-07-29 05:02:13 +03:00
Alexander Medvednikov
628498e0dc table: register u8 type 2021-07-29 05:00:03 +03:00
Alexander Medvednikov
a7270148e5 builtin: remove u8 alias to re-generate v.c 2021-07-28 22:41:41 +03:00
Roj Serbest
cd03d31989 examples: fix a typo (#10984) 2021-07-28 22:39:37 +03:00
Alexander Medvednikov
65126efdc3 builtin: remove u8 for now 2021-07-28 22:36:04 +03:00
Delyan Angelov
7704685458 Revert "ci: minor optimization in the cancel workflow (#10978)"
This reverts commit 61ed1d810f.

Reason: queued fast jobs for all CI runs on merged commits on master
after that PR.
https://cdn.discordapp.com/attachments/722442086984450159/870022126663520276/unknown.png
2021-07-28 22:19:14 +03:00
Delyan Angelov
d25bd95a0e v: support -show-depgraph in addition to -show-callgraph 2021-07-28 16:42:11 +03:00
playX
e3cf95b058 js: add more tests for array, support array insert_many, minor fixes for references (#10983) 2021-07-28 13:01:00 +03:00
shadow
66bc8bc0cb vlib: remove many deprecated functions (#10972) 2021-07-28 09:22:19 +03:00
yuyi
9f4431544d checker: fix typo in selector_expr() (#10977) 2021-07-28 08:28:55 +03:00
Lukas Neubert
64458c9308 docs: float exponential syntax (#10973) 2021-07-28 08:21:42 +03:00
Uwe Krüger
45ad48d76a cgen: properly handle initialization expression for globals (#10981) 2021-07-28 08:11:55 +03:00
spaceface
61ed1d810f ci: minor optimization in the cancel workflow (#10978)
before this we scheduled two additional workflows, one for each workflow.
This PR now schedules just one, which cancels both workflows by itself.
2021-07-27 21:49:18 +03:00
Delyan Angelov
8eb544146e os: fix building V on Haiku 2021-07-27 20:28:04 +03:00
Uwe Krüger
abd17ddb6a cgen: initialize globals with default initializer when none is given. (#10979) 2021-07-27 20:14:30 +03:00
Alexander Medvednikov
a56f579e0d Revert "cgen: define new u8 type"
This reverts commit b7f2adb69c.
2021-07-27 19:38:48 +03:00
Alexander Medvednikov
b7f2adb69c cgen: define new u8 type 2021-07-27 19:07:47 +03:00
Delyan Angelov
ef0161c233 v.markused: handle compiling vweb, -live and orm example programs 2021-07-27 15:50:42 +03:00
Miccah
e98817e5ce sync: only release semaphore in WaitGroup when there are waiters (#10967) 2021-07-27 15:49:51 +03:00
Delyan Angelov
b0a721b2ec js: draft support for compiling -b js x_test.v 2021-07-27 13:49:47 +03:00
Delyan Angelov
90b9b9d755 v doc: small clean of Return to contents markdown link 2021-07-27 13:00:07 +03:00
Delyan Angelov
6e0c9f637d v.markused: support import json programs too 2021-07-27 13:00:07 +03:00
Delyan Angelov
6134c4870b v.util: extract v.util.version, use it to speed up building v repl, v up and v doctor 2021-07-27 12:59:56 +03:00
3914 changed files with 439494 additions and 77401 deletions

18
.cirrus.yml Normal file
View File

@@ -0,0 +1,18 @@
freebsd_instance:
image_family: freebsd-13-0
freebsd_task:
name: Code CI / freebsd
install_script: pkg install -y git
script: |
echo 'Building V'
git clone https://github.com/vlang/v
cd v
make
##.github/workflows/freebsd_build_tcc.sh
##tcc -v -v
echo 'Build cmd/tools/fast'
cd cmd/tools/fast && ../../../v fast.v && ./fast -clang
echo 'Run test-self'
cd /tmp/cirrus-ci-build/v
VTEST_JUST_ESSENTIAL=1 ./v test-self

View File

@@ -16,9 +16,14 @@ indent_size = 2
[*.md]
trim_trailing_whitespace = false
# lines that are too long will trigger an error in cmd/tools/vcheck-md.v
# run v check-md [folder/file] to test markdown files
# the longest normal line is specified with this constant:
# `too_long_line_length_other = 100`
max_line_length = 100
[*.{txt,out}]
insert_final_newline = false
[Makefile]
[{Makefile,GNUmakefile}]
indent_style = tab

3
.gitattributes vendored
View File

@@ -1,4 +1,7 @@
*.v linguist-language=V text=auto eol=lf
*.vv linguist-language=V text=auto eol=lf
*.vsh linguist-language=V text=auto eol=lf
**/v.mod linguist-language=V text=auto eol=lf
*.bat text=auto eol=crlf
Dockerfile.* linguist-language=Dockerfile
*.toml text eol=lf

View File

@@ -14,6 +14,8 @@ assignees: ''
**V version:**
**OS:**
<!-- Please include the standalone minimal reproducible code.
If not, it may be closed by the administrators. -->
**What did you do?**

View File

@@ -2,7 +2,7 @@
<!--
Please title your PR as follows: `time: fix foo bar`.
Please title your PR as follows: `module: description` (e.g. `time: fix date format`).
Always start with the thing you are fixing, then describe the fix.
Don't use past tense (e.g. "fixed foo bar").

View File

@@ -15,6 +15,8 @@ ls -lat
## try running the known failing tests first to get faster feedback
./v test vlib/builtin/string_test.v vlib/strings/builder_test.v
./v test-cleancode
./v test-self
./v build-vbinaries

67
.github/workflows/android_cross_compile.vsh vendored Executable file
View File

@@ -0,0 +1,67 @@
#!/usr/bin/env -S v
module main
import os
import vab.vxt
import vab.android.ndk
fn main() {
assert ndk.found()
assert vxt.found()
work_dir := os.join_path(os.temp_dir(), 'android_cross_compile_test')
os.rm(work_dir) or {}
os.mkdir_all(work_dir) or { panic(err) }
vexe := vxt.vexe()
examples_dir := os.join_path(vxt.home(), 'examples')
v_example := os.join_path(examples_dir, 'toml.v')
ndk_version := ndk.default_version()
sysroot_path := ndk.sysroot_path(ndk_version) or { panic(err) }
include_path := os.join_path(sysroot_path, 'usr', 'include')
android_include_path := os.join_path(include_path, 'android')
//'-I"$include_path"'
cflags := ['-I"$android_include_path"', '-Wno-unused-value', '-Wno-implicit-function-declaration',
'-Wno-int-conversion']
for arch in ndk.supported_archs {
for level in ['min', 'max'] {
compiler_api := match level {
'min' {
ndk.compiler_min_api(.c, ndk_version, arch) or { panic(err) }
}
'max' {
ndk.compiler_max_api(.c, ndk_version, arch) or { panic(err) }
}
else {
panic('invalid min/max level')
}
}
os.setenv('VCROSS_COMPILER_NAME', compiler_api, true)
c_file := os.join_path(work_dir, arch + '-' + level + '.c')
o_file := os.join_path(work_dir, arch + '-' + level + '.o')
// x.v -> x.c
v_compile_cmd := '$vexe -o $c_file -os android -gc none $v_example'
vres := os.execute(v_compile_cmd)
if vres.exit_code != 0 {
panic('"$v_compile_cmd" failed: $vres.output')
}
assert os.exists(c_file)
// x.c -> x.o
compile_cmd := '$compiler_api ${cflags.join(' ')} -c $c_file -o $o_file'
cres := os.execute(compile_cmd)
if cres.exit_code != 0 {
panic('"$compile_cmd" failed: $cres.output')
}
assert os.exists(o_file)
compiler_exe_name := os.file_name(compiler_api)
println('Compiled examples/toml.v successfully for ($level) $arch $compiler_exe_name')
}
}
}

View File

@@ -2,206 +2,162 @@ name: Build binary artifacts
on:
push:
tags:
- weekly.**
- 0.**
tags:
- weekly.**
- 0.**
jobs:
build-linux:
runs-on: ubuntu-20.04
strategy:
matrix:
compiler: [gcc]
steps:
- uses: actions/checkout@v1
- name: Compile
env:
CC: ${{ matrix.compiler }}
run: |
make -j4
./v -cc $CC -o v -prod cmd/v
./v -prod cmd/tools/vup.v
./v -prod cmd/tools/vdoctor.v
- name: Create artifact
uses: actions/upload-artifact@v2
with:
name: linux
path: |
.
./cmd/tools/vup
./cmd/tools/vdoctor
!./.git
!./vc
!./v_old
- name: Create binary only artifact
uses: actions/upload-artifact@v2
with:
name: linux-binary
path: ./v
build-linux-arm64:
runs-on: ubuntu-20.04
strategy:
matrix:
compiler: [gcc]
env:
img: quay.io/pypa/manylinux2014_aarch64
CC: gcc
ZIPNAME: v_linux.zip
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v1
- name: Compile
env:
CC: ${{ matrix.compiler }}
run: |
docker run --platform=linux/arm64 --rm -v `pwd`:`pwd` -w `pwd` ${{ env.img }} /bin/bash -c "make -j4 && ./v -cc $CC -o v -prod cmd/v && ./v -prod cmd/tools/vup.v && ./v -prod cmd/tools/vdoctor.v"
- name: Create artifact
uses: actions/upload-artifact@v2
with:
name: linux_arm64
path: |
.
./cmd/tools/vup
./cmd/tools/vdoctor
!./.git
!./vc
!./v_old
- name: Create binary only artifact
uses: actions/upload-artifact@v2
with:
name: linux_arm64-binary
path: ./v
- uses: actions/checkout@v1
- name: Compile
run: |
make -j4
./v -cc $CC -prod -o v cmd/v
./v -cc $CC -prod cmd/tools/vup.v
./v -cc $CC -prod cmd/tools/vdoctor.v
- name: Remove excluded
run: |
rm -rf .git
rm -rf vc/
rm -rf v_old
- name: Create ZIP archive
run: |
cd ..
zip -r9 --symlinks $ZIPNAME v/
mv $ZIPNAME v/
cd v/
- name: Create artifact
uses: actions/upload-artifact@v2
with:
name: linux
path: v_linux.zip
build-macos:
runs-on: macos-latest
strategy:
matrix:
compiler: [clang]
env:
CC: clang
ZIPNAME: v_macos.zip
steps:
- uses: actions/checkout@v1
- name: Compile
env:
CC: ${{ matrix.compiler }}
run: |
make -j4
./v -cc $CC -o v -prod cmd/v
./v -prod cmd/tools/vup.v
./v -prod cmd/tools/vdoctor.v
- name: Create artifact
uses: actions/upload-artifact@v2
with:
name: macos
path: |
.
./cmd/tools/vup
./cmd/tools/vdoctor
!./.git
!./vc
!./v_old
- name: Create binary only artifact
uses: actions/upload-artifact@v2
with:
name: macos-binary
path: ./v
- uses: actions/checkout@v1
- name: Compile
run: |
make -j4
./v -cc $CC -prod -o v cmd/v
./v -cc $CC -prod cmd/tools/vup.v
./v -cc $CC -prod cmd/tools/vdoctor.v
- name: Remove excluded
run: |
rm -rf .git
rm -rf vc/
rm -rf v_old
- name: Create ZIP archive
run: |
cd ..
zip -r9 --symlinks $ZIPNAME v/
mv $ZIPNAME v/
cd v/
- name: Create artifact
uses: actions/upload-artifact@v2
with:
name: macos
path: v_macos.zip
build-windows:
runs-on: windows-latest
env:
CC: msvc
ZIPNAME: v_windows.zip
steps:
- uses: actions/checkout@v1
- uses: msys2/setup-msys2@v2
- name: Compile
run: |
.\make.bat
.\v.exe cmd\tools\vup.v
.\v.exe cmd\tools\vdoctor.v
- name: Create artifact
uses: actions/upload-artifact@v2
with:
name: windows
path: |
.
./cmd/tools/vup.exe
./cmd/tools/vdoctor.exe
!./.git
!./vc
!./v_old.exe
- name: Create binary only artifact
uses: actions/upload-artifact@v2
with:
name: windows-binary
path: ./v.exe
- uses: actions/checkout@v1
- uses: msys2/setup-msys2@v2
- name: Compile
run: |
.\make.bat -tcc
.\v.exe cmd\tools\vup.v
.\v.exe cmd\tools\vdoctor.v
- name: Remove excluded
shell: msys2 {0}
run: |
rm -rf .git
rm -rf vc/
rm -rf v_old.exe
- name: Create archive
shell: msys2 {0}
run: |
cd ..
powershell Compress-Archive v $ZIPNAME
mv $ZIPNAME v/
cd v/
# NB: the powershell Compress-Archive line is from:
# https://superuser.com/a/1336434/194881
# It is needed, because `zip` is not installed by default :-|
- name: Create artifact
uses: actions/upload-artifact@v2
with:
name: windows
path: v_windows.zip
release:
name: Create Github Release
needs: [build-linux-arm64, build-linux, build-windows, build-macos]
needs: [build-linux, build-windows, build-macos]
runs-on: ubuntu-20.04
steps:
- name: Get short tag name
uses: jungwinter/split@v1
id: split
with:
msg: ${{ github.ref }}
seperator: /
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.split.outputs._2 }}
name: ${{ steps.split.outputs._2 }}
commit: ${{ github.sha }}
draft: false
prerelease: false
- name: Get short tag name
uses: jungwinter/split@v1
id: split
with:
msg: ${{ github.ref }}
seperator: /
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.split.outputs._2 }}
name: ${{ steps.split.outputs._2 }}
commit: ${{ github.sha }}
draft: false
prerelease: false
publish:
needs: [release]
runs-on: ubuntu-20.04
strategy:
matrix:
version: [linux_arm64, linux, macos, windows]
version: [linux, macos, windows]
steps:
- uses: actions/checkout@v1
- name: Fetch artifacts
uses: actions/download-artifact@v1
with:
name: ${{ matrix.version }}
path: ./${{ matrix.version }}
- name: Build Zip Archives
run: |
mkdir -p workdir/
mv ${{ matrix.version }}/ workdir/v/
cd workdir/v/
chmod 755 v || true
chmod 755 v.exe || true
chmod 755 thirdparty/tcc/tcc.exe || true
chmod 755 cmd/tools/vup || true
chmod 755 cmd/tools/vup.exe || true
chmod 755 cmd/tools/vdoctor || true
chmod 755 cmd/tools/vdoctor.exe || true
rm -rf v_old v_old.exe
cd ..
zip -r9 --symlinks ../v_${{ matrix.version }}.zip v/*
cd ..
rm -rf workdir/
- name: Get short tag name
uses: jungwinter/split@v1
id: split
with:
msg: ${{ github.ref }}
seperator: /
- name: Get release
id: get_release_info
uses: leahlundqvist/get-release@v1.3.1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tag_name: ${{ steps.split.outputs._2 }}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: ./v_${{ matrix.version }}.zip
asset_name: v_${{ matrix.version }}.zip
asset_content_type: application/zip
- uses: actions/checkout@v1
- name: Fetch artifacts
uses: actions/download-artifact@v1
with:
name: ${{ matrix.version }}
path: ./${{ matrix.version }}
- name: Get short tag name
uses: jungwinter/split@v1
id: split
with:
msg: ${{ github.ref }}
seperator: /
- name: Get release
id: get_release_info
uses: leahlundqvist/get-release@v1.3.1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tag_name: ${{ steps.split.outputs._2 }}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: ${{ matrix.version }}/v_${{ matrix.version }}.zip
asset_name: v_${{ matrix.version }}.zip
asset_content_type: application/zip

132
.github/workflows/c2v.yml vendored Normal file
View File

@@ -0,0 +1,132 @@
name: C2V apps
on:
push:
paths-ignore:
- "**.md"
- "**.yml"
- "doc/**"
- "examples/**"
- "tutorials/**"
pull_request:
paths-ignore:
- "**.md"
- "**.yml"
- "doc/**"
- "examples/**"
- "tutorials/**"
concurrency:
group: build-c2v-apps-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
doom-compiles:
runs-on: ubuntu-20.04
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- name: Build V
run: make && ./v symlink -githubci
- name: Build C2V
run: |
echo "Clone C2V"
mkdir -p ~/code/
git clone --depth 1 https://github.com/vlang/c2v ~/code/c2v
ln -s ~/code/c2v ~/.vmodules/c2v
v -g ~/.vmodules/c2v/
~/.vmodules/c2v/c2v || true
- name: Install Doom Dependencies
run: |
sudo apt-get update -y -qq
sudo apt-get install libsdl2-dev libsdl2-mixer-dev libsdl2-net-dev libpng-dev libsamplerate0-dev
- name: Build original Chocolate Doom
run: |
git clone --quiet --depth 1 https://github.com/vlang/doom ~/code/doom
cd ~/code/doom/chocolate-doom
cmake -DCMAKE_BUILD_TYPE=Debug .
make chocolate-doom
- name: Translate the whole game in project/folder mode and compile it
run: |
cd ~/code/doom
touch ~/DOOM1.WAD
WAD_FILE=~/DOOM1.WAD ~/code/doom/build_whole_project.sh
doom-regressions:
runs-on: ubuntu-20.04
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 10
env:
VFLAGS: -cc tcc
DISPLAY: :99
LIBGL_ALWAYS_SOFTWARE: true
steps:
- uses: actions/checkout@v2
- name: Build V
run: make && ./v symlink -githubci
- name: Setup dependencies
run: |
sudo apt-get update -y -qq
# c2v / DOOM dependencies
sudo apt-get install libsdl2-dev libsdl2-mixer-dev libsdl2-net-dev libpng-dev libsamplerate0-dev
# vgret dependencies
# imagemagick : convert, mogrify, import
# xvfb : For starting X11 Virtual FrameBuffers
# openimageio-tools : idiff
# libgl1-mesa-dri : For headless rendering / software DRI driver (LIBGL_ALWAYS_SOFTWARE=true)
# freeglut3-dev : Fixes graphic apps compilation with tcc
sudo apt-get install imagemagick openimageio-tools freeglut3-dev libgl1-mesa-dri xvfb xsel xclip
# Fetch the free ~4MB DOOM1.WAD from the link at https://doomwiki.org/wiki/DOOM1.WAD
wget https://distro.ibiblio.org/slitaz/sources/packages/d/doom1.wad -O ~/doom1.wad
# Get imgur upload script
wget https://raw.githubusercontent.com/tremby/imgur.sh/c98345d/imgur.sh
chmod +x ./imgur.sh
# Get regression images to test against
git clone https://github.com/Larpon/doom-regression-images
- name: Build C2V
run: |
echo "Clone C2V"
mkdir -p ~/code/
git clone --depth 1 https://github.com/vlang/c2v ~/code/c2v
ln -s ~/code/c2v ~/.vmodules/c2v
v -g ~/.vmodules/c2v/
~/.vmodules/c2v/c2v || true
- name: Build original Chocolate Doom
run: |
git clone --quiet --depth 1 https://github.com/vlang/doom ~/code/doom
cd ~/code/doom/chocolate-doom
cmake -DCMAKE_BUILD_TYPE=Debug .
make chocolate-doom
- name: Translate the whole game in project/folder mode
run: |
cd ~/code/doom
WAD_FILE=~/doom1.wad ~/code/doom/build_whole_project.sh
- name: Sample and compare with vgret
id: compare
continue-on-error: true
run: |
Xvfb $DISPLAY -screen 0 800x600x24 &
sleep 1 # give xvfb time to start
v gret -r ~/code/doom -t ./doom-regression-images/vgret.doom.toml -v ./doom-sample_images ./doom-regression-images
- name: Upload regression to imgur
if: steps.compare.outcome != 'success'
run: |
./imgur.sh /tmp/fail.png
./imgur.sh /tmp/diff.png
exit 1

View File

@@ -2,7 +2,7 @@ name: Cancel previous workflows
on:
workflow_run:
workflows: ["Code CI", "Sanitized CI"] # the other workflows finish quickly - no need to skip them for now
workflows: ["Code CI"]
types:
- requested
@@ -14,4 +14,5 @@ jobs:
# don't cancel CI for commits pushed to vlang/v#master (if ci is still too slow, this can be removed safely)
if: ${{ github.event.workflow_run.head_repository.full_name != 'vlang/v' || github.event.workflow_run.head_branch != 'master' }}
with:
workflow_id: ${{ github.event.workflow.id }}
# workflow ids for `Code CI` and `Sanitized CI` (from https://api.github.com/repos/vlang/v/actions/workflows):
workflow_id: 4577,7940868 # the other workflows finish quickly - no need to skip them

View File

@@ -4,52 +4,21 @@ on:
push:
paths-ignore:
- "**.md"
- "**.yml"
pull_request:
paths-ignore:
- "**.md"
- "**.yml"
concurrency:
group: build-ci-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
no-scheduling:
runs-on: ubuntu-latest
steps:
- name: Dont schedule all jobs
run: sleep 10
code-formatting-perf-regressions:
needs: no-scheduling
runs-on: ubuntu-20.04
timeout-minutes: 15
env:
VFLAGS: -cc gcc
steps:
- uses: actions/checkout@v2
- name: Environment info
run: echo $VFLAGS $GITHUB_SHA $GITHUB_REF
- name: Build local v
run: make -j4
- name: v test-cleancode
run: ./v -silent test-cleancode
- name: v test-fmt
run: ./v -silent test-fmt
## Performance regressions
- name: Clone & Build vmaster/v
run: |
git clone --depth=1 https://github.com/vlang/v vmaster/
(cd vmaster; make -j4)
- name: V versions
run: ./v version && ./vmaster/v version
- name: Build the repeat tool
run: ./v cmd/tools/repeat.v
- name: Repeat -o hw.c examples/hello_world.v
run: cmd/tools/repeat --max_time 201 --series 3 --count 20 --nmins 2 --nmaxs 5 --warmup 3 --fail_percent 10 -t 'cd {T} ; ./v -show-timings -o hw.c examples/hello_world.v' . ./vmaster
- name: Repeat -o v.c cmd/v
run: cmd/tools/repeat --max_time 1201 --series 3 --count 20 --nmins 2 --nmaxs 5 --warmup 3 --fail_percent 10 -t 'cd {T} ; ./v -show-timings -o v.c cmd/v' . ./vmaster
ubuntu-tcc:
needs: no-scheduling
runs-on: ubuntu-20.04
timeout-minutes: 60
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 121
env:
VFLAGS: -cc tcc -no-retry-compilation
steps:
@@ -62,11 +31,13 @@ jobs:
## The following is needed for examples/wkhtmltopdf.v
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb
sudo apt-get install --quiet -y xfonts-75dpi xfonts-base
sudo apt-get install --quiet -y expect
sudo dpkg -i wkhtmltox_0.12.6-1.focal_amd64.deb
- name: Build v
run: |
echo $VFLAGS
make
./v test-cleancode
./v -d debug_malloc -d debug_realloc -o v cmd/v
./v -cg -cstrict -o v cmd/v
# Test v -realloc arena allocation
@@ -75,7 +46,7 @@ jobs:
run: |
thirdparty/tcc/tcc.exe -version
./v -cg -o v cmd/v # Make sure vtcc can build itself twice
# ./v -silent test-all
# ./v test-all
- name: v self compilation
run: ./v -o v2 cmd/v && ./v2 -o v3 cmd/v && ./v3 -o v4 cmd/v
- name: v self compilation with -skip-unused
@@ -85,12 +56,15 @@ jobs:
./v doctor
- name: Verify `v test` works
run: |
echo $VFLAGS
./v cmd/tools/test_if_v_test_system_works.v
./cmd/tools/test_if_v_test_system_works
- name: All code is formatted
run: ./v test-cleancode
- name: Self tests
run: ./v -silent test-self
run: ./v test-self
# - name: Self tests (-cstrict)
# run: ./v -cstrict test-self
# run: V_CI_CSTRICT=1 ./v -cstrict test-self
- name: Test time functions in a timezone UTC-12
run: TZ=Etc/GMT+12 ./v test vlib/time/
- name: Test time functions in a timezone UTC-3
@@ -107,16 +81,30 @@ jobs:
run: ./v -W build-tools
- name: Test v binaries
run: ./v build-vbinaries
- name: Run a VSH script
run: ./v run examples/v_script.vsh
- name: Test v tutorials
run: |
./v tutorials/building_a_simple_web_blog_with_vweb/code/blog
run: ./v tutorials/building_a_simple_web_blog_with_vweb/code/blog
- name: Build cmd/tools/fast
run: cd cmd/tools/fast && ../../../v fast.v && ./fast
- name: V self compilation with -usecache
run: |
unset VFLAGS
./v -usecache examples/hello_world.v && examples/hello_world
./v -o v2 -usecache cmd/v
./v2 -o v3 -usecache cmd/v
./v3 version
./v3 -o tetris -usecache examples/tetris/tetris.v
- name: Test password input
run: |
./v examples/password
./v examples/password/password_ci.vsh
ubuntu-tcc-boehm-gc:
needs: no-scheduling
runs-on: ubuntu-20.04
timeout-minutes: 60
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 121
env:
VFLAGS: -cc tcc -no-retry-compilation
steps:
@@ -150,131 +138,33 @@ jobs:
run: |
./v -gc boehm cmd/tools/test_if_v_test_system_works.v
./cmd/tools/test_if_v_test_system_works
- name: All code is formatted
run: ./v test-cleancode
- name: Self tests with `-gc boehm` with V compiler using Boehm-GC itself
run: ./v -gc boehm -silent test-self
run: ./v -gc boehm test-self
- name: Test leak detector
run: |
./v -gc boehm_leak -o testcase_leak vlib/v/tests/testcase_leak.v
./v -gc boehm_leak -o testcase_leak vlib/v/tests/testcase_leak.vv
./testcase_leak 2>leaks.txt
grep "Found 1 leaked object" leaks.txt && grep ", sz=1000," leaks.txt
grep "Found 1 leaked object" leaks.txt && grep -P ", sz=\s?1000," leaks.txt
- name: Test leak detector not being active for `-gc boehm`
run: |
./v -gc boehm -o testcase_leak vlib/v/tests/testcase_leak.v
./v -gc boehm -o testcase_leak vlib/v/tests/testcase_leak.vv
./testcase_leak 2>leaks.txt
[ "$(stat -c %s leaks.txt)" = "0" ]
- name: Test leak detector not being active for normal compile
run: |
./v -o testcase_leak vlib/v/tests/testcase_leak.v
./v -o testcase_leak vlib/v/tests/testcase_leak.vv
./testcase_leak 2>leaks.txt
[ "$(stat -c %s leaks.txt)" = "0" ]
misc-tooling:
needs: no-scheduling
runs-on: ubuntu-20.04
timeout-minutes: 60
env:
VFLAGS: -cc tcc -no-retry-compilation
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 10
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install --quiet -y libssl-dev sqlite3 libsqlite3-dev valgrind
sudo apt-get install --quiet -y libfreetype6-dev libxi-dev libxcursor-dev libgl-dev
sudo apt-get install --quiet -y xfonts-75dpi xfonts-base
- name: Build v
run: make
- name: v.c can be compiled and run with -os cross
run: |
./v -os cross -o /tmp/v.c cmd/v
gcc -g -std=gnu11 -w -o v_from_vc /tmp/v.c -lm -lpthread
ls -lart v_from_vc
./v_from_vc version
- name: Ensure v up works
run: |
./v cmd/tools/oldv.v
./cmd/tools/oldv -v HEAD^^^^^
cd ~/.cache/oldv/v_at_HEAD_____/
./v version
./v -v up
./v version
./v -o v2 cmd/v
./v2 -o v3 cmd/v
- name: Ensure V can be compiled with -autofree
run: ./v -autofree -o v2 cmd/v ## NB: this does not mean it runs, but at least keeps it from regressing
- name: Shader examples can be build
run: |
wget https://github.com/floooh/sokol-tools-bin/raw/master/bin/linux/sokol-shdc
chmod +x ./sokol-shdc
for f in examples/sokol/02_cubes_glsl/cube_glsl \
examples/sokol/03_march_tracing_glsl/rt_glsl \
examples/sokol/04_multi_shader_glsl/rt_glsl_puppy \
examples/sokol/04_multi_shader_glsl/rt_glsl_march \
examples/sokol/05_instancing_glsl/rt_glsl_instancing \
examples/sokol/06_obj_viewer/gouraud \
; do \
echo "compiling shader $f.glsl ..."; \
./sokol-shdc --input $f.glsl --output $f.h --slang glsl330 ; \
done
for vfile in examples/sokol/0?*/*.v; do echo "compiling $vfile ..."; ./v $vfile ; done
- name: Install C++ dependencies
run: |
sudo apt-get install --quiet -y postgresql libpq-dev libssl-dev sqlite3 libsqlite3-dev
sudo apt-get install --quiet -y libfreetype6-dev libxi-dev libxcursor-dev libgl-dev
sudo apt-get install --quiet -y valgrind g++-9
- name: Build V
run: make -j4
- name: g++ version
run: g++-9 --version
- name: V self compilation with g++
run: ./v -cc g++-9 -o v2 cmd/v && ./v2 -cc g++-9 -o v3 cmd/v
## - name: Running tests with g++
## run: ./v -cc g++-9 -silent test-self
alpine-docker-musl-gcc:
needs: no-scheduling
name: alpine-musl
runs-on: ubuntu-20.04
timeout-minutes: 60
container:
# Alpine docker pre-built container
image: thevlang/vlang:alpine-build
env:
V_CI_MUSL: 1
VFLAGS: -cc gcc
volumes:
- ${{github.workspace}}:/opt/vlang
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build V
run: |
make CC=clang
- name: Show PWD and Environment
run: |
echo "PWD:"
pwd
echo "ENVIRONMENT"
env
- name: Test V fixed tests
run: |
./v -silent test-self
macos:
needs: no-scheduling
runs-on: macOS-latest
timeout-minutes: 60
runs-on: macOS-12
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 121
env:
VFLAGS: -cc clang
PKG_CONFIG_PATH: /usr/local/opt/openssl@3/lib/pkgconfig
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
@@ -284,8 +174,9 @@ jobs:
run: |
##brew install libpq openssl freetype ### these are *already installed* on Catalina ...
brew uninstall --ignore-dependencies libpq ## libpq is a dependency of PHP
brew install postgresql
brew install postgresql openssl
export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/opt/openssl/lib/"
echo "PKG_CONFIG_PATH is '$PKG_CONFIG_PATH'"
- name: Build V
run: make -j4 && ./v -cg -cstrict -o v cmd/v
- name: Run sanitizers
@@ -294,12 +185,6 @@ jobs:
UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1 ./v2 -o v.c cmd/v
- name: Build V using V
run: ./v -o v2 cmd/v && ./v2 -o v3 cmd/v
# QTODO
# - name: v self compilation with -usecache
# run: |
# ./v -o v2 -usecache cmd/v
# ./v2 -o v3 -usecache cmd/v
# ./v3 -usecache examples/tetris/tetris.v
- name: Test symlink
run: ./v symlink
# - name: Set up pg database
@@ -309,22 +194,22 @@ jobs:
# psql -d postgres -c 'create database customerdb;'
# psql -d customerdb -f examples/database/pg/mydb.sql
# - name: Test v->c
# run: ./v -silent test-all
# run: ./v test-all
# - name: Test v binaries
# run: ./v build-vbinaries
## - name: Test v->js
## run: ./v -o hi.js examples/hello_v_js.v && node hi.js
- name: Verify `v test` works
run: |
echo $VFLAGS
./v cmd/tools/test_if_v_test_system_works.v
./cmd/tools/test_if_v_test_system_works
- name: All code is formatted
run: VJOBS=1 ./v test-cleancode
- name: Self tests
run: VJOBS=1 ./v -silent test-self
run: VJOBS=1 ./v test-self
- name: Build examples
run: ./v build-examples
- name: Build examples with -autofree
run: |
./v -autofree -o tetris examples/tetris/tetris.v
@@ -332,14 +217,13 @@ jobs:
- name: v doctor
run: |
./v doctor
- name: Test ved
run: |
git clone --depth 1 https://github.com/vlang/ved
cd ved && ../v -o ved .
../v -autofree .
../v -prod .
cd ..
# - name: Test c2v
# run: |
# git clone --depth 1 https://github.com/vlang/c2v
@@ -348,7 +232,6 @@ jobs:
# ../v run tests/run_tests.vsh
# ../v -experimental -w c2v_test.v
# cd ..
- name: Build V UI examples
run: |
git clone --depth 1 https://github.com/vlang/ui
@@ -356,12 +239,27 @@ jobs:
mkdir -p ~/.vmodules
ln -s $(pwd) ~/.vmodules/ui
../v examples/rectangles.v
../v run examples/build_examples.vsh
## ../v run examples/build_examples.vsh
- name: V self compilation with -usecache
run: |
unset VFLAGS
./v -usecache examples/hello_world.v && examples/hello_world
./v -o v2 -usecache cmd/v
./v2 -o v3 -usecache cmd/v
./v3 version
./v3 -o tetris -usecache examples/tetris/tetris.v
- name: V self compilation with -parallel-cc
run: |
./v -o v2 -parallel-cc cmd/v
- name: Test password input
run: |
./v examples/password
./v examples/password/password_ci.vsh
ubuntu:
needs: no-scheduling
runs-on: ubuntu-20.04
timeout-minutes: 60
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 121
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
@@ -383,42 +281,49 @@ jobs:
UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1 ./v2 -o v.c cmd/v
UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1 ./v3 -o v.c cmd/v
# - name: Test V
# run: ./v -silent test-all
# run: ./v test-all
# - name: Test v binaries
# run: ./v build-vbinaries
## - name: Test v->js
## run: ./v -o hi.js examples/hello_v_js.v && node hi.js
# - name: Build Vorum
# run: git clone --depth 1 https://github.com/vlang/vorum && cd vorum && ../v . && cd ..
# - name: Build vpm
# run: git clone --depth 1 https://github.com/vlang/vpm && cd vpm && ../v . && cd ..
- name: Build vpm
run: git clone --depth 1 https://github.com/vlang/vpm && cd vpm && ../v . && cd ..
- name: Freestanding
run: ./v -freestanding run vlib/os/bare/bare_example_linux.v
- name: v self compilation
- name: V self compilation
run: ./v -o v2 cmd/v && ./v2 -o v3 cmd/v && ./v3 -o v4 cmd/v
# QTODO
# - name: v self compilation with -usecache
# run: |
# ./v -o v2 -usecache cmd/v
# ./v2 -o v3 -usecache cmd/v
# ./v3 -usecache examples/tetris/tetris.v
- name: V self compilation with -usecache
run: |
unset VFLAGS
./v -usecache examples/hello_world.v && examples/hello_world
./v -o v2 -usecache cmd/v
./v2 -o v3 -usecache cmd/v
./v3 version
./v3 -o tetris -usecache examples/tetris/tetris.v
- name: Verify `v test` works
run: |
echo $VFLAGS
./v cmd/tools/test_if_v_test_system_works.v
./cmd/tools/test_if_v_test_system_works
- name: All code is formatted
run: ./v test-cleancode
- name: Self tests
run: |
./v -silent test-self
run: ./v test-self
- name: Self tests (-prod)
run: ./v -o vprod -prod cmd/v && ./vprod -silent test-self
run: ./v -o vprod -prod cmd/v && ./vprod test-self
- name: Self tests (-cstrict)
run: ./v -cc gcc -cstrict test-self
run: VTEST_JUST_ESSENTIAL=1 V_CI_CSTRICT=1 ./v -cc gcc -cstrict test-self
- name: Build examples
run: ./v build-examples
- name: Build tetris.v with -autofree
run: ./v -autofree -experimental -o tetris examples/tetris/tetris.v
- name: Build option_test.v with -autofree
run: ./v -autofree vlib/v/tests/option_test.v
- name: V self compilation with -parallel-cc
run: |
./v -o v2 -parallel-cc cmd/v
- name: Build modules
run: |
./v build-module vlib/os
@@ -448,16 +353,16 @@ jobs:
ls
# ./1m
#run: echo "TODO" #cd examples/native && ../../v -native hello_world.v && ./hello_world
# run: echo "TODO" #cd examples/native && ../../v -native hello_world.v && ./hello_world
# - name: Coveralls GitHub Action
# uses: coverallsapp/github-action@v1.0.1
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
ubuntu-clang:
needs: no-scheduling
runs-on: ubuntu-20.04
timeout-minutes: 60
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 121
env:
VFLAGS: -cc clang
steps:
@@ -487,23 +392,31 @@ jobs:
ASAN_OPTIONS=detect_leaks=0 UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1 ./v5 -o v.c cmd/v
- name: v self compilation
run: ./v -o v2 cmd/v && ./v2 -o v3 cmd/v && ./v3 -o v4 cmd/v
# QTODO
# - name: v self compilation with -usecache
# run: |
# ./v -o v2 -usecache cmd/v
# ./v2 -o v3 -usecache cmd/v
# ./v3 -usecache examples/tetris/tetris.v
- name: v self compilation with -usecache
run: |
unset VFLAGS
./v -usecache examples/hello_world.v && examples/hello_world
./v -o v2 -usecache cmd/v
./v2 -o v3 -usecache cmd/v
./v3 version
./v3 -o tetris -usecache examples/tetris/tetris.v
- name: Verify `v test` works
run: |
echo $VFLAGS
./v cmd/tools/test_if_v_test_system_works.v
./cmd/tools/test_if_v_test_system_works
- name: All code is formatted
run: ./v test-cleancode
- name: Self tests
run: ./v test-self
- name: Self tests (vprod)
run: |
./v -silent test-self
- name: Self tests (-prod)
run: ./v -o vprod -prod cmd/v && ./vprod -silent test-self
./v -o vprod -prod cmd/v
./vprod test-self
- name: Self tests (-cstrict)
run: ./v -cstrict test-self
run: VTEST_JUST_ESSENTIAL=1 V_CI_CSTRICT=1 ./vprod -cstrict test-self
- name: Build examples
run: ./v build-examples
- name: Build examples with -autofree
@@ -537,78 +450,13 @@ jobs:
echo "Running it..."
ls
# ubuntu-autofree-selfcompile:
# runs-on: ubuntu-20.04
# timeout-minutes: 60
# env:
# VFLAGS: -cc gcc
# steps:
# - uses: actions/checkout@v2
# - name: Build V
# run: make -j4
# - name: V self compilation with -autofree
# run: ./v -o v2 -autofree cmd/v && ./v2 -o v3 -autofree cmd/v && ./v3 -o v4 -autofree cmd/v
# Ubuntu docker pre-built container
ubuntu-musl:
needs: no-scheduling
name: ubuntu-musl
runs-on: ubuntu-20.04
timeout-minutes: 60
container:
image: thevlang/vlang:ubuntu-build
env:
V_CI_MUSL: 1
V_CI_UBUNTU_MUSL: 1
VFLAGS: -cc musl-gcc
volumes:
- ${{github.workspace}}:/opt/vlang
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build V
run: |
echo $VFLAGS && make -j4 && ./v -cg -o v cmd/v
- name: Verify `v test` works
run: |
./v cmd/tools/test_if_v_test_system_works.v
./cmd/tools/test_if_v_test_system_works
- name: Test V fixed tests
run: |
./v -silent test-self
# ubuntu-musl:
# runs-on: ubuntu-20.04
# timeout-minutes: 60
# env:
# VFLAGS: -cc musl-gcc
# V_CI_MUSL: 1
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v1
# with:
# node-version: 12.x
# - name: Install dependencies
# run: |
# sudo apt-get install --quiet -y musl musl-tools libssl-dev sqlite3 libsqlite3-dev valgrind
# - name: Build v
# run: echo $VFLAGS && make -j4 && ./v -cg -o v cmd/v
# # - name: Test v binaries
# # run: ./v build-vbinaries
# ## - name: Test v->js
# ## run: ./v -o hi.js examples/hello_v_js.v && node hi.js
# - name: quick debug
# run: ./v -stats vlib/strconv/format_test.v
# - name: Self tests
# run: ./v -silent test-self
windows-gcc:
needs: no-scheduling
runs-on: windows-2019
timeout-minutes: 60
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 121
env:
VFLAGS: -cc gcc
VERBOSE_MAKE: 1
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
@@ -619,7 +467,9 @@ jobs:
gcc --version
.\make.bat -gcc
- name: Test new v.c
run: .\v.exe -o v.c cmd/v && gcc -Werror -municode -w v.c
run: |
.\v.exe -o v.c cmd/v
gcc -Werror -municode -w v.c
- name: Install dependencies
run: |
.\v.exe setup-freetype
@@ -629,14 +479,31 @@ jobs:
./v doctor
- name: Verify `v test` works
run: |
echo $VFLAGS
./v cmd/tools/test_if_v_test_system_works.v
./cmd/tools/test_if_v_test_system_works
- name: All code is formatted
run: ./v test-cleancode
- name: Self tests
run: .\v.exe test-self
# - name: Test
# run: .\v.exe test-all
- name: Test time functions in a timezone UTC-12
run: |
.\v.exe -silent test-self
# - name: Test
# run: |
# .\v.exe -silent test-all
tzutil /s "Dateline Standard Time"
./v test vlib/time/
- name: Test time functions in a timezone UTC-3
run: |
tzutil /s "Greenland Standard Time"
./v test vlib/time/
- name: Test time functions in a timezone UTC+3
run: |
tzutil /s "Russian Standard Time"
./v test vlib/time/
- name: Test time functions in a timezone UTC+12
run: |
tzutil /s "New Zealand Standard Time"
./v test vlib/time/
- name: Test v->js
run: ./v -o hi.js examples/hello_v_js.v && node hi.js
- name: Test v binaries
@@ -647,11 +514,12 @@ jobs:
run: .\v.exe -o v2.exe cmd/v && .\v2.exe -o v3.exe cmd/v
windows-msvc:
needs: no-scheduling
runs-on: windows-2019
timeout-minutes: 60
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 121
env:
VFLAGS: -cc msvc
VERBOSE_MAKE: 1
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
@@ -661,7 +529,7 @@ jobs:
run: |
echo %VFLAGS%
echo $VFLAGS
.\make.bat -msvc --verbose
.\make.bat -msvc
.\v.exe -cflags /WX self
- name: Install dependencies
run: |
@@ -672,15 +540,18 @@ jobs:
./v doctor
- name: Verify `v test` works
run: |
echo $VFLAGS
./v cmd/tools/test_if_v_test_system_works.v
./cmd/tools/test_if_v_test_system_works
### TODO: test-cleancode fails with msvc. Investigate why???
## - name: All code is formatted
## run: ./v test-cleancode
- name: Self tests
run: |
./v -cg cmd\tools\vtest-self.v
./v -silent test-self
./v test-self
# - name: Test
# run: |
# .\v.exe -silent test-all
# run: .\v.exe test-all
- name: Test v->js
run: ./v -o hi.js examples/hello_v_js.v && node hi.js
- name: Test v binaries
@@ -691,13 +562,14 @@ jobs:
run: .\v.exe -o v2.exe cmd/v && .\v2.exe -o v3.exe cmd/v
windows-tcc:
needs: no-scheduling
runs-on: windows-2019
timeout-minutes: 60
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 121
env:
VFLAGS: -cc tcc -no-retry-compilation
VJOBS: 1
VTEST_SHOW_START: 1
VERBOSE_MAKE: 1
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
@@ -705,9 +577,11 @@ jobs:
node-version: 12.x
- name: Build with make.bat -tcc
run: |
.\make.bat -tcc --verbose
.\make.bat -tcc
- name: Test new v.c
run: .\v.exe -o v.c cmd/v && .\thirdparty\tcc\tcc.exe -Werror -w -ladvapi32 -bt10 v.c
run: |
.\v.exe -o v.c cmd/v
.\thirdparty\tcc\tcc.exe -Werror -w -ladvapi32 -bt10 v.c
- name: Install dependencies
run: |
.\v.exe setup-freetype
@@ -719,54 +593,17 @@ jobs:
run: |
.\v.exe cmd/tools/test_if_v_test_system_works.v
.\cmd\tools\test_if_v_test_system_works.exe
- name: Verify `v vlib/v/gen/c/coutput_test.v` works
run: |
.\v.exe vlib/v/gen/c/coutput_test.v
- name: Make sure running TCC64 instead of TCC32
run: ./v test .github\workflows\make_sure_ci_run_with_64bit_compiler_test.v
- name: Test ./v doc -v clipboard *BEFORE building tools*
run: ./v doc -v clipboard
- name: Test v build-tools
run: ./v -W build-tools
- name: Test ./v doc clipboard
run: ./v doc clipboard
- name: Self tests
run: ./v test-self
- name: Test v->js
run: ./v -o hi.js examples/hello_v_js.v && node hi.js
- name: Test v binaries
run: ./v build-vbinaries
- name: Build examples
run: ./v build-examples
- name: v2 self compilation
run: .\v.exe -o v2.exe cmd/v && .\v2.exe -o v3.exe cmd/v
## tcc32
- name: Build with make.bat -tcc32
run: |
Remove-Item -Recurse -Force .\thirdparty\tcc
.\v.exe wipe-cache
.\make.bat -tcc32 --verbose
- name: Test new v.c
run: .\v.exe -o v.c cmd/v && .\thirdparty\tcc\tcc.exe -Werror -w -ladvapi32 -bt10 v.c
- name: v doctor
run: ./v doctor
- name: Verify `v test` works
run: |
.\v.exe cmd/tools/test_if_v_test_system_works.v
.\cmd\tools\test_if_v_test_system_works.exe
- name: Make sure running TCC32 instead of TCC64
run: ./v -stats .github\workflows\make_sure_ci_run_with_32bit_compiler_test.v
- name: Test v build-tools
run: ./v -W build-tools
- name: Test ./v doc clipboard
run: ./v doc clipboard
- name: All code is formatted
run: ./v test-cleancode
- name: Self tests
run: ./v test-self
- name: Test v->js
@@ -776,110 +613,87 @@ jobs:
- name: Build examples
run: ./v build-examples
- name: v2 self compilation
run: .\v.exe -o v2.exe cmd/v && .\v2.exe -o v3.exe cmd/v
run: .\v.exe -o v2.exe cmd/v && .\v2.exe -o v3.exe cmd/v && .\v3.exe -o v4.exe cmd/v
- name: v2 self compilation with -gc boehm
run: .\v.exe -o v2.exe -gc boehm cmd/v && .\v2.exe -o v3.exe -gc boehm cmd/v && .\v3.exe -o v4.exe -gc boehm cmd/v
parser-silent:
needs: no-scheduling
name: Parser silent mode
runs-on: ubuntu-20.04
timeout-minutes: 60
steps:
- uses: actions/checkout@v2
- name: Install zzuf
run: sudo apt install -qq zzuf
- name: Build local v
run: |
make -j4
./v -g cmd/tools/vtest-parser.v
- name: Run test-parser
run: |
./v test-parser -S examples/hello_world.v
./v test-parser -S examples/hanoi.v
./v test-parser -S examples/fibonacci.v
./v test-parser -S examples/cli.v
./v test-parser -S examples/json.v
./v test-parser -S examples/vmod.v
./v test-parser -S examples/regex/regex_example.v
./v test-parser -S examples/2048/2048.v
## ## tcc32
## - name: Build with make.bat -tcc32
## run: |
## Remove-Item -Recurse -Force .\thirdparty\tcc
## .\v.exe wipe-cache
## .\make.bat -tcc32
## - name: Test new v.c
## run: .\v.exe -o v.c cmd/v && .\thirdparty\tcc\tcc.exe -Werror -g -w -ladvapi32 -bt10 v.c
## - name: v doctor
## run: ./v doctor
##
## - name: Verify `v test` works
## run: |
## .\v.exe cmd/tools/test_if_v_test_system_works.v
## .\cmd\tools\test_if_v_test_system_works.exe
##
## - name: Verify `v vlib/v/gen/c/coutput_test.v` works
## run: |
## .\v.exe vlib/v/gen/c/coutput_test.v
##
## - name: Make sure running TCC32 instead of TCC64
## run: ./v -stats .github\workflows\make_sure_ci_run_with_32bit_compiler_test.v
##
## - name: Test v build-tools
## run: ./v -W build-tools
##
## - name: Test ./v doc clipboard
## run: ./v doc clipboard
##
## - name: Self tests
## run: ./v test-self
## - name: Test v->js
## run: ./v -o hi.js examples/hello_v_js.v && node hi.js
## - name: Test v binaries
## run: ./v build-vbinaries
## - name: Build examples
## run: ./v build-examples
## - name: v2 self compilation
## run: .\v.exe -o v2.exe cmd/v && .\v2.exe -o v3.exe cmd/v
- name: Run test-parser over fuzzed files
run: |
zzuf -R '\x00-\x20\x7f-\xff' -r0.01 < examples/hello_world.v > examples/hello_world_fuzz.v
zzuf -R '\x00-\x20\x7f-\xff' -r0.01 < examples/hanoi.v > examples/hanoi_fuzz.v
zzuf -R '\x00-\x20\x7f-\xff' -r0.01 < examples/fibonacci.v > examples/fibonacci_fuzz.v
zzuf -R '\x00-\x20\x7f-\xff' -r0.01 < examples/cli.v > examples/cli_fuzz.v
zzuf -R '\x00-\x20\x7f-\xff' -r0.01 < examples/json.v > examples/json_fuzz.v
zzuf -R '\x00-\x20\x7f-\xff' -r0.01 < examples/vmod.v > examples/vmod_fuzz.v
zzuf -R '\x00-\x20\x7f-\xff' -r0.01 < examples/regex/regex_example.v > examples/regex_example_fuzz.v
zzuf -R '\x00-\x20\x7f-\xff' -r0.01 < examples/2048/2048.v > examples/2048/2048_fuzz.v
./v test-parser -S examples/hello_world_fuzz.v
./v test-parser -S examples/hanoi_fuzz.v
./v test-parser -S examples/cli_fuzz.v
./v test-parser -S examples/regex_example_fuzz.v
./v test-parser -S examples/2048/2048_fuzz.v
v-apps-compile:
needs: no-scheduling
runs-on: ubuntu-20.04
timeout-minutes: 60
steps:
- uses: actions/checkout@v2
- name: Build V
run: make && sudo ./v symlink
# ubuntu-autofree-selfcompile:
# runs-on: ubuntu-20.04
# if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
# timeout-minutes: 121
# env:
# VFLAGS: -cc gcc
# steps:
# - uses: actions/checkout@v2
# - name: Build V
# run: make -j4
# - name: V self compilation with -autofree
# run: ./v -o v2 -autofree cmd/v && ./v2 -o v3 -autofree cmd/v && ./v3 -o v4 -autofree cmd/v
## vls
- name: Clone tree-sitter-v to ~/.vmodules/tree_sitter_v
run: git clone --depth 1 https://github.com/nedpals/tree-sitter-v ~/.vmodules/tree_sitter_v
- name: Clone VLS tree-sitter
run: git clone --depth 1 --no-single-branch https://github.com/vlang/vls
- name: Checkout branch tree-sitter
run: pushd vls; git checkout use-tree-sitter; popd
- name: Build VLS tree-sitter
run: pushd vls; v cmd/vls ; popd
- name: Build VLS tree-sitter with -prod
run: pushd vls; v -prod cmd/vls; popd
- name: Checkout branch master
run: pushd vls; git checkout master; popd
- name: Build VLS master
run: pushd vls; v cmd/vls ; popd
- name: Build VLS master with -prod
run: pushd vls; v -prod cmd/vls ; popd
## vab
- name: Clone vab
run: git clone --depth 1 https://github.com/vlang/vab
- name: Build vab
run: cd vab; ../v ./vab.v ; cd ..
## gitly
- name: Install markdown
run: ./v install markdown
- name: Build Gitly
run: |
git clone --depth 1 https://github.com/vlang/gitly
cd gitly
../v .
../v -autofree .
cd ..
## vex
- name: Install Vex dependencies
run: sudo apt-get install --quiet -y libssl-dev sqlite3 libsqlite3-dev
- name: Install Vex
run: mkdir -p ~/.vmodules/nedpals; git clone https://github.com/nedpals/vex ~/.vmodules/nedpals/vex
- name: Compile the simple Vex example
run: ./v ~/.vmodules/nedpals/vex/examples/simple_example.v
- name: Run Vex Tests
run: ./v test ~/.vmodules/nedpals/vex
## vpm modules
- name: Install UI through VPM
run: ./v install ui
## libsodium
- name: Install libsodium-dev package
run: sudo apt-get install --quiet -y libsodium-dev
- name: Installl the libsodium wrapper through VPM
run: ./v install libsodium
- name: Test libsodium
run: ./v test ~/.vmodules/libsodium
# ubuntu-musl:
# runs-on: ubuntu-20.04
# if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
# timeout-minutes: 121
# env:
# VFLAGS: -cc musl-gcc
# V_CI_MUSL: 1
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v1
# with:
# node-version: 12.x
# - name: Install dependencies
# run: |
# sudo apt-get install --quiet -y musl musl-tools libssl-dev sqlite3 libsqlite3-dev valgrind
# - name: Build v
# run: echo $VFLAGS && make -j4 && ./v -cg -o v cmd/v
# # - name: Test v binaries
# # run: ./v build-vbinaries
# ## - name: Test v->js
# ## run: ./v -o hi.js examples/hello_v_js.v && node hi.js
# - name: quick debug
# run: ./v -stats vlib/strconv/format_test.v
# - name: Self tests
# run: ./v test-self

View File

@@ -0,0 +1,75 @@
name: Bootstraping works
on:
schedule:
- cron: '0 */6 * * *'
jobs:
ubuntu:
runs-on: ubuntu-latest
if: github.event.ref == 'refs/heads/master' && github.event.repository.full_name == 'vlang/v'
timeout-minutes: 30
env:
VFLAGS: -cc tcc -no-retry-compilation
B_CFLAGS: -g -std=c99 -w
B_LFLAGS: -lm -lpthread
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 10
- name: Build v
run: make
- name: v.c can be compiled and run with -os cross (bootstrapping works)
run: |
ls -la v vc/v.c
./v -os cross -o vc/v.c cmd/v
gcc $B_CFLAGS -o v_from_vc vc/v.c $B_LFLAGS
ls -lart v_from_vc
./v_from_vc version
./v_from_vc run examples/hello_world.v
./v_from_vc -o v_from_vc_produced_native_v cmd/v
./v_from_vc_produced_native_v run examples/hello_world.v
make local=1
ls -la v vc/v.c v_from_vc v_from_vc_produced_native_v
- name: Ensure v up works
run: |
./v cmd/tools/oldv.v
./cmd/tools/oldv -v HEAD^^^^^
cd ~/.cache/oldv/v_at_HEAD_____/
./v version
./v -v up
./v version
./v -o v2 cmd/v
./v2 -o v3 cmd/v
macos:
runs-on: macos-latest
if: github.event.ref == 'refs/heads/master' && github.event.repository.full_name == 'vlang/v'
timeout-minutes: 30
env:
VFLAGS: -cc clang
B_CFLAGS: -g -std=c99 -w
B_LFLAGS: -lm -lpthread
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 10
- name: Build V
run: make && ./v -cg -cstrict -o v cmd/v
- name: v.c can be compiled and run with -os cross (bootstrapping works)
run: |
ls -la v vc/v.c
./v -os cross -o vc/v.c cmd/v
cc $B_CFLAGS -o v_from_vc vc/v.c $B_LFLAGS
ls -lart v_from_vc
./v_from_vc version
./v_from_vc run examples/hello_world.v
./v_from_vc -o v_from_vc_produced_native_v cmd/v
./v_from_vc_produced_native_v run examples/hello_world.v
### the next make invocation will simulate building V from scratch,
### using this commit
make local=1
ls -la v vc/v.c v_from_vc v_from_vc_produced_native_v

View File

@@ -12,30 +12,31 @@ jobs:
macos-cross:
runs-on: macOS-latest
timeout-minutes: 15
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 25
env:
VFLAGS: -cc clang
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 10
- name: Install dependencies
run: |
brew install mingw-w64
export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/opt/openssl/lib/"
- name: Build V
run: make
- name: Test symlink
run: ./v symlink
- name: Cross-compilation to Linux
run: |
./v -os linux cmd/v
# TODO: fix this: ./v -os linux examples/2048/2048.v
- name: Cross-compilation to Windows
run: |
./v -os windows cmd/v
@@ -43,7 +44,8 @@ jobs:
linux-cross:
runs-on: ubuntu-20.04
timeout-minutes: 15
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 25
env:
VFLAGS: -cc tcc -no-retry-compilation
steps:
@@ -52,35 +54,38 @@ jobs:
fetch-depth: 10
- name: Install dependencies
run: |
## sudo dpkg --add-architecture i386
sudo apt update
sudo apt-get install --quiet -y libssl-dev sqlite3 libsqlite3-dev valgrind
sudo apt-get install --quiet -y libssl-dev sqlite3 libsqlite3-dev
sudo apt-get install --quiet -y mingw-w64 wine-stable winetricks
## sudo apt-get install --quiet -y wine32
- name: Turn off the wine crash dialog
run: winetricks nocrashdialog
- name: Build v
run: make
- name: v.c can be compiled and run with -os cross
run: |
./v -os cross -o /tmp/v.c cmd/v
gcc -g -std=gnu11 -w -o v_from_vc /tmp/v.c -lm -lpthread
ls -lart v_from_vc
./v_from_vc version
- name: v_win.c can be compiled and run with -os windows
run: |
./v -os windows -o /tmp/v_win.c cmd/v
x86_64-w64-mingw32-gcc /tmp/v_win.c -std=c99 -w -municode -o v_from_vc.exe
./v -cc msvc -os windows -o /tmp/v_win.c cmd/v
x86_64-w64-mingw32-gcc /tmp/v_win.c -std=c99 -w -municode -o v_from_vc.exe
ls -lart v_from_vc.exe
wine v_from_vc.exe version
wine64 ./v_from_vc.exe version
- name: hello_world.v can be cross compiled to hello_world.exe
run: |
./v -os windows examples/hello_world.v
ls -lart examples/hello_world.exe
wine examples/hello_world.exe
wine64 examples/hello_world.exe
- name: 2048.v can be cross compiled to 2048.exe
run: |
./v -os windows examples/2048/2048.v
@@ -88,19 +93,19 @@ jobs:
windows-cross:
runs-on: windows-2019
timeout-minutes: 15
env:
VFLAGS: -cc msvc
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 25
steps:
- uses: actions/checkout@v2
- name: Build
run: |
echo %VFLAGS%
echo $VFLAGS
.\make.bat --verbose -msvc
.\make.bat -msvc
- name: TODO v_win.c can be compiled and run with -os windows
run: |
.\v.exe -os windows -showcc -o v2.exe cmd\v
.\v.exe -os windows -o v_win.c cmd\v
.\v.exe -os windows -cc msvc -showcc -o v2.exe cmd\v
.\v.exe -os windows -cc msvc -o v_win.c cmd\v
dir v2.exe
dir v_win.c
.\v2.exe version

View File

@@ -1,24 +1,83 @@
name: Sanitized CI
## Running these jobs is slow (over ~1 hour, sometimes even 2)
## so we run them only when there is a chance that the generated
## C code could have changed, or for some critical vlib modules,
## like `builtin`, `os`, `sync`, where they have demonstrated
## their usefulness by catching actual very hard to find bugs.
## The cost of this selective running is delayed feedback when
## there are bugs in other V modules.
## The positive is *much faster CI runs* for most V contributors,
## that make PRs that are not concerning V itself, or the critical
## V modules.
on:
push:
paths-ignore:
- "**.md"
paths:
- '!**'
- '!**.md'
- '!**.yml'
- 'cmd/tools/vtest*'
- 'cmd/tools/builders/**.v'
- 'vlib/builtin/**.v'
- 'vlib/strconv/**.v'
- 'vlib/strings/**.v'
- 'vlib/math/**.v'
- 'vlib/math/big/**.v'
- 'vlib/arrays/**.v'
- 'vlib/datatypes/**.v'
- 'vlib/os/**.v'
- 'vlib/sync/**.v'
- 'vlib/v/tests/**.v'
- 'vlib/v/ast/**.v'
- 'vlib/v/scanner/**.v'
- 'vlib/v/parser/**.v'
- 'vlib/v/checker/**.v'
- 'vlib/v/gen/c/**.v'
- 'vlib/v/builder/**.v'
- 'vlib/v/cflag/**.v'
- 'vlib/v/live/**.v'
- 'vlib/v/util/**.v'
- 'vlib/v/markused/**.v'
- 'vlib/v/preludes/**.v'
- 'vlib/v/embed_file/**.v'
pull_request:
paths-ignore:
- "**.md"
paths:
- '!**'
- 'cmd/tools/vtest*'
- 'cmd/tools/builders/**.v'
- 'vlib/builtin/**.v'
- 'vlib/strconv/**.v'
- 'vlib/strings/**.v'
- 'vlib/math/**.v'
- 'vlib/math/big/**.v'
- 'vlib/arrays/**.v'
- 'vlib/datatypes/**.v'
- 'vlib/os/**.v'
- 'vlib/sync/**.v'
- 'vlib/v/tests/**.v'
- 'vlib/v/ast/**.v'
- 'vlib/v/scanner/**.v'
- 'vlib/v/parser/**.v'
- 'vlib/v/checker/**.v'
- 'vlib/v/gen/c/**.v'
- 'vlib/v/builder/**.v'
- 'vlib/v/cflag/**.v'
- 'vlib/v/live/**.v'
- 'vlib/v/util/**.v'
- 'vlib/v/markused/**.v'
- 'vlib/v/preludes/**.v'
- 'vlib/v/embed_file/**.v'
concurrency:
group: build-sanitized-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
no-scheduling:
runs-on: ubuntu-latest
steps:
- name: Dont schedule all jobs
run: sleep 10
tests-sanitize-undefined-clang:
needs: no-scheduling
runs-on: ubuntu-20.04
timeout-minutes: 120
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 180
env:
VFLAGS: -cc clang
VJOBS: 1
@@ -35,16 +94,18 @@ jobs:
sudo apt-get install --quiet -y libfreetype6-dev libxi-dev libxcursor-dev libgl-dev
sudo apt-get install clang
- name: Build V
run: make -j4 && ./v -cg -cstrict -o v cmd/v
run: make && ./v -cg -cstrict -o v cmd/v
- name: Ensure code is well formatted
run: ./v test-cleancode
- name: Self tests (-fsanitize=undefined)
run: ./v -cflags "-fsanitize=undefined" -o v2 cmd/v && ./v2 -cflags -fsanitize=undefined test-self
- name: Build examples (V compiled with -fsanitize=undefined)
run: ./v2 build-examples
tests-sanitize-undefined-gcc:
needs: no-scheduling
runs-on: ubuntu-20.04
timeout-minutes: 120
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 180
env:
VFLAGS: -cc gcc
VJOBS: 1
@@ -60,16 +121,18 @@ jobs:
sudo apt-get install --quiet -y postgresql libpq-dev libssl-dev sqlite3 libsqlite3-dev valgrind
sudo apt-get install --quiet -y libfreetype6-dev libxi-dev libxcursor-dev libgl-dev
- name: Build V
run: make -j4 && ./v -cg -cstrict -o v cmd/v
run: make && ./v -cg -cstrict -o v cmd/v
- name: Ensure code is well formatted
run: ./v test-cleancode
- name: Self tests (-fsanitize=undefined)
run: ./v -cflags "-fsanitize=undefined" -o v2 cmd/v && ./v2 -cflags -fsanitize=undefined test-self
- name: Build examples (V compiled with -fsanitize=undefined)
run: ./v2 build-examples
tests-sanitize-address-clang:
needs: no-scheduling
runs-on: ubuntu-20.04
timeout-minutes: 120
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 180
env:
VFLAGS: -cc clang
VJOBS: 1
@@ -86,7 +149,9 @@ jobs:
sudo apt-get install --quiet -y libfreetype6-dev libxi-dev libxcursor-dev libgl-dev
sudo apt-get install clang
- name: Build V
run: make -j4 && ./v -cg -cstrict -o v cmd/v
run: make && ./v -cg -cstrict -o v cmd/v
- name: Ensure code is well formatted
run: ./v test-cleancode
- name: Self tests (-fsanitize=address)
run: ASAN_OPTIONS=detect_leaks=0 ./v -cflags "-fsanitize=address,pointer-compare,pointer-subtract" test-self
- name: Self tests (V compiled with -fsanitize=address)
@@ -97,9 +162,9 @@ jobs:
run: ASAN_OPTIONS=detect_leaks=0 ./v build-examples
tests-sanitize-address-msvc:
needs: no-scheduling
runs-on: windows-2019
timeout-minutes: 120
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 180
env:
VFLAGS: -cc msvc
VJOBS: 1
@@ -114,19 +179,24 @@ jobs:
echo %VFLAGS%
echo $VFLAGS
.\make.bat -msvc
.\v.exe -cflags /WX self
- name: Install dependencies
.\v.exe self
- name: Ensure code is well formatted
run: |
.\v.exe setup-freetype
.\.github\workflows\windows-install-sqlite.bat
- name: Self tests (-fsanitize=address)
run: |
.\v.exe -cflags -fsanitize=address test-self
.\v.exe fmt -verify vlib/builtin/ vlib/v/scanner/ vlib/v/parser/ vlib/v/gen/
## TODO: check to see why `v test-cleancode` does not work with msvc on windows
## - name: Install dependencies
## run: |
## .\v.exe setup-freetype
## .\.github\workflows\windows-install-sqlite.bat
## - name: Self tests (TODO: /fsanitize=address)
## run: |
## .\v.exe -cflags "/fsanitize=address" test-self
tests-sanitize-address-gcc:
needs: no-scheduling
runs-on: ubuntu-20.04
timeout-minutes: 120
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 180
env:
VFLAGS: -cc gcc
VJOBS: 1
@@ -143,7 +213,9 @@ jobs:
sudo apt-get install --quiet -y libfreetype6-dev libxi-dev libxcursor-dev libgl-dev
sudo apt-get install clang
- name: Build V
run: make -j4 && ./v -cg -cstrict -o v cmd/v
run: make && ./v -cg -cstrict -o v cmd/v
- name: Ensure code is well formatted
run: ./v test-cleancode
- name: Self tests (-fsanitize=address)
run: ASAN_OPTIONS=detect_leaks=0 ./v -cflags -fsanitize=address test-self
- name: Self tests (V compiled with -fsanitize=address)
@@ -154,11 +226,11 @@ jobs:
run: ASAN_OPTIONS=detect_leaks=0 ./v build-examples
tests-sanitize-memory-clang:
needs: no-scheduling
runs-on: ubuntu-20.04
timeout-minutes: 120
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 180
env:
VFLAGS: -cc clang
VFLAGS: -cc clang -gc none
VJOBS: 1
VTEST_SHOW_START: 1
steps:
@@ -173,11 +245,14 @@ jobs:
sudo apt-get install --quiet -y libfreetype6-dev libxi-dev libxcursor-dev libgl-dev
sudo apt-get install clang
- name: Build V
run: make -j4 && ./v -cc clang -cg -cstrict -o v cmd/v
run: make && ./v -cc clang -cg -cstrict -o v cmd/v
- name: Ensure code is well formatted
run: ./v test-cleancode
- name: Self tests (-fsanitize=memory)
run: ./v -cflags -fsanitize=memory test-self
- name: Self tests (V compiled with -fsanitize=memory)
run:
./v -cflags -fsanitize=memory -o v cmd/v && ./v -cc tcc test-self -msan-compiler
run: |
./v -cflags -fsanitize=memory -o v cmd/v
./v -cc tcc test-self -msan-compiler
- name: Build examples (V compiled with -fsanitize=memory)
run: ./v build-examples

36
.github/workflows/ci_v_benchmark.yml vendored Normal file
View File

@@ -0,0 +1,36 @@
name: vlang benchmarks
on:
push:
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"
jobs:
run:
name: Run
runs-on: ubuntu-latest
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install google benchmark
run: |
git clone https://github.com/google/benchmark.git
cd benchmark
cmake -E make_directory "build"
cmake -E chdir "build" cmake -DBENCHMARK_DOWNLOAD_DEPENDENCIES=on -DCMAKE_BUILD_TYPE=Release ../
sudo cmake --build "build" --config Release --target install
- name: Run V benchmark
run: |
make
sudo ./v symlink
git clone https://github.com/vincenzopalazzo/benchmarks.git
cd benchmarks
make vdep && make v
- uses: actions/upload-artifact@v3
with:
name: vlang-benchmark
path: benchmarks/vlang/*.json

91
.github/workflows/containers_ci.yml vendored Normal file
View File

@@ -0,0 +1,91 @@
name: Containers CI
on:
push:
paths-ignore:
- "**.md"
- "**.yml"
pull_request:
paths-ignore:
- "**.md"
- "**.yml"
concurrency:
group: build-containers-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
alpine-docker-musl-gcc:
runs-on: ubuntu-20.04
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 181
container:
# Alpine docker pre-built container
image: thevlang/vlang:alpine-build
env:
V_CI_MUSL: 1
VFLAGS: -cc gcc
volumes:
- ${{github.workspace}}:/opt/vlang
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Show Environment
run: |
echo "PWD:"
pwd
echo "ENVIRONMENT:"
env
echo "C Compiler:"
gcc --version
## TODO: fix the container thevlang/vlang:alpine-build, instead of using apk add here:
- name: Add dependencies
run: |
apk add libexecinfo-static
apk add libexecinfo-dev
apk add libc6-compat
- name: Build V
run: CC=gcc make
- name: All code is formatted
run: ./v test-cleancode
- name: Run only essential tests
run: VTEST_JUST_ESSENTIAL=1 ./v test-self
ubuntu-docker-musl:
runs-on: ubuntu-20.04
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 121
container:
image: thevlang/vlang:ubuntu-build
env:
V_CI_MUSL: 1
V_CI_UBUNTU_MUSL: 1
VFLAGS: -cc musl-gcc -gc none
volumes:
- ${{github.workspace}}:/opt/vlang
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build V
run: |
echo $VFLAGS && make -j4 && ./v -cg -o v cmd/v
- name: Verify `v test` works
run: |
echo $VFLAGS
./v cmd/tools/test_if_v_test_system_works.v
./cmd/tools/test_if_v_test_system_works
- name: All code is formatted
run: ./v test-cleancode
- name: Test V fixed tests
run: ./v test-self

View File

@@ -6,7 +6,7 @@ jobs:
debug-msvc:
runs-on: windows-2019
timeout-minutes: 60
timeout-minutes: 121
env:
VFLAGS: -cc msvc
steps:
@@ -18,23 +18,24 @@ jobs:
run: |
echo %VFLAGS%
echo $VFLAGS
.\make.bat --verbose -msvc
.\make.bat -msvc
.\v.exe -cflags /WX self
- name: Install dependencies
run: |
.\v.exe setup-freetype
.\.github\workflows\windows-install-sqlite.bat
- name: v doctor
run: |
./v doctor
run: ./v doctor
- name: Verify `v test` works
run: |
./v cmd/tools/test_if_v_test_system_works.v
./cmd/tools/test_if_v_test_system_works
- name: All code is formatted
run: ./v test-cleancode
- name: Self tests
run: |
./v -cg cmd\tools\vtest-self.v
./v -silent test-self
./v test-self
- name: Test v->js
run: ./v -o hi.js examples/hello_v_js.v && node hi.js
- name: Test v binaries
@@ -43,4 +44,3 @@ jobs:
run: ./v build-examples
- name: v2 self compilation
run: .\v.exe -o v2.exe cmd/v && .\v2.exe -o v3.exe cmd/v

View File

@@ -1,8 +1,16 @@
name: Docs CI
### Run on *EVERY* commit. The documentation *SHOULD* stay valid, and
### the developers should receive early warning if they break it.
on: [push, pull_request]
### Run on *EVERY* .v or .md related commit.
### The documentation *SHOULD* stay valid, and the developers should receive
### early warning, if they break it.
on:
push:
paths-ignore:
- "**.yml"
pull_request:
paths-ignore:
- "**.yml"
jobs:
check-markdown:
@@ -14,5 +22,26 @@ jobs:
run: make
- name: Check markdown line length & code examples
run: ./v check-md -hide-warnings .
## NB: -hide-warnings is used here, so that the output is less noisy,
## thus real errors are easier to spot.
## NB: -hide-warnings is used here, so that the output is less noisy,
## thus real errors are easier to spot.
report-missing-fn-doc:
runs-on: ubuntu-20.04
timeout-minutes: 5
env:
MOPTIONS: --relative-paths --exclude /vlib/v/ --exclude /builtin/linux_bare/ --exclude /testdata/ --exclude /tests/
steps:
- uses: actions/checkout@v2
- name: Build V
run: make
- name: Checkout previous v
uses: actions/checkout@v2
with:
repository: vlang/v
ref: master # important
path: pv
- name: Check against parent commit
run: |
./v missdoc --diff $MOPTIONS pv/vlib vlib

33
.github/workflows/freebsd_build_tcc.sh vendored Executable file
View File

@@ -0,0 +1,33 @@
#!/usr/local/bin/bash
## should be run in V's main repo folder!
rm -rf tinycc/
rm -rf thirdparty/tcc/
pushd .
git clone git://repo.or.cz/tinycc.git
cd tinycc
export CC=clang
./configure \
--cc=clang \
--prefix=thirdparty/tcc \
--bindir=thirdparty/tcc \
--crtprefix=thirdparty/tcc/lib:/usr/lib \
--libpaths=thirdparty/tcc/lib:/usr/lib:/lib:/usr/local/lib \
--debug
gmake
gmake install
popd
mv tinycc/thirdparty/tcc thirdparty/tcc
mv thirdparty/tcc/tcc thirdparty/tcc/tcc.exe
sudo ln -s $(pwd)/thirdparty/tcc/tcc.exe /usr/local/bin/tcc
thirdparty/tcc/tcc.exe -v -v

View File

@@ -10,6 +10,7 @@ on:
jobs:
build-vc:
runs-on: ubuntu-latest
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
env:
VREPO: github.com/vlang/vc.git
steps:
@@ -31,7 +32,7 @@ jobs:
rm -rf vc/v.c vc/v_win.c
./v -o vc/v.c -os cross cmd/v
./v -o vc/v_win.c -os windows cmd/v
./v -o vc/v_win.c -os windows -cc msvc cmd/v
sed -i "1s/^/#define V_COMMIT_HASH \"$COMMIT_HASH\"\n/" vc/v.c
sed -i "1s/^/#define V_COMMIT_HASH \"$COMMIT_HASH\"\n/" vc/v_win.c

54
.github/workflows/gg_regressions_ci.yml vendored Normal file
View File

@@ -0,0 +1,54 @@
name: Graphics CI
on:
push:
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"
jobs:
gg-regressions:
runs-on: ubuntu-latest
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 10
env:
VFLAGS: -cc tcc
DISPLAY: :99
LIBGL_ALWAYS_SOFTWARE: true
steps:
- name: Checkout V
uses: actions/checkout@v2
- name: Build local v
run: make
- name: Setup dependencies
run: |
# imagemagick : convert, mogrify
# xvfb : xvfb
# openimageio-tools : idiff
# libxcursor-dev libxi-dev : V gfx deps
# libgl1-mesa-dri : For headless rendering / software DRI driver (LIBGL_ALWAYS_SOFTWARE=true)
# freeglut3-dev : Fixes graphic apps compilation with tcc
sudo apt-get update
sudo apt-get install imagemagick openimageio-tools libgl1-mesa-dri xvfb libxcursor-dev libxi-dev freeglut3-dev xsel xclip
wget https://raw.githubusercontent.com/tremby/imgur.sh/c98345d/imgur.sh
git clone https://github.com/Larpon/gg-regression-images gg-regression-images
chmod +x ./imgur.sh
- name: Sample and compare
id: compare
continue-on-error: true
run: |
Xvfb $DISPLAY -screen 0 1280x1024x24 &
sleep 1 # give xvfb time to start
./v gret -t ./gg-regression-images/vgret.v_examples.toml -v ./gg-sample_images ./gg-regression-images
- name: Upload regression to imgur
if: steps.compare.outcome != 'success'
run: |
./imgur.sh /tmp/fail.png
./imgur.sh /tmp/diff.png
exit 1

View File

@@ -0,0 +1,81 @@
name: native backend CI
on:
push:
paths:
- '!**'
- '!**.md'
- 'vlib/v/gen/native/'
- 'cmd/tools/builders/**.v'
- 'vlib/builtin/**.v'
- 'vlib/v/ast/**.v'
- 'vlib/v/scanner/**.v'
- 'vlib/v/scanner/**.v'
- 'vlib/v/parser/**.v'
- 'vlib/v/checker/**.v'
- 'vlib/v/gen/c/**.v'
- 'vlib/v/builder/**.v'
- 'vlib/v/cflag/**.v'
- 'vlib/v/live/**.v'
- 'vlib/v/util/**.v'
- 'vlib/v/markused/**.v'
- 'vlib/v/preludes/**.v'
- 'vlib/v/gen/native/**.v'
- 'vlib/v/gen/native/tests/**.v'
pull_request:
paths:
- '!**'
- '!**.md'
- 'vlib/v/gen/native/'
- 'cmd/tools/builders/**.v'
- 'vlib/builtin/**.v'
- 'vlib/v/ast/**.v'
- 'vlib/v/scanner/**.v'
- 'vlib/v/scanner/**.v'
- 'vlib/v/parser/**.v'
- 'vlib/v/checker/**.v'
- 'vlib/v/gen/c/**.v'
- 'vlib/v/builder/**.v'
- 'vlib/v/cflag/**.v'
- 'vlib/v/live/**.v'
- 'vlib/v/util/**.v'
- 'vlib/v/markused/**.v'
- 'vlib/v/preludes/**.v'
- 'vlib/v/gen/native/**.v'
- 'vlib/v/gen/native/tests/**.v'
concurrency:
group: native-backend-ci-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
native-backend:
strategy:
matrix:
os: [
ubuntu-18.04, ubuntu-20.04,
macos-11, macos-12,
windows-2019, windows-2022
]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install linker
if: ${{ startsWith(matrix.os, 'ubuntu')}}
run: |
sudo apt-get install --quiet -y binutils
- name: Build V with make.bat
if: ${{ startsWith(matrix.os, 'windows') }}
run: |
.\make.bat
.\v.exe symlink -githubci
- name: Build V with make
if: ${{ !startsWith(matrix.os, 'windows') }}
run: |
make
./v symlink -githubci
- name: Test the native backend
run: v test vlib/v/gen/native/

153
.github/workflows/other_ci.yml vendored Normal file
View File

@@ -0,0 +1,153 @@
name: Other CI
on:
push:
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"
concurrency:
group: build-other-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
no-gpl-by-accident:
runs-on: ubuntu-20.04
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 15
steps:
- uses: actions/checkout@v2
- name: No GPL licensed code, should be added accidentally
run: |
! grep -r --exclude="*.yml" "a GPL license" .
code-formatting:
runs-on: ubuntu-20.04
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 15
env:
VFLAGS: -cc gcc
steps:
- uses: actions/checkout@v2
- name: Environment info
run: echo $VFLAGS $GITHUB_SHA $GITHUB_REF
- name: Build local v
run: make -j4
- name: v test-cleancode
run: ./v test-cleancode
- name: v test-fmt
run: ./v test-fmt
performance-regressions:
runs-on: ubuntu-20.04
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 15
env:
VFLAGS: -cc gcc
steps:
- uses: actions/checkout@v2
- name: Environment info
run: echo $VFLAGS $GITHUB_SHA $GITHUB_REF
- name: Build local v
run: make -j4
- name: Clone & Build previous vmaster/v
run: |
git clone --depth=1 https://github.com/vlang/v vmaster/
(cd vmaster; make -j4)
- name: V versions
run: ./v version && ./vmaster/v version
- name: Build the repeat tool
run: ./v cmd/tools/repeat.v
- name: Repeat -o hw.c examples/hello_world.v
run: cmd/tools/repeat --max_time 251 --series 3 --count 20 --nmins 2 --nmaxs 5 --warmup 3 --fail_percent 10 -t 'cd {T} ; ./v -show-timings -o hw.c examples/hello_world.v' . ./vmaster
- name: Repeat -o v.c cmd/v
run: cmd/tools/repeat --max_time 1501 --series 3 --count 20 --nmins 2 --nmaxs 5 --warmup 3 --fail_percent 10 -t 'cd {T} ; ./v -show-timings -o v.c cmd/v' . ./vmaster
misc-tooling:
runs-on: ubuntu-20.04
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 121
env:
VFLAGS: -cc tcc -no-retry-compilation
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 10
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install --quiet -y libsodium-dev libssl-dev sqlite3 libsqlite3-dev postgresql libpq-dev valgrind
sudo apt-get install --quiet -y libfreetype6-dev libxi-dev libxcursor-dev libgl-dev xfonts-75dpi xfonts-base
sudo apt-get install --quiet -y g++-9
- name: Build v
run: make
- name: g++ version
run: g++-9 --version
- name: V self compilation with g++
run: ./v -cc g++-9 -no-std -cflags -std=c++11 -o v2 cmd/v && ./v2 -cc g++-9 -no-std -cflags -std=c++11 -o v3 cmd/v
## - name: Running tests with g++
## run: ./v -cc g++-9 test-self
- name: Ensure V can be compiled with -autofree
run: ./v -autofree -o v2 cmd/v ## NB: this does not mean it runs, but at least keeps it from regressing
- name: Shader examples can be build
run: |
wget https://github.com/floooh/sokol-tools-bin/raw/33d2e4cc26088c6c28eaef5467990f8940d15aab/bin/linux/sokol-shdc
chmod +x ./sokol-shdc
for f in examples/sokol/02_cubes_glsl/cube_glsl \
examples/sokol/03_march_tracing_glsl/rt_glsl \
examples/sokol/04_multi_shader_glsl/rt_glsl_puppy \
examples/sokol/04_multi_shader_glsl/rt_glsl_march \
examples/sokol/05_instancing_glsl/rt_glsl_instancing \
examples/sokol/06_obj_viewer/gouraud \
; do \
echo "compiling shader $f.glsl ..."; \
./sokol-shdc --input $f.glsl --output $f.h --slang glsl330 ; \
done
./v should-compile-all examples/sokol/*.v examples/sokol/0?*/*.v
parser-silent:
runs-on: ubuntu-20.04
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 121
steps:
- uses: actions/checkout@v2
- name: Install zzuf
run: sudo apt install -qq zzuf
- name: Build local v
run: |
make -j4
./v -g cmd/tools/vtest-parser.v
- name: Run test-parser
run: |
./v test-parser -S examples/hello_world.v
./v test-parser -S examples/hanoi.v
./v test-parser -S examples/fibonacci.v
./v test-parser -S examples/cli.v
./v test-parser -S examples/json.v
./v test-parser -S examples/vmod.v
./v test-parser -S examples/regex/regex_example.v
./v test-parser -S examples/2048/2048.v
- name: Run test-parser over fuzzed files
run: |
zzuf -R '\x00-\x20\x7f-\xff' -r0.01 < examples/hello_world.v > examples/hello_world_fuzz.v
zzuf -R '\x00-\x20\x7f-\xff' -r0.01 < examples/hanoi.v > examples/hanoi_fuzz.v
zzuf -R '\x00-\x20\x7f-\xff' -r0.01 < examples/fibonacci.v > examples/fibonacci_fuzz.v
zzuf -R '\x00-\x20\x7f-\xff' -r0.01 < examples/cli.v > examples/cli_fuzz.v
zzuf -R '\x00-\x20\x7f-\xff' -r0.01 < examples/json.v > examples/json_fuzz.v
zzuf -R '\x00-\x20\x7f-\xff' -r0.01 < examples/vmod.v > examples/vmod_fuzz.v
zzuf -R '\x00-\x20\x7f-\xff' -r0.01 < examples/regex/regex_example.v > examples/regex_example_fuzz.v
zzuf -R '\x00-\x20\x7f-\xff' -r0.01 < examples/2048/2048.v > examples/2048/2048_fuzz.v
./v test-parser -S examples/hello_world_fuzz.v
./v test-parser -S examples/hanoi_fuzz.v
./v test-parser -S examples/cli_fuzz.v
./v test-parser -S examples/regex_example_fuzz.v
./v test-parser -S examples/2048/2048_fuzz.v

107
.github/workflows/paths_ci.yml vendored Normal file
View File

@@ -0,0 +1,107 @@
name: Path Testing CI
on:
push:
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"
concurrency:
group: build-paths-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
space-paths-linux:
runs-on: ubuntu-20.04
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 30
env:
MY_V_PATH: '你好 my $path, @с интервали'
steps:
- uses: actions/checkout@v2
with:
path: ${{env.MY_V_PATH}}
- name: Build V
run: |
echo '${{env.MY_V_PATH}}'
ls -la
cd '${{env.MY_V_PATH}}'
ls -la
make
- name: v doctor
run: |
cd '${{env.MY_V_PATH}}'
./v doctor
- name: v tests
run: |
cd '${{env.MY_V_PATH}}'
./v test vlib/builtin vlib/os
space-paths-macos:
runs-on: macOS-latest
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 30
env:
MY_V_PATH: '你好 my $path, @с интервали'
steps:
- uses: actions/checkout@v2
with:
path: ${{env.MY_V_PATH}}
- name: Build V
run: |
echo '${{env.MY_V_PATH}}'
ls -la
cd '${{env.MY_V_PATH}}'
ls -la
make
## prebuild cmd/tools/builders/js_builder, to minimise the
## chances of a sporadic "Killed" when running the tests later
./v -b js run examples/hello_world.v
- name: v doctor
run: |
cd '${{env.MY_V_PATH}}'
./v doctor
- name: v tests
run: |
cd '${{env.MY_V_PATH}}'
./v test vlib/builtin vlib/os
space-paths-windows:
runs-on: windows-2022
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 30
env:
MY_V_PATH: 'path with some $punctuation, and some spaces'
## NB: the following paths do not work for now:
##### MY_V_PATH: '你好 my $path, @с интервали'
##### MY_V_PATH: 'path with some $punctuation, and some spaces '
## tcc has a problem interpreting paths with non latin letters in them,
## by default, but that can be solved with passing -Bthirdparty/tcc
## but after that V fails self building with:
####### builder error: cannot write to folder
####### D:\a\v\v\你好 my $path, @с интервали: No such file or directory
## and that happens even for gcc builds, not just tcc ones
steps:
- uses: actions/checkout@v2
with:
path: ${{env.MY_V_PATH}}
- name: Build V
run: |
echo '${{env.MY_V_PATH}}'
dir
cd '${{env.MY_V_PATH}}'
dir
.\make.bat -tcc
- name: v doctor
run: |
cd '${{env.MY_V_PATH}}'
./v doctor
- name: v tests
run: |
cd '${{env.MY_V_PATH}}'
./v test vlib/builtin vlib/os

View File

@@ -2,57 +2,59 @@ name: Periodic
on:
schedule:
- cron: '0 */2 * * *'
- cron: '0 */6 * * *'
jobs:
network-tests-ubuntu:
runs-on: ubuntu-20.04
if: github.event.ref == 'refs/heads/master' && github.event.repository.full_name == 'vlang/v'
timeout-minutes: 30
env:
V_CI_PERIODIC: 1
V_CI_PERIODIC: 1
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt-get install --quiet -y libssl-dev sqlite3 libsqlite3-dev valgrind
- name: Build v
run: make -j4
- name: Symlink V
run: sudo ./v symlink
## - name: Run network tests
## run: ./v -d network test vlib/net
- uses: actions/checkout@v2
- name: Install dependencies 1
run: sudo apt-get install --quiet -y libssl-dev sqlite3 libsqlite3-dev
- name: Build v
run: make
- name: Symlink V
run: sudo ./v symlink
## - name: Run network tests
## run: ./v -d network test vlib/net
network-tests-macos:
runs-on: macOS-latest
if: github.event.ref == 'refs/heads/master' && github.event.repository.full_name == 'vlang/v'
timeout-minutes: 30
env:
V_CI_PERIODIC: 1
V_CI_PERIODIC: 1
steps:
- uses: actions/checkout@v2
- name: Setup openssl library path
run: export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/opt/openssl/lib/"
- name: Build V
run: make -j4
- name: Symlink V
run: sudo ./v symlink
- name: Ensure thirdparty/cJSON/cJSON.o is compiled, before running tests.
run: ./v examples/json.v
## - name: Run network tests
## run: ./v -d network test vlib/net
- uses: actions/checkout@v2
- name: Setup openssl library path
run: export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/opt/openssl/lib/"
- name: Build V
run: make
- name: Symlink V
run: sudo ./v symlink
- name: Ensure thirdparty/cJSON/cJSON.o is compiled, before running tests.
run: ./v examples/json.v
## - name: Run network tests
## run: ./v -d network test vlib/net
network-windows-msvc:
runs-on: windows-2019
if: github.event.ref == 'refs/heads/master' && github.event.repository.full_name == 'vlang/v'
timeout-minutes: 30
env:
V_CI_PERIODIC: 1
VFLAGS: -cc msvc
V_CI_PERIODIC: 1
VFLAGS: -cc msvc
steps:
- uses: actions/checkout@v2
- name: Build
run: |
echo %VFLAGS%
echo $VFLAGS
.\make.bat -msvc
## - name: Run network tests
## run: .\v.exe -d network test vlib/net
- uses: actions/checkout@v2
- name: Build
run: |
echo %VFLAGS%
echo $VFLAGS
.\make.bat -msvc
## - name: Run network tests
## run: .\v.exe -d network test vlib/net

51
.github/workflows/sdl_ci.yml vendored Normal file
View File

@@ -0,0 +1,51 @@
name: sdl CI
on:
push:
paths-ignore:
- "**.md"
- "**.yml"
pull_request:
paths-ignore:
- "**.md"
- "**.yml"
concurrency:
group: sdl-ci-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
v-compiles-sdl-examples:
runs-on: ubuntu-18.04
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 30
env:
VFLAGS: -cc tcc
steps:
- uses: actions/checkout@v2
- name: Build V
run: make && sudo ./v symlink
- name: Clone sdl into .vmodules
run: |
git clone --depth 1 https://github.com/vlang/sdl
cd sdl
mkdir -p ~/.vmodules
ln -s $(pwd) ~/.vmodules/sdl
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install --quiet -y libsdl2-dev libsdl2-ttf-dev
sudo apt-get install --quiet -y libsdl2-mixer-dev libsdl2-image-dev
- name: Run tests
run: ./v test sdl
- name: Build sdl shared
run: ./v -shared -g sdl
- name: Build sdl examples
run: |
v shader sdl/examples/sdl_opengl_and_sokol
v should-compile-all sdl/examples/

73
.github/workflows/toml_ci.yml vendored Normal file
View File

@@ -0,0 +1,73 @@
name: toml CI
on:
push:
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"
jobs:
toml-module-pass-external-test-suites:
runs-on: ubuntu-latest
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 30
env:
TOML_BS_TESTS_PATH: vlib/toml/tests/testdata/burntsushi/toml-test
TOML_BS_TESTS_PINNED_COMMIT: 4634fdf
TOML_IARNA_TESTS_PATH: vlib/toml/tests/testdata/iarna/toml-test
TOML_IARNA_TESTS_PINNED_COMMIT: 1880b1a
TOML_AC_TESTS_PATH: vlib/toml/tests/testdata/alexcrichton/toml-test
TOML_AC_TESTS_PINNED_COMMIT: 499e8c4
VTEST_TOML_DO_LARGE_FILES: 1
VTEST_TOML_DO_YAML_CONVERSION: 1
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install --quiet -y jq libgc-dev
- name: Build V
run: make -j2 && ./v -cc gcc -o v cmd/v
- name: Show JQ Version
run: jq --version
- name: Run local TOML tests
run: ./v test vlib/toml
# Tests found at https://github.com/BurntSushi/toml-test
- name: Clone BurntSushi/toml-test
run: |
git clone -n https://github.com/BurntSushi/toml-test.git $TOML_BS_TESTS_PATH
git -C $TOML_BS_TESTS_PATH checkout $TOML_BS_TESTS_PINNED_COMMIT
- name: Run BurntSushi TOML tests
run: ./v vlib/toml/tests/burntsushi.toml-test_test.v
# Tests found at gist
- name: Get large_toml_file_test.toml
run: wget https://gist.githubusercontent.com/Larpon/89b0e3d94c6903851ff15559e5df7a05/raw/62a1f87a4e37bf157f2e0bfb32d85d840c98e422/large_toml_file_test.toml -O vlib/toml/tests/testdata/large_toml_file_test.toml
- name: Run large TOML file tests
run: ./v vlib/toml/tests/large_toml_file_test.v
# Tests found at https://github.com/iarna/toml-spec-tests
- name: Clone iarna/toml-spec-tests
run: |
git clone -n https://github.com/iarna/toml-spec-tests.git $TOML_IARNA_TESTS_PATH
git -C $TOML_IARNA_TESTS_PATH checkout $TOML_IARNA_TESTS_PINNED_COMMIT
- name: Run iarna TOML tests
run: ./v -gc boehm vlib/toml/tests/iarna.toml-spec-tests_test.v
# Tests found at https://github.com/alexcrichton/toml-rs
- name: Clone alexcrichton/toml-rs
run: |
git clone -n https://github.com/alexcrichton/toml-rs.git $TOML_AC_TESTS_PATH
git -C $TOML_AC_TESTS_PATH checkout $TOML_AC_TESTS_PINNED_COMMIT
- name: Run alexcrichton TOML tests
run: ./v vlib/toml/tests/alexcrichton.toml-rs-tests_test.v

View File

@@ -0,0 +1,142 @@
name: V Apps and Modules
on:
push:
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"
concurrency:
group: build-v-apps-and-modules-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
v-apps-compile:
runs-on: ubuntu-20.04
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 121
steps:
- uses: actions/checkout@v2
- name: Build V
run: make && sudo ./v symlink
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install --quiet -y libgc-dev libsodium-dev libssl-dev sqlite3 libsqlite3-dev valgrind libfreetype6-dev libxi-dev libxcursor-dev libgl-dev xfonts-75dpi xfonts-base
sudo apt-get install --quiet -y --no-install-recommends gfortran liblapacke-dev libopenblas-dev ## for vsl/vtl
sudo apt-get install --quiet -y --no-install-recommends sassc ## needed by gitly
- name: Build V Language Server (VLS)
run: |
echo "Clone VLS"
git clone --depth 1 https://github.com/vlang/vls /tmp/vls
echo "Build VLS"
v /tmp/vls/cmd/vls
echo "Build VLS with -prod"
v -prod /tmp/vls/cmd/vls
echo "Build VLS with -gc boehm -skip-unused"
v -gc boehm -skip-unused /tmp/vls/cmd/vls
echo "Test VLS with gcc"
v -cc gcc test /tmp/vls
- name: Build V Coreutils
run: |
echo "Clone Coreutils"
git clone --depth 1 https://github.com/vlang/coreutils /tmp/coreutils
echo "Build Coreutils"
cd /tmp/coreutils; make
- name: Build VAB
run: |
echo "Install VAB"
v install vab
echo "Build vab"
v ~/.vmodules/vab
echo "Build vab with -gc boehm -skip-unused"
v -gc boehm -skip-unused ~/.vmodules/vab
- name: Build Gitly
run: |
echo "Install markdown"
v install markdown
echo "Clone Gitly"
git clone https://github.com/vlang/gitly /tmp/gitly
echo "Build Gitly"
v /tmp/gitly
echo "Build Gitly with -autofree"
v -autofree /tmp/gitly
echo "Compile gitly.css from gitly.scss"
sassc /tmp/gitly/src/static/css/gitly.scss > /tmp/gitly/src/static/css/gitly.css
echo "Run first_run.v"
v run /tmp/gitly/tests/first_run.v
# /tmp/gitly/gitly -ci_run
- name: Build libsodium
run: |
echo "Install the libsodium wrapper"
v install libsodium
echo "Test libsodium"
VJOBS=1 v test ~/.vmodules/libsodium
- name: Build VEX
run: |
echo "Install Vex"
v install nedpals.vex
echo "Compile all of the Vex examples"
v should-compile-all ~/.vmodules/nedpals/vex/examples
echo "Compile the simple Vex example with -skip-unused"
v -skip-unused ~/.vmodules/nedpals/vex/examples/simple_example.v
echo "Run Vex Tests"
v test ~/.vmodules/nedpals/vex
- name: Build go2v
run: |
echo "Clone Go2V"
git clone --depth=1 https://github.com/vlang/go2v /tmp/go2v/
echo "Build Go2V"
v /tmp/go2v/
echo "Run Go2V tests"
VJOBS=1 v -stats test /tmp/go2v/
- name: Build vlang/pdf
run: |
v install pdf
echo "PDF examples should compile"
v should-compile-all ~/.vmodules/pdf/examples
- name: Install UI through VPM
run: |
echo "Official VPM modules should be installable"
v install ui
echo "Examples of UI should compile"
v ~/.vmodules/ui/examples/build_examples.vsh
- name: Build VSL
run: |
echo "Install VSL"
v install vsl
echo "Execute Tests using Pure V Backend"
~/.vmodules/vsl/bin/test
echo "Execute Tests using Pure V Backend with Pure V Math"
~/.vmodules/vsl/bin/test --use-cblas
echo "Execute Tests using Pure V Backend and Garbage Collection enabled"
~/.vmodules/vsl/bin/test --use-gc boehm
echo "Execute Tests using Pure V Backend with Pure V Math and Garbage Collection enabled"
~/.vmodules/vsl/bin/test --use-cblas --use-gc boehm
- name: Build VTL
run: |
echo "Install VTL"
v install vtl
echo "Install dependencies"
echo "Execute Tests using Pure V Backend"
~/.vmodules/vtl/bin/test
echo "Execute Tests using Pure V Backend with Pure V Math"
~/.vmodules/vtl/bin/test --use-cblas
echo "Execute Tests using Pure V Backend and Garbage Collection enabled"
~/.vmodules/vtl/bin/test --use-gc boehm
echo "Execute Tests using Pure V Backend with Pure V Math and Garbage Collection enabled"
~/.vmodules/vtl/bin/test --use-cblas --use-gc boehm

View File

@@ -11,7 +11,10 @@ on:
jobs:
vab-compiles-v-examples:
runs-on: ubuntu-20.04
timeout-minutes: 60
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 121
env:
VAB_FLAGS: --api 30 --build-tools 29.0.0 -v 3
steps:
- uses: actions/setup-java@v2
with:
@@ -20,33 +23,52 @@ jobs:
- uses: actions/checkout@v2
- name: Build V
run: make -j2 && ./v -cc gcc -o v cmd/v
run: make && sudo ./v symlink
- name: Clone vab
run: git clone --depth 1 https://github.com/vlang/vab
- name: Build vab
run: cd vab; ../v ./vab.v ; cd ..
- name: Install vab
run: |
v install vab
v -g ~/.vmodules/vab
sudo ln -s ~/.vmodules/vab/vab /usr/local/bin/vab
- name: Run tests
run: ./v test vab
- name: Build vab
run: ./v -g vab/vab.v
run: v test ~/.vmodules/vab
- name: Run vab --help
run: vab/vab --help
run: vab --help
- name: Run vab doctor
run: |
export VEXE=./v
vab/vab doctor
run: vab doctor
- name: Build graphical V examples as APK
run: |
declare -a v_examples=('flappylearning' '2048' 'fireworks' 'tetris' 'sokol/particles' 'sokol/drawing.v' 'sokol/freetype_raven.v' 'gg/polygons.v' 'gg/raven_text_rendering.v' 'gg/rectangles.v' 'gg/stars.v' 'gg/worker_thread.v')
mkdir apks
export VEXE=./v
for example in "${v_examples[@]}"; do
safe_name=$(echo "$example" | sed 's%/%-%' | sed 's%\.%-%' )
vab/vab --api 29 --build-tools '29.0.0' -v 3 examples/$example -o apks/$safe_name.apk
vab examples/$example -o apks/$safe_name.apk
done
v-compiles-os-android:
runs-on: ubuntu-20.04
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- name: Build V
run: make && sudo ./v symlink
- name: Install vab
run: |
v install vab
v -g ~/.vmodules/vab
sudo ln -s ~/.vmodules/vab/vab /usr/local/bin/vab
- name: Run vab --help
run: vab --help
- name: Run vab doctor
run: vab doctor
- name: Check `v -os android` *without* -apk flag
run: .github/workflows/android_cross_compile.vsh

View File

@@ -2,28 +2,36 @@ name: Build Vinix kernel
on:
pull_request:
paths-ignore:
- "**.md"
push:
branches:
- master
paths-ignore:
- "**.md"
jobs:
vinix-build:
runs-on: ubuntu-20.04
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
env:
VFLAGS: -gc none
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install build-essential meson -y
run: |
sudo apt-get update
sudo apt-get install build-essential meson -y
- name: Build V
run: make
- name: Clone current Vinix
run: git clone https://github.com/vlang/vinix.git --depth=1
- name: Clone current mlibc
run: git clone https://github.com/managarm/mlibc.git --depth=1
- name: Patch mlibc for Vinix
run: cd mlibc && patch -p3 < ../vinix/patches/mlibc/mlibc.patch
- name: Install mlibc headers
run: mkdir mlibc-build && cd mlibc-build && meson --cross-file ../vinix/cross_file.txt --prefix=/ -Dheaders_only=true ../mlibc && ninja && mkdir ../mlibc-headers && DESTDIR=`realpath ../mlibc-headers` ninja install
run: git clone https://github.com/vlang/vinix.git
- name: Attempt to build the Vinix kernel (debug)
run: cd vinix/kernel && make PROD=false CFLAGS="-D__vinix__ -O2 -g -pipe -I../../mlibc-headers/include" V="../../v" && make clean
run: cd vinix/kernel && make PROD=false CFLAGS="-D__vinix__ -O2 -g -pipe" V="../../v" && make clean
- name: Attempt to build the Vinix kernel (prod)
run: cd vinix/kernel && make PROD=true CFLAGS="-D__vinix__ -O2 -g -pipe -I../../mlibc-headers/include" V="../../v" && make clean
run: cd vinix/kernel && make PROD=true CFLAGS="-D__vinix__ -O2 -g -pipe" V="../../v" && make clean

View File

@@ -11,7 +11,8 @@ on:
jobs:
websocket_tests:
runs-on: ubuntu-20.04
timeout-minutes: 60
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
timeout-minutes: 121
env:
VFLAGS: -cc tcc -no-retry-compilation
steps:

View File

@@ -1,12 +1,11 @@
@echo off
curl -L https://www.sqlite.org/2020/sqlite-amalgamation-3320300.zip -o sqlite-amalgamation-3320300.zip
curl -L https://www.sqlite.org/2022/sqlite-amalgamation-3380200.zip -o sqlite-amalgamation-3380200.zip
unzip sqlite-amalgamation-3320300.zip -d thirdparty\
unzip sqlite-amalgamation-3380200.zip -d thirdparty\
del thirdparty\sqlite-amalgamation-3320300\shell.c
del thirdparty\sqlite-amalgamation-3380200\shell.c
move /y thirdparty\sqlite-amalgamation-3320300 thirdparty\sqlite
move /y thirdparty\sqlite-amalgamation-3380200 thirdparty\sqlite
dir thirdparty\sqlite

19
.gitignore vendored
View File

@@ -20,6 +20,7 @@ vdbg.exe
*.dll
*.lib
*.bak
*.dylib
a.out
.noprefix.vrepl_temp
@@ -30,6 +31,10 @@ a.out
/v.c.out
/v_old
/v_old.exe
/vold
/vold.exe
/vnew
/vnew.exe
.vrepl_temp.v
fns.txt
.noprefix.vrepl_temp.v
@@ -49,12 +54,14 @@ fns.txt
!Dockerfile.cross
!LICENSE
!Makefile
!GNUmakefile
# ignore editor files
.idea
.project
.classpath
.c9
.vs
*.launch
.settings/
*.sublime-workspace
@@ -71,6 +78,7 @@ cachegrind.out.*
.gdb_history
*.dSYM
*.def
vgcore.*
# ignore system files
.DS_Store
@@ -98,3 +106,14 @@ shell.nix
default.nix
flake.nix
.envrc
thirdparty/stdatomic/nix/cpp/*.h
# ignore VLS log
vls.log
# ignore v2go tmperror files
*.tmperr
*/**/tmp.*

View File

@@ -1,8 +0,0 @@
CC ?= cc
all:
rm -rf vc/
git clone --depth 1 --quiet https://github.com/vlang/vc
$(CC) -std=gnu11 -w -o v vc/v.c -lm -lexecinfo
rm -rf vc/
@echo "V has been successfully built"

View File

@@ -1,10 +1,157 @@
-## V 0.2.4
-*Not yet released, changelog is not full*
## V 0.3.2
*Not yet released*
- New stunnig playground with an improved look and feel, much better and responsive editor,
code sharing by link, more convenient keyboard control, reusability for potential embedding:
https://play.vlang.io.
- msgpack module for decoding/encoding msgpack.
- Easier custom error creation: `return MyCustomErr{}` instead of `return IError(MyCustomErr)`.
- Remove the need for the `[console]` attribute in Windows GUI apps.
- All floats outputs now have `.0` conditionally appended to them to improve clarity.
## V 0.3.1
*31 Aug 2022*
- Anonymous structs.
- Lots of bug fixes: 90% of all bugs ever submitted are closed.
- Major improvements to the fast native backend including linking support on Linux. The goal is to be able to self host V soon.
- Parallelized cc step. Speeds up -prod and clang/gcc compilation by 300-500% (depending on
the number of cores). Experimental and hidden behind a -parallel-cc flag, soon to be the default.
- New keyword/type: `nil`. Only to be used inside `unsafe`. Replaces `voidptr(0)`.
- V can now find code in the `src/` directory. This allows making V repos much cleaner.
- Intel C compiler support.
- Older macOS support (<10.12).
- `os.mkdir()` now has an optional `mode` parameter.
- Full termux support via `$if termux {`, more predictable logging on Android.
- Go backend fixes.
- More type checks.
- DOOM is now translated/compiled and launched on CI servers. A screenshot of the running game
is made via `vgret` and is compared to the expected result.
- VLS performance improvements, especially on Windows.
- `v ls` tool for installing, for updating, and for launching VLS (V Language Server).
- Support `assert condition, extra_message`, where the `extra_message` will be evaluated and shown if the assertion fails.
- Anonymous sumtypes have been removed (deprecated for now) due to complicating the language and the compiler too much.
- `encoding.csv` is now generic, supports bools, accepts a custom delimiter, and is compatible with io.Reader/io.Writer.
- Operator overloading now works with aliases and generics.
- `datatypes` module now uses operator overloading.
- All `datatypes` types can be converted to V arrays.
- `smtp` improvements including multiple recipients and base64/utf8 support.
- `v doc` now has syntax highlighting.
- `arrays.carray_to_varray<T>()` for converting C arrays to V arrays.
- `strconv.v_sprintf()` has been deprecated in favor of string interpolation.
- TOML module now supports `[toml:...]` attributes, just like the JSON module.
- `os.walk()` is no longer recursive (still works the same).
- Windows code has been removed from `v.c` distributed on non-Windows systems. (`v_windows.c` is used on Windows.)
- ORM functions now return `Result`, so the errors can be handled.
- `#preinclude` for low level C interop.
- `net.urllib` ipv6 support.
- Lots of fixes in `shared` types.
- `io` has been migrated to `Result`.
- Third party window control in Sokol.
- Scanner optimizations.
- `string.replace_char()`, `math.round_sig()`.
- Improved multiplication performance in `math.big`.
- `net.Http.Response.text` renamed to `body`.
- Using C's #define is no longer allowed in normal V code, only in `.c.v` files.
- V interpreter improvements.
- `net.websocket` timeout is now configurable.
## V 0.3
*30 Jun 2022*
- C to V translation via C2V: `v translate file.c`. (Demo video: [Translating DOOM from C to V, building it in under a second and running it!](https://www.youtube.com/watch?v=6oXrz3oRoEg))
- Lots of bug fixes in V, cgen, and C interop to allow running translated DOOM.v.
- Programs built with the V compiler no longer leak memory by default.
- Closures. All operating systems are supported. ([Demo](https://twitter.com/v_language/status/1528710491882852352))
- `Option` and `Result` are now separate types: `?Foo` and `!Foo` respectively. Old code will continue working for 1 year and will result in a warning/hint.
- Hundreds of new checks in the type checker.
- All V's backends have been split up into separate processes. As the result, building V got 26% faster.
- Maps and arrays can now return optionals: `m[bad_key] or { ... }`, `if x := arr[key] { ... }`.
- `ustring` has been replaced with `[]rune` (works just like in Go).
- Maps can now have non-string keys.
- A new compiler pass for transforming the AST (doesn't slow the compiler too much, adds about 25ms to `v self`). It eliminates unreachable branches and performs other simple optimizations and transformations.
- C backend is now parallel (just the cgen part for now).
- Lots of compiler source code clean up and minor optimizations. The compiler got ~30% faster according to fast.vlang.io.
- Better compiler source code organization (absolutely necessary as it's surpassed 100k loc).
- The naming of V's integer types is now more consistent: `byte` has been renamed to `u8`. Old code will continue working for 1 year and will result in a warning/hint.
- The typo detector now highlights the suggested name so that it's more visible.
- `datatypes` module now has `Heap, Queue, Stack, BSTree, LinkedList`.
- Interfaces can now be embedded (like structs).
- vlib now has a TOML parser, fully compatible with TOML 1.0.
- Lots of work done on the V.js backend, including the graphics library, which has been ported to V.js.
- JS promises, await (V.js).
- It's now possible to do more complex array initialization by using each individual element of the array (`[]int{init: it}`).
- Unsigned right shift operators `>>>` and `>>>=` have been added to V. (They work exactly like in Java.)
- `-nofloat` option, which is useful for writing kernels and for embedded systems without an FPU (used in Vinix).
- Generic interfaces.
- TCC is now bundled with the language, this allows building V programs without an external C compiler dependency.
- Null can be used in `unsafe` only (for example, for C interop).
- Pointer arithmetics and comparing pointers to numbers is now also only allowed in `unsafe`.
- Inline sumtypes.
- New module `compress.gzip`.
- Lots of `net`/`net.http`/`vweb` fixes (also used for the upcoming Gitly launch).
- IPv6 support.
- `net.http` headers are now enum fields instead of strings. This allows to avoid typos and offers autocomplete.
- Struct field deprecation.
- Static GC (no longer a dynamic lib dependency).
- New various algorithms for random number generation: MT19937RNG, etc (module `rand`).
- Fix immutability bugs that allowed to bypass compiler immutability checks and modify const/immutable values.
- Lots of fixes in the JSON serializer.
- Heap allocated only structs marked with `[heap]`.
- Significantly improve lots of error messages, make them more clear, suggest hints.
- Bug fixes and new features in the pure V `regex` module.
- Lots of new drawing functions in the graphics module (like `gg.draw_polygon_filled(), gg.draw_arc_empty()` etc)
- Builtin FPS display in `gg`.
- Latest Sokol backend in `gg`.
- Advanced CI tests for the graphics module. Graphical apps are run on GitHub Actions instances, their output is saved to an image, uploaded, and compared to the expected result.
- More bug fixes in generics.
- Bug fixes in aliases. They can now fully replace the types they alias.
- `[minify]` struct attribute for struct minification.
- `for in` now works with fixed arrays.
- The parser was made a bit faster by skipping `vfmt` code when not in `vfmt` mode (by using `-d vfmt`).
- Lots of vfmt improvements, especially with comments.
- Experimental `#[index]` syntax for negative indexing (like in Python, but needs special syntax instead of being used by default).
- Visibility bug fixes in modules (`pub`).
- Error propagation in complex expressions (e.g. `foo(bar()?)`).
- Optionals can now by used in consts (`const x := opt() or {}`).
- Lots of new documentation, including vlib modules documentation and the official V Documentation.
- vpm improvements (including a new vpm mirror).
- `sync` improvements including `sync.thread_id()`, `sync.Once`..
- V can now be used to generate object files (`foo.o`) that can be used in existing C projects.
- `-usecache` and `-skip-unused` fixes, they are close to being on by default.
- Lots of Windows issues fixed.
- Amazon Linux support.
- Fixes in shared maps and arrays.
- `term.ui` improvements, including multi byte/UTF-8 events.
- New `crypto` modules, including `crypto.des, crypto.cipher, crypto.blowfish`.
- Comptime fixes.
- 4 byte bool option (`-d 4bytebool`) for compatibility with some C software.
- `strconv` (pure V formatting module used in string interpolation) fixes and performance improvements.
- ORM fixes (pg, mysql, sqlite). Tables are now created automatically based on the V structs, no more need in sql files to create tables for apps.
- `volatile` keyword.
- `"stringliteral".len` optimization (replaced by the actual number by the new `transform` pass).
- Lots of inline assembler improvements (it's used a lot in Vinix).
- Many new functions in the `math` module.
- Separators in number literals: `1_000_000`.
- `strings.Builder` optimizations and new methods.
- Autofree fixes (still not production ready, hidden behind the `-autofree` flag).
- Lots of Android fixes in V and in vab.
- Lots of commits to the native backend (amd64/arm64).
- V interpreter fixes. (Still at an early stage.)
- Go2V translator has been started by the community, and can already translate simple programs.
- An early version of the Go backend (`v -b go -o file.go file.v`).
## V 0.2.4
*30 Aug 2021*
- Introduce `isize` and `usize` types, deprecate `size_t` in favor of `usize`.
- Add `datatypes` and `datatypes.fsm` modules.
- Add `compile_error` and `compile_warn` comptime functions.
- Bare metal support. Vinix OS kernel is now being developed in V.
- Builtin web framework vweb is now multithreaded, all CPU cores are used.
- String interpolation and struct stringers are now implemented in pure V
with a much cleaner and faster implementation. Previously libc's `sprintf`
was used.
- Improved `unused variable` warning. Assigning to a variable no longer marks it as used.
- Bare metal support. Vinix OS kernel is now being developed in V.
*... lots of missing changelog for this version, sorry (will update a bit later)*
## V 0.2.2 - 0.2.3
*22 Jan 2021*
@@ -44,12 +191,11 @@ from local variables.
## V 0.2
*22 Dec 2020*
- Compile-time memory management via `-autofree`. [Video demonstration](https://www.youtube.com/watch?v=gmB8ea8uLsM).
It will be enabled by default in 0.3
- Compile-time memory management via `-autofree` (not production ready yet). [Video demonstration](https://www.youtube.com/watch?v=gmB8ea8uLsM).
- Channels and locks.
- Thread safe typed arrays via keyword `shared`.
- Struct embedding.
- IO streams.
- IO streams (`io.Reader`, `io.Writer` etc).
- A powerful websocket module that conforms to RFC 6455 and passes the Autobahn test suite (498 client tests and 249 server tests).
- The `net` module is now non blocking and is more feature complete providing similar API to Go.
- V's graphics module now uses Metal/DirectX/OpenGL instead of just OpenGL.

View File

@@ -35,32 +35,35 @@ The main files are:
- Creates a parser object for each file and runs `parse()` on them.
- The correct backend is called (C, JS, native), and a binary is compiled.
2. `v/scanner` The scanner's job is to parse a list of characters and convert
2. `vlib/v/scanner` The scanner's job is to parse a list of characters and convert
them to tokens.
3. `v/token` This is simply a list of all tokens, their string values, and a
3. `vlib/v/token` This is simply a list of all tokens, their string values, and a
couple of helper functions.
4. `v/parser` The parser. It converts a list of tokens into an AST.
4. `vlib/v/parser` The parser. It converts a list of tokens into an AST.
In V, objects can be used before declaration, so unknown types are marked as
unresolved. They are resolved later in the type checker.
5. `v/table` V creates one table object that is shared by all parsers. It
5. `vlib/v/table` V creates one table object that is shared by all parsers. It
contains all types, consts, and functions, as well as several helpers to search
for objects by name, register new objects, modify types' fields, etc.
6. `v/checker` Type checker and resolver. It processes the AST and makes sure
6. `vlib/v/checker` Type checker and resolver. It processes the AST and makes sure
the types are correct. Unresolved types are resolved, type information is added
to the AST.
7. `v/gen/c` C backend. It simply walks the AST and generates C code that can be
7. `vlib/v/gen/c` C backend. It simply walks the AST and generates C code that can be
compiled with Clang, GCC, Visual Studio, and TCC.
8. `json.v` defines the json code generation. This file will be removed once V
8. `vlib/v/gen/js` JavaScript backend. It simply walks the AST and generates JS code that can be
executed on the browser or in NodeJS/Deno.
9. `vlib/v/gen/c/json.v` defines the json code generation. This file will be removed once V
supports comptime code generation, and it will be possible to do this using the
language's tools.
9. `v/gen/native` is the directory with all the machine code generation logic. It
10. `vlib/v/gen/native` is the directory with all the machine code generation logic. It
defines a set of functions that translate assembly instructions to machine code
and build the binary from scratch byte by byte. It manually builds all headers,
segments, sections, symtable, relocations, etc. Right now it only has basic
@@ -90,6 +93,7 @@ making pullrequests, and you can just do normal git operations such as:
5. When finished with a feature/bugfix/change, you can:
`git checkout -b fix_alabala`
- Don't forget to keep formatting standards, run `v fmt -w YOUR_MODIFIED_FILES` before committing
6. `git push pullrequest` # (NOTE: the `pullrequest` remote was setup on step 4)
7. On GitHub's web interface, go to: https://github.com/vlang/v/pulls
@@ -183,17 +187,20 @@ to create a copy of the compiler rather than replacing it with `v self`.
| Flag | Usage |
|------|-------|
| `debugautostr` | Prints informations about `.str()` method auto-generated by the compiler during C generation |
| `debugscanner` | Prints debug information during the scanning phase |
| `debug_codegen` | Prints automatically generated V code during the scanning phase |
| `debug_interface_table` | Prints generated interfaces during C generation |
| `debug_interface_type_implements` | Prints debug information when checking that a type implements in interface |
| `print_vweb_template_expansions` | Prints vweb compiled HTML files |
| `time_checking` | Prints the time spent checking files and other related informations |
| `time_parsing` | Prints the time spent parsing files and other related informations |
| `time_checking` | Prints the time spent checking files and other related information |
| `time_parsing` | Prints the time spent parsing files and other related information |
| `trace_autofree` | Prints details about how/when -autofree puts free() calls |
| `trace_autostr` | Prints details about `.str()` method auto-generated by the compiler during C generation |
| `trace_ccoptions` | Prints options passed down to the C compiler |
| `trace_checker` | Prints informations about the statements being checked |
| `trace_checker` | Prints details about the statements being checked |
| `trace_gen` | Prints strings written to the generated C file. Beware, this flag is very verbose |
| `trace_parser` | Prints informations about parsed statements and expressions |
| `trace_thirdparty_obj_files` | Prints informations about built thirdparty obj files |
| `trace_use_cache` | Prints informations about cache use |
| `trace_parser` | Prints details about parsed statements and expressions |
| `trace_thirdparty_obj_files` | Prints details about built thirdparty obj files |
| `trace_usecache` | Prints details when -usecache is used |
| `trace_embed_file` | Prints details when $embed_file is used |
| `embed_only_metadata` | Embed only the metadata for the file(s) with `$embed_file('somefile')`; faster; for development, *not* distribution |

View File

@@ -7,7 +7,7 @@ WORKDIR /opt/vlang
ARG USE_LOCAL
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends gcc clang make git && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends gcc clang make git binutils && \
apt-get clean && rm -rf /var/cache/apt/archives/* && \
rm -rf /var/lib/apt/lists/*

View File

@@ -12,11 +12,14 @@ RUN mkdir -p /opt/vlang && ln -s /opt/vlang/v /usr/bin/v
ARG USE_LOCAL
## libexecinfo is needed for the bundled tcc
RUN apk --no-cache add \
git make upx gcc bash \
musl-dev \
musl-dev libc-dev \
openssl-dev sqlite-dev \
libx11-dev glfw-dev freetype-dev
libx11-dev glfw-dev freetype-dev \
libexecinfo-dev libexecinfo-static \
libc6-compat gcompat binutils
## RUN apk --no-cache add --virtual sdl2deps sdl2-dev sdl2_ttf-dev sdl2_mixer-dev sdl2_image-dev
COPY . /vlang-local

View File

@@ -1,6 +1,6 @@
FROM mstorsjo/llvm-mingw
LABEL maintainer="Vitaly Takmazov <vitalyster@gmail.com>"
LABEL maintainer="Delyan Angelov <delian66@gmail.com>"
COPY . .
RUN make
RUN ./v -os windows -o v.c cmd/v

205
GNUmakefile Normal file
View File

@@ -0,0 +1,205 @@
CC ?= cc
CFLAGS ?=
LDFLAGS ?=
TMPDIR ?= /tmp
VROOT ?= .
VC ?= ./vc
VEXE ?= ./v
VCREPO ?= https://github.com/vlang/vc
TCCREPO ?= https://github.com/vlang/tccbin
LEGACYREPO ?= https://github.com/macports/macports-legacy-support
VCFILE := v.c
TMPTCC := $(VROOT)/thirdparty/tcc
LEGACYLIBS := $(VROOT)/thirdparty/legacy
TMPLEGACY := $(LEGACYLIBS)/source
TCCOS := unknown
TCCARCH := unknown
GITCLEANPULL := git clean -xf && git pull --quiet
GITFASTCLONE := git clone --depth 1 --quiet --single-branch
#### Platform detections and overrides:
_SYS := $(shell uname 2>/dev/null || echo Unknown)
_SYS := $(patsubst MSYS%,MSYS,$(_SYS))
_SYS := $(patsubst MINGW%,MinGW,$(_SYS))
ifneq ($(filter $(_SYS),MSYS MinGW),)
WIN32 := 1
VEXE := ./v.exe
endif
ifeq ($(_SYS),Linux)
LINUX := 1
TCCOS := linux
ifneq ($(shell ldd /bin/ls | grep musl),)
TCCOS := linuxmusl
endif
endif
ifeq ($(_SYS),Darwin)
MAC := 1
TCCOS := macos
ifeq ($(shell expr $(shell uname -r | cut -d. -f1) \<= 15), 1)
LEGACY := 1
endif
endif
ifeq ($(_SYS),FreeBSD)
TCCOS := freebsd
LDFLAGS += -lexecinfo
endif
ifeq ($(_SYS),NetBSD)
TCCOS := netbsd
LDFLAGS += -lexecinfo
endif
ifdef ANDROID_ROOT
ANDROID := 1
undefine LINUX
TCCOS := android
endif
#####
ifdef WIN32
TCCOS := windows
VCFILE := v_win.c
endif
TCCARCH := $(shell uname -m 2>/dev/null || echo unknown)
ifeq ($(TCCARCH),x86_64)
TCCARCH := amd64
else
ifneq ($(filter x86%,$(TCCARCH)),)
TCCARCH := i386
else
ifeq ($(TCCARCH),arm64)
TCCARCH := arm64
else
ifneq ($(filter arm%,$(TCCARCH)),)
TCCARCH := arm
# otherwise, just use the arch name
endif
endif
endif
endif
.PHONY: all clean check fresh_vc fresh_tcc fresh_legacy check_for_working_tcc
ifdef prod
VFLAGS+=-prod
endif
all: latest_vc latest_tcc latest_legacy
ifdef WIN32
$(CC) $(CFLAGS) -std=c99 -municode -w -o v1.exe $(VC)/$(VCFILE) $(LDFLAGS)
v1.exe -no-parallel -o v2.exe $(VFLAGS) cmd/v
v2.exe -o $(VEXE) $(VFLAGS) cmd/v
del v1.exe
del v2.exe
else
ifdef LEGACY
$(MAKE) -C $(TMPLEGACY)
$(MAKE) -C $(TMPLEGACY) PREFIX=$(realpath $(LEGACYLIBS)) CFLAGS=$(CFLAGS) LDFLAGS=$(LDFLAGS) install
rm -rf $(TMPLEGACY)
$(eval override LDFLAGS+=-L$(realpath $(LEGACYLIBS))/lib -lMacportsLegacySupport)
endif
$(CC) $(CFLAGS) -std=gnu99 -w -o v1.exe $(VC)/$(VCFILE) -lm -lpthread $(LDFLAGS)
./v1.exe -no-parallel -o v2.exe $(VFLAGS) cmd/v
./v2.exe -o $(VEXE) $(VFLAGS) cmd/v
rm -rf v1.exe v2.exe
endif
@$(VEXE) run cmd/tools/detect_tcc.v
@echo "V has been successfully built"
@$(VEXE) -version
clean:
rm -rf $(TMPTCC)
rm -rf $(LEGACYLIBS)
rm -rf $(VC)
ifndef local
latest_vc: $(VC)/.git/config
cd $(VC) && $(GITCLEANPULL)
else
latest_vc:
@echo "Using local vc"
endif
check_for_working_tcc:
@$(TMPTCC)/tcc.exe --version > /dev/null 2> /dev/null || echo "The executable '$(TMPTCC)/tcc.exe' does not work."
fresh_vc:
rm -rf $(VC)
$(GITFASTCLONE) $(VCREPO) $(VC)
ifndef local
latest_tcc: $(TMPTCC)/.git/config
cd $(TMPTCC) && $(GITCLEANPULL)
@$(MAKE) --quiet check_for_working_tcc 2> /dev/null
else
latest_tcc:
@echo "Using local tcc"
@$(MAKE) --quiet check_for_working_tcc 2> /dev/null
endif
fresh_tcc:
rm -rf $(TMPTCC)
ifndef local
# Check wether a TCC branch exists for the user's system configuration.
ifneq (,$(findstring thirdparty-$(TCCOS)-$(TCCARCH), $(shell git ls-remote --heads $(TCCREPO) | sed 's/^[a-z0-9]*\trefs.heads.//')))
$(GITFASTCLONE) --branch thirdparty-$(TCCOS)-$(TCCARCH) $(TCCREPO) $(TMPTCC)
@$(MAKE) --quiet check_for_working_tcc 2> /dev/null
else
@echo 'Pre-built TCC not available for thirdparty-$(TCCOS)-$(TCCARCH) at $(TCCREPO), will use the system compiler: $(CC)'
$(GITFASTCLONE) --branch thirdparty-unknown-unknown $(TCCREPO) $(TMPTCC)
@$(MAKE) --quiet check_for_working_tcc 2> /dev/null
endif
else
@echo "Using local tccbin"
@$(MAKE) --quiet check_for_working_tcc 2> /dev/null
endif
ifndef local
latest_legacy: $(TMPLEGACY)/.git/config
ifdef LEGACY
cd $(TMPLEGACY) && $(GITCLEANPULL)
endif
else
latest_legacy:
ifdef LEGACY
@echo "Using local legacysupport"
endif
endif
fresh_legacy:
rm -rf $(LEGACYLIBS)
$(GITFASTCLONE) $(LEGACYREPO) $(TMPLEGACY)
$(TMPTCC)/.git/config:
$(MAKE) fresh_tcc
$(VC)/.git/config:
$(MAKE) fresh_vc
$(TMPLEGACY)/.git/config:
ifdef LEGACY
$(MAKE) fresh_legacy
endif
asan:
$(MAKE) all CFLAGS='-fsanitize=address,undefined'
selfcompile:
$(VEXE) -cg -o v cmd/v
selfcompile-static:
$(VEXE) -cg -cflags '--static' -o v-static cmd/v
### NB: Please keep this Makefile and make.bat simple.
install:
@echo 'Please use `sudo ./v symlink` instead.'
check:
$(VEXE) test-all

159
Makefile
View File

@@ -1,154 +1,19 @@
CC ?= cc
VFLAGS ?=
CFLAGS ?=
LDFLAGS ?=
TMPDIR ?= /tmp
VROOT ?= .
VC ?= ./vc
V ?= ./v
VCREPO ?= https://github.com/vlang/vc
TCCREPO ?= https://github.com/vlang/tccbin
VCFILE := v.c
TMPTCC := $(VROOT)/thirdparty/tcc
TCCOS := unknown
TCCARCH := unknown
GITCLEANPULL := git clean -xf && git pull --quiet
GITFASTCLONE := git clone --depth 1 --quiet --single-branch
.PHONY: all check
#### Platform detections and overrides:
_SYS := $(shell uname 2>/dev/null || echo Unknown)
_SYS := $(patsubst MSYS%,MSYS,$(_SYS))
_SYS := $(patsubst MINGW%,MinGW,$(_SYS))
ifneq ($(filter $(_SYS),MSYS MinGW),)
WIN32 := 1
V:=./v.exe
endif
ifeq ($(_SYS),Linux)
LINUX := 1
TCCOS := linux
endif
ifeq ($(_SYS),Darwin)
MAC := 1
TCCOS := macos
endif
ifeq ($(_SYS),FreeBSD)
TCCOS := freebsd
LDFLAGS += -lexecinfo
endif
ifeq ($(_SYS),NetBSD)
TCCOS := netbsd
LDFLAGS += -lexecinfo
endif
ifdef ANDROID_ROOT
ANDROID := 1
undefine LINUX
TCCOS := android
endif
#####
ifdef WIN32
TCCOS := windows
VCFILE := v_win.c
endif
TCCARCH := $(shell uname -m 2>/dev/null || echo unknown)
ifeq ($(TCCARCH),x86_64)
TCCARCH := amd64
else
ifneq ($(filter x86%,$(TCCARCH)),)
TCCARCH := i386
else
ifeq ($(TCCARCH),arm64)
TCCARCH := arm64
else
ifneq ($(filter arm%,$(TCCARCH)),)
TCCARCH := arm
# otherwise, just use the arch name
endif
endif
endif
endif
.PHONY: all clean fresh_vc fresh_tcc
ifdef prod
VFLAGS+=-prod
endif
all: latest_vc latest_tcc
ifdef WIN32
$(CC) $(CFLAGS) -std=c99 -municode -w -o $(V) $(VC)/$(VCFILE) $(LDFLAGS)
$(V) -o v2.exe $(VFLAGS) cmd/v
move /y v2.exe v.exe
else
$(CC) $(CFLAGS) -std=gnu99 -w -o $(V) $(VC)/$(VCFILE) -lm -lpthread $(LDFLAGS)
$(V) -o v2.exe $(VFLAGS) cmd/v
mv -f v2.exe v
endif
all:
rm -rf vc/
git clone --depth 1 --quiet https://github.com/vlang/vc
$(CC) $(CFLAGS) -std=gnu11 -w -o v1 vc/v.c -lm -lexecinfo -lpthread $(LDFLAGS)
./v1 -no-parallel -o v2 $(VFLAGS) cmd/v
./v2 -o v $(VFLAGS) cmd/v
rm -rf v1 v2 vc/
@echo "V has been successfully built"
@$(V) -version
./v run ./cmd/tools/detect_tcc.v
clean:
rm -rf $(TMPTCC)
rm -rf $(VC)
ifndef local
latest_vc: $(VC)/.git/config
cd $(VC) && $(GITCLEANPULL)
else
latest_vc:
@echo "Using local vc"
endif
fresh_vc:
rm -rf $(VC)
$(GITFASTCLONE) $(VCREPO) $(VC)
ifndef local
latest_tcc: $(TMPTCC)/.git/config
cd $(TMPTCC) && $(GITCLEANPULL)
else
latest_tcc:
@echo "Using local tcc"
endif
fresh_tcc:
rm -rf $(TMPTCC)
ifndef local
# Check wether a TCC branch exists for the user's system configuration.
ifneq (,$(findstring thirdparty-$(TCCOS)-$(TCCARCH), $(shell git ls-remote --heads $(TCCREPO) | sed 's/^[a-z0-9]*\trefs.heads.//')))
$(GITFASTCLONE) --branch thirdparty-$(TCCOS)-$(TCCARCH) $(TCCREPO) $(TMPTCC)
else
@echo 'Pre-built TCC not available for thirdparty-$(TCCOS)-$(TCCARCH) at $(TCCREPO), will use the system compiler: $(CC)'
$(GITFASTCLONE) --branch thirdparty-unknown-unknown $(TCCREPO) $(TMPTCC)
endif
else
@echo "Using local tccbin"
endif
$(TMPTCC)/.git/config:
$(MAKE) fresh_tcc
$(VC)/.git/config:
$(MAKE) fresh_vc
asan:
$(MAKE) all CFLAGS='-fsanitize=address,undefined'
selfcompile:
$(V) -cg -o v cmd/v
selfcompile-static:
$(V) -cg -cflags '--static' -o v-static cmd/v
### NB: Please keep this Makefile and make.bat simple.
install:
@echo 'Please use `sudo v symlink` instead.'
check:
./v test-all

View File

@@ -1,14 +1,10 @@
<div align="center">
<p>
<img width="80" src="https://raw.githubusercontent.com/vlang/v-logo/master/dist/v-logo.svg?sanitize=true">
<a href="https://vlang.io/" target="_blank"><img width="80" src="https://raw.githubusercontent.com/vlang/v-logo/master/dist/v-logo.svg?sanitize=true"></a>
</p>
<h1>The V Programming Language</h1>
[vlang.io](https://vlang.io) |
[Docs](https://github.com/vlang/v/blob/master/doc/docs.md) |
[Changelog](https://github.com/vlang/v/blob/master/CHANGELOG.md) |
[Speed](https://fast.vlang.io/) |
[Contributing & compiler design](https://github.com/vlang/v/blob/master/CONTRIBUTING.md)
[vlang.io](https://vlang.io) | [Docs](https://github.com/vlang/v/blob/master/doc/docs.md) | [Changelog](https://github.com/vlang/v/blob/master/CHANGELOG.md) | [Speed](https://fast.vlang.io/) | [Contributing & compiler design](https://github.com/vlang/v/blob/master/CONTRIBUTING.md)
</div>
<div align="center">
@@ -25,22 +21,23 @@
## Key Features of V
- Simplicity: the language can be learned in less than an hour
- Simplicity: the language can be learned in a weekend
- Fast compilation: ≈110k loc/s with a Clang backend,
1 million loc/s with native and tcc backends *(Intel i5-7500, SSD, no optimization)* ([demo video](https://www.youtube.com/watch?v=pvP6wmcl_Sc))
500k loc/s with native and tcc backends *(Intel i5-7500, SSD, no optimization)* ([demo video](https://www.youtube.com/watch?v=pvP6wmcl_Sc))
- Easy to develop: V compiles itself in less than a second
- Performance: as fast as C (V's main backend compiles to human readable C)
- Performance: as fast as C (V's main backend compiles to human-readable C)
- Safety: no null, no globals, no undefined behavior, immutability by default
- C to V translation
- C to V translation ([Translating DOOM demo video](https://www.youtube.com/watch?v=6oXrz3oRoEg))
- Hot code reloading
- [Innovative memory management](https://vlang.io/#memory) ([demo video](https://www.youtube.com/watch?v=gmB8ea8uLsM))
- [Cross-platform UI library](https://github.com/vlang/ui)
- Built-in graphics library
- Easy cross compilation
- Easy cross-compilation
- REPL
- [Built-in ORM](https://github.com/vlang/v/blob/master/doc/docs.md#orm)
- [Built-in web framework](https://github.com/vlang/v/blob/master/vlib/vweb/README.md)
- C and JavaScript backends
- Great for writing low-level software ([Vinix OS](https://github.com/vlang/vinix))
## Stability guarantee and future changes
@@ -59,23 +56,40 @@ Unlike many other languages, V is not going to be always changing, with new feat
being introduced and old features modified. It is always going to be a small and simple
language, very similar to the way it is right now.
## Installing V from source
## Installing V - from source *(preferred method)*
### Linux, macOS, Windows, *BSD, Solaris, WSL, Android, Raspbian
### Linux, macOS, Windows, *BSD, Solaris, WSL, Android, etc.
Usually installing V is quite simple if you have an environment that already has a
functional `git` installation.
* *(* ***PLEASE NOTE:*** *If you run into any trouble or you have a different operating
system or Linux distribution that doesn't install or work immediately, please see
[Installation Issues](https://github.com/vlang/v/discussions/categories/installation-issues)
and search for your OS and problem. If you can't find your problem, please add it to an
existing discussion if one exists for your OS, or create a new one if a main discussion
doesn't yet exist for your OS.)*
To get started, simply try to execute the following in your terminal/shell:
```bash
git clone https://github.com/vlang/v
cd v
make
# HINT: Using Windows?: run make.bat in the cmd.exe shell
```
That's it! Now you have a V executable at `[path to V repo]/v`.
That should be it and you should find your V executable at `[path to V repo]/v`.
`[path to V repo]` can be anywhere.
(On Windows `make` means running `make.bat`, so make sure you use `cmd.exe`)
(As in the hint above, on Windows `make` means running `make.bat`, so make sure you use
the `cmd.exe` terminal.)
Now you can try `./v run examples/hello_world.v` (`v.exe` on Windows).
* *Trouble? Please see the note above and link to
[Installation Issues](https://github.com/vlang/v/discussions/categories/installation-issues) for help.*
V is constantly being updated. To update V, simply run:
```bash
@@ -111,7 +125,7 @@ sudo ./v symlink
```
On Windows, start a new shell with administrative privileges, for
example by <kbd>Windows Key</kbd>, then type `cmd.exe`, right click on its menu
example by <kbd>Windows Key</kbd>, then type `cmd.exe`, right-click on its menu
entry, and choose `Run as administrator`. In the new administrative
shell, cd to the path, where you have compiled v.exe, then type:
@@ -124,7 +138,7 @@ Please restart your shell/editor after that, so that it can pick
the new PATH variable.
NB: there is no need to run `v symlink` more than once - v will
continue to be available, even after `v up`, restarts and so on.
continue to be available, even after `v up`, restarts, and so on.
You only need to run it again, if you decide to move the V repo
folder somewhere else.
@@ -150,7 +164,7 @@ docker run --rm -it vlang:latest
</details>
### Testing and running the examples
## Testing and running the examples
Make sure V can compile itself:
@@ -160,7 +174,7 @@ v self
```bash
$ v
V 0.2.x
V 0.3.x
Use Ctrl-C or `exit` to exit
>>> println('hello world')
@@ -183,7 +197,9 @@ v run tetris/tetris.v
NB: In order to build Tetris or 2048 (or anything else using `sokol` or `gg` graphics modules)
on some Linux systems, you need to install `libxi-dev` and `libxcursor-dev` .
If you plan to use the http package, you also need to install OpenSSL on non-Windows systems.
## V net.http, net.websocket, `v install`
If you plan to use the net.http module, or the net.websocket module, you also need to install
OpenSSL on non-Windows systems:
```bash
macOS:
@@ -263,6 +279,20 @@ https://github.com/vlang/gitly
<img src="https://user-images.githubusercontent.com/687996/85933714-b195fe80-b8da-11ea-9ddd-09cadc2103e4.png">
## Vinix, an OS/kernel written in V
V is great for writing low-level software like drivers and kernels.
Vinix is an OS/kernel that already runs bash, GCC, V, and nano.
https://github.com/vlang/vinix
<img src="https://github.com/vlang/vinix/blob/main/screenshot0.png?raw=true">
<img src="https://github.com/vlang/vinix/blob/main/screenshot1.png?raw=true">
## Acknowledgement
V thanks Fabrice Bellard for his original work on the [TCC - Tiny C Compiler](https://bellard.org/tcc/). Note the TCC website is old; the current TCC repository can be found [here](https://repo.or.cz/w/tinycc.git). V utilizes pre-built TCC binaries located at [https://github.com/vlang/tccbin/](https://github.com/vlang/tccbin/).
## Troubleshooting
Please see the [Troubleshooting](https://github.com/vlang/v/wiki/Troubleshooting) section on our [wiki page](https://github.com/vlang/v/wiki)

View File

@@ -1,32 +1,17 @@
## [Version 0.3](https://github.com/vlang/v/projects/5)
- [ ] [make `-autofree` the default](https://github.com/vlang/v/issues/6989)
- [x] [gc option]
- [ ] [coroutines](https://github.com/vlang/v/issues/561)
- [x] channels
- [x] lock{}
- [x] thread safe arrays
- [ ] [thread safe maps](https://github.com/vlang/v/issues/6992)
- [ ] [C2V translator](https://github.com/vlang/v/issues/6985)
- [ ] doom.v
- [x] rune type
- [x] replace `ustring` with `[]rune`
- [x] fix `byte.str()`
- [x] maps with non-string keys
- [x] iOS/Android support
- [ ] parallel parser
- [ ] parallel checker
- [ ] parallel cgen
## [Version 0.4]
- [ ] [Coroutines](https://github.com/vlang/v/discussions/11582)
- [ ] [Thread safe maps](https://github.com/vlang/v/discussions/11729)
- [ ] Parallel parser
- [ ] Parallel checker
- [ ] Parallel C compilation
- [ ] `recover()` from panics
- [x] IO streams
- [x] struct embedding
- [ ] interface embedding
- [x] interfaces: allow struct fields (not just methods)
- [ ] vfmt: fix common errors automatically (make vars mutable and vice versa, add missing imports)
- [ ] method expressions with an explicit receiver as the first argument
- [x] short generics syntax (`foo(5)` instead of `foo<int>(5)`)
- [ ] fix all remaining generics issues
- [ ] merge v.c and v_win.c
- [x] more advanced errors, not just `error('message')`
- [ ] VLS for autocomplete, refactoring, go to definition etc
- [ ] vfmt: add missing imports (like goimports)
- [ ] Recursive structs via optionals: `struct Node { next ?Node }`
- [ ] Remove `foo = 0` for `&Foo`
- [ ] Optional function struct fields
- [ ] Handle function pointers safely, remove `if function == 0 {`
- [x] Bundle OpenSSL like GC
- [x] Anonymous structs
- [ ] -usecache on by default
- [ ] -skip-unused on by default
- [ ] `any` type
- [ ] `copy()` builtin function (e.g. for easier conversion from `[]Foo` to `[4]Foo`)

245
TESTS.md
View File

@@ -1,93 +1,12 @@
# Automated tests
TLDR: run `v test-all` locally, after making your changes,
TLDR: do run `v test-all` locally, after making your changes,
and before submitting PRs.
## Notes
In the `v` repo there are several different tests. The main types are:
* `_test.v` tests - check that `test_` functions succeed. These can be
run per directory or individually.
* `.out` tests - run a `.vv` file and check the output matches the
contents of the `.out` file with the same base name. This is
particularly useful for checking that errors are printed.
Tip: use `v -cc tcc` when compiling tests for speed.
## `vlib/v/tests`
General runnable tests for different features of the V compiler.
* `vlib/v/tests/inout/compiler_test.v`
Test output of running a V program matches an expected .out file.
Check the source for how to test panics.
* `vlib/v/tests/run_project_folders_test.v`
Tests whether whole project folders can be compiled, and run.
NB: Each project in these folders, should finish with exit code 0,
and it should output `OK` as its last stdout line.
## Test building of actual V programs (examples, tools, V itself)
* `v build-tools`
* `v build-examples`
* `v build-vbinaries`
## vfmt tests
In `vlib/v/fmt/` there are::
* `v vlib/v/fmt/fmt_test.v`
This checks `.out` tests.
* `v vlib/v/fmt/fmt_keep_test.v`
This verifies that `_keep.v` files would be unchanged by `vfmt -w`.
* `v vlib/v/fmt/fmt_vlib_test.v`
This checks all source files are formatted and prints a summary.
This is not required.
* `v test-fmt`
Test all files in the current directory are formatted.
## Markdown
* `v check-md -hide-warnings .`
Ensure that all .md files in the project are formatted properly,
and that the V code block examples in them can be compiled/formatted too.
## `.github/workflows/ci.yml`
This runs various CI tests, e.g.:
* `v vet vlib/v` - style checker
* `v fmt -verify` on certain source files
## `v test-cleancode`
Check that most .v files, are invariant of `v fmt` runs.
## `v test-self`
Run `vlib` module tests, *including* the compiler tests.
## `v vlib/v/compiler_errors_test.v`
This runs tests for:
* `vlib/v/checker/tests/*.vv`
* `vlib/v/parser/tests/*.vv`
### Special folders that compiler_errors_test.v will try to
run/compile with specific options:
vlib/v/checker/tests/globals_run/ - `-enable-globals run`;
results stored in `.run.out` files, matching the .vv ones.
Tip: use `v -cc tcc` when compiling tests, because TCC is much faster,
compared to most other C compilers like clang/gcc/msvc. Most test commands
will use the V compiler and the V tools many times, potentially
hundreds/thousands of times.
## `v test-all`
@@ -102,3 +21,157 @@ It works, by running these in succession:
* `v build-examples`
* `v check-md -hide-warnings .`
* `v install nedpals.args`
# Details:
In the `v` repo there are many tests. The main types are:
## `_test.v` tests - these are the normal V test files.
All `test_` functions in these files, will be ran automatically by
V's test framework.
NB 1: You can run test files one by one, with:
`v file_test.v` - this will run the test_ functions in file_test.v,
and will exit with a 0 exit code, if they all had 0 failing assertions.
`v -stats file_test.v` - this will run the test_ functions, and show a
report about how much time it took to run each of them too.
NB 2: You can also run many test files at once (in parallel, depending on
how many cores you have), with:
`v test folder` - this will run *all* `_test.v` files in `folder`,
recursively.
`v -stats test folder` - same, but will also produce timing reports
about how fast each test_ function in each _test.v file ran.
## `v test vlib/v/tests`:
This folder contains _test.v files, testing the different features of the V
compiler. Each of them will be compiled, and all the features in them have
to work (verified by assertions).
## `v vlib/v/tests/inout/compiler_test.v`
This is a *test runner*, that checks whether the output of running a V program,
matches an expected .out file. You can also check for code that does panic
using this test runner - just paste the start of the `panic()` output in the
corresponding .out file.
NB: these tests, expect to find a pair of `.vv` and `.out` files, in the folder:
vlib/v/tests/inout
The test runner will run each `.vv` file, and will check that its output, matches
the contents of the `.out` file with the same base name. This is particularly useful
for checking that errors and panics are printed.
## `v vlib/v/gen/c/coutput_test.v`
coutput_test.v is a *test runner*, that checks whether the generated C source
code matches *all* expectations, specified in *.c.must_have files, in the
folder vlib/v/gen/c/testdata/ .
Each `.c.must_have` file, *has* to have a corresponding `.vv` file.
Each `.c.must_have` file, consists of multiple lines. Each of these
lines, *should* be present *at least once* in the output, when the .vv
file is compiled with `-o -` .
## `v vlib/v/tests/run_project_folders_test.v`
This *test runner*, checks whether whole project folders, can be compiled, and run.
NB: Each project in these folders, should finish with an exit code of 0,
and it should output `OK` as its last stdout line.
## `v vlib/v/tests/known_errors/known_errors_test.v`
This *test runner*, checks whether a known program, that was expected to compile,
but did NOT, due to a buggy checker, parser or cgen, continues to fail.
The negative programs are collected in the `vlib/v/tests/known_errors/testdata/` folder.
Each of them should FAIL to compile, due to a known/confirmed compiler bug/limitation.
The intended use of this, is for providing samples, that currently do NOT compile,
but that a future compiler improvement WILL be able to compile, and to
track, whether they were not fixed incidentally, due to an unrelated
change/improvement. For example, code that triggers generating invalid C code can go here,
and later when a bug is fixed, can be moved to a proper _test.v or .vv/.out pair, outside of
the `vlib/v/tests/known_errors/testdata/` folder.
## Test building of actual V programs (examples, tools, V itself)
* `v build-tools`
* `v build-examples`
* `v build-vbinaries`
## Formatting tests
In `vlib/v/fmt/` there are:
* `v vlib/v/fmt/fmt_test.v`
This checks `.out` tests.
* `v vlib/v/fmt/fmt_keep_test.v`
This verifies that all `_keep.vv` files in the `vlib/v/fmt/tests/` folder,
would be unchanged by `v fmt -w`, i.e. that the v source code formatter,
generates a stable source output, that does not change, once it is already
formatted once.
* `v vlib/v/fmt/fmt_vlib_test.v`
This checks that all V source files are formatted, and prints a summary.
This is not required.
* `v test-cleancode`
Check that most .v files, are invariant of `v fmt` runs.
* `v test-fmt`
This tests that all .v files in the current folder are already formatted.
It is useful for adding to CI jobs, to guarantee, that future contributions
will keep the existing source nice and clean.
## Markdown/documentation checks:
* `v check-md -hide-warnings .`
Ensure that all .md files in the project are formatted properly,
and that the V code block examples in them can be compiled/formatted too.
## `v test-self`
Run `vlib` module tests, *including* the compiler tests.
## `v vlib/v/compiler_errors_test.v`
This runs tests for:
* `vlib/v/scanner/tests/*.vv`
* `vlib/v/checker/tests/*.vv`
* `vlib/v/parser/tests/*.vv`
NB: there are special folders, that compiler_errors_test.v will try to
run/compile with specific options:
vlib/v/checker/tests/globals_run/ - `-enable-globals run`;
results stored in `.run.out` files, matching the .vv ones.
NB 2: in case you need to modify many .out files, run *twice* in a row:
`VAUTOFIX=1 ./v vlib/v/compiler_errors_test.v`
This will fail the first time, but it will record the new output for each
.vv file, and store it into the corresponding .out file. The second run
should be now successfull, and so you can inspect the difference, and
commit the new .out files with minimum manual effort.
NB 3: To run only some of the tests, use:
`VTEST_ONLY=mismatch ./v vlib/v/compiler_errors_test.v`
This will check only the .vv files, whose paths match the given filter.
## `.github/workflows/ci.yml`
This is a Github Actions configuration file, that runs various CI
tests in the main V repository, for example:
* `v vet vlib/v` - run a style checker.
* `v test-self` (run self tests) in various compilation modes.

View File

@@ -14,13 +14,13 @@ fn main() {
mut checksum := u64(0)
mut start_pos := 0
mut bgenerating := benchmark.start()
mut bytepile := []byte{}
mut bytepile := []u8{}
for _ in 0 .. sample_size * max_str_len {
bytepile << byte(rand.int_in_range(40, 125))
bytepile << u8(rand.int_in_range(40, 125) or { 40 })
}
mut str_lens := []int{}
for _ in 0 .. sample_size {
str_lens << rand.int_in_range(min_str_len, max_str_len)
str_lens << rand.int_in_range(min_str_len, max_str_len) or { min_str_len }
}
bgenerating.measure('generating strings')
println('Hashing each of the generated strings...')
@@ -30,7 +30,7 @@ fn main() {
checksum = 0
for len in str_lens {
end_pos := start_pos + len
checksum ^= wyhash.wyhash_c(unsafe { &byte(bytepile.data) + start_pos }, u64(len),
checksum ^= wyhash.wyhash_c(unsafe { &u8(bytepile.data) + start_pos }, u64(len),
1)
start_pos = end_pos
}

View File

@@ -0,0 +1,11 @@
module main
import v.builder.cbuilder
// TODO: change bootstrapping to use the C code generated from
// `VEXE=v cmd/tools/builders/c_builder -os cross -o c.c cmd/tools/builders/c_builder.v`
// See also `cmd/v/v.v`
fn main() {
cbuilder.start()
}

View File

@@ -0,0 +1,7 @@
module main
import v.builder.golangbuilder
fn main() {
golangbuilder.start()
}

View File

@@ -0,0 +1,7 @@
module main
import v.builder.interpreterbuilder
fn main() {
interpreterbuilder.start()
}

View File

@@ -0,0 +1,7 @@
module main
import v.builder.jsbuilder
fn main() {
jsbuilder.start()
}

View File

@@ -0,0 +1,7 @@
module main
import v.builder.nativebuilder
fn main() {
nativebuilder.start()
}

View File

@@ -5,6 +5,7 @@ import v.util
import v.util.diff
import v.pref
import v.builder
import v.builder.cbuilder
import v.ast
import rand
import term
@@ -42,7 +43,7 @@ fn main() {
vexe := pref.vexe_path()
vroot := os.dir(vexe)
util.set_vroot_folder(vroot)
os.chdir(vroot)
os.chdir(vroot)!
cmd := diff.find_working_diff_command() or { '' }
mut app := App{
diff_cmd: cmd
@@ -98,7 +99,7 @@ fn (app App) gen_api_for_module_in_os(mod_name string, os_name string) string {
tmpname := '/tmp/${mod_name}_${os_name}.c'
prefs, _ := pref.parse_args([], ['-os', os_name, '-o', tmpname, '-shared', mpath])
mut b := builder.new_builder(prefs)
b.compile_c()
cbuilder.compile_c(mut b)
mut res := []string{}
for f in b.parsed_files {
for s in f.stmts {

17
cmd/tools/detect_tcc.v Normal file
View File

@@ -0,0 +1,17 @@
fn main() {
$if tinyc {
println('Your `tcc` is working. Good - it is much faster at compiling C source code.')
exit(0)
}
$if !macos {
println('
Note: `tcc` was not used, so unless you install it yourself, your backend
C compiler will be `cc`, which is usually either `clang`, `gcc` or `msvc`.
These C compilers, are several times slower at compiling C source code,
compared to `tcc`. They do produce more optimised executables, but that
is done at the cost of compilation speed.
')
}
}

View File

@@ -1,10 +1,9 @@
// Copyright (c) 2019-2021 Alexander Medvednikov. All rights reserved.
// Copyright (c) 2019-2022 Alexander Medvednikov. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
import os
import time
// TODO -usecache
const voptions = ' -skip-unused -show-timings -stats '
const exe = os.executable()
@@ -16,66 +15,80 @@ const vdir = @VEXEROOT
fn main() {
dump(fast_dir)
dump(vdir)
os.chdir(fast_dir)
os.chdir(fast_dir)!
if !os.exists('$vdir/v') && !os.is_dir('$vdir/vlib') {
println('fast.html generator needs to be located in `v/cmd/tools/fast`')
}
println('fast.html generator\n')
println('Fetching updates...')
ret := os.system('$vdir/v up')
if ret != 0 {
println('failed to update V')
return
if !os.args.contains('-noupdate') {
println('Fetching updates...')
ret := os.system('$vdir/v up')
if ret != 0 {
println('failed to update V')
return
}
}
// Fetch the last commit's hash
// fetch the last commit's hash
commit := exec('git rev-parse HEAD')[..8]
if !os.exists('table.html') {
os.create('table.html') ?
os.create('table.html')!
}
mut table := os.read_file('table.html') ?
if table.contains('>$commit<') {
println('nothing to benchmark')
exit(1)
return
mut table := os.read_file('table.html')!
if os.exists('website/index.html') {
uploaded_index := os.read_file('website/index.html')!
if uploaded_index.contains('>$commit<') {
println('nothing to benchmark')
exit(1)
return
}
}
// for i, commit in commits {
message := exec('git log --pretty=format:"%s" -n1 $commit')
// println('\n${i + 1}/$commits.len Benchmarking commit $commit "$message"')
println('\nBenchmarking commit $commit "$message"')
// Build an optimized V
// println('Checking out ${commit}...')
// exec('git checkout $commit')
// build an optimized V
println(' Building vprod...')
os.chdir(vdir)
exec('./v -o vprod -prod -prealloc cmd/v')
// println('cur vdir="$vdir"')
// exec('v -o vprod cmd/v') // for faster debugging
os.chdir(vdir)!
if os.args.contains('-noprod') {
exec('./v -o vprod cmd/v') // for faster debugging
} else {
exec('./v -o vprod -prod -prealloc cmd/v')
}
// cache vlib modules
exec('$vdir/v wipe-cache')
exec('$vdir/v -o v2 -prod cmd/v')
// measure
diff1 := measure('$vdir/vprod $voptions -o v.c cmd/v', 'v.c')
mut tcc_path := 'tcc'
$if freebsd {
tcc_path = '/usr/local/bin/tcc'
if vdir.contains('/tmp/cirrus-ci-build') {
tcc_path = 'clang'
}
}
if os.args.contains('-clang') {
tcc_path = 'clang'
}
diff2 := measure('$vdir/vprod $voptions -cc $tcc_path -o v2 cmd/v', 'v2')
diff3 := 0 // measure('$vdir/vprod -native $vdir/cmd/tools/1mil.v', 'native 1mil')
diff4 := measure('$vdir/vprod -usecache $voptions -cc clang examples/hello_world.v',
'hello.v')
vc_size := os.file_size('v.c') / 1000
// scan/parse/check/cgen
scan, parse, check, cgen, vlines := measure_steps(vdir)
// println('Building V took ${diff}ms')
commit_date := exec('git log -n1 --pretty="format:%at" $commit')
date := time.unix(commit_date.int())
//
os.chdir(fast_dir)
mut out := os.create('table.html') ?
// Place the new row on top
os.chdir(fast_dir)!
mut out := os.create('table.html')!
// place the new row on top
html_message := message.replace_each(['<', '&lt;', '>', '&gt;'])
table =
'<tr>
' <tr>
<td>$date.format()</td>
<td><a target=_blank href="https://github.com/vlang/v/commit/$commit">$commit</a></td>
<td>$html_message</td>
@@ -92,19 +105,28 @@ fn main() {
<td>${int(f64(vlines) / f64(diff1) * 1000.0)}</td>
</tr>\n' +
table.trim_space()
out.writeln(table) ?
out.writeln(table)!
out.close()
// Regenerate index.html
header := os.read_file('header.html') ?
footer := os.read_file('footer.html') ?
mut res := os.create('index.html') ?
res.writeln(header) ?
res.writeln(table) ?
res.writeln(footer) ?
// regenerate index.html
header := os.read_file('header.html')!
footer := os.read_file('footer.html')!
mut res := os.create('index.html')!
res.writeln(header)!
res.writeln(table)!
res.writeln(footer)!
res.close()
//}
// exec('git checkout master')
// os.write_file('last_commit.txt', commits[commits.len - 1]) ?
// upload the result to github pages
if os.args.contains('-upload') {
println('uploading...')
os.chdir('website')!
os.execute_or_exit('git checkout gh-pages')
os.cp('../index.html', 'index.html')!
os.rm('../index.html')!
os.system('git commit -am "update benchmark"')
os.system('git push origin gh-pages')
}
}
fn exec(s string) string {
@@ -112,7 +134,7 @@ fn exec(s string) string {
return e.output.trim_right('\r\n')
}
// returns milliseconds
// measure returns milliseconds
fn measure(cmd string, description string) int {
println(' Measuring $description')
println(' Warming up...')
@@ -164,7 +186,7 @@ fn measure_steps(vdir string) (int, int, int, int, int) {
cgen = line[0].int()
}
} else {
// Fetch number of V lines
// fetch number of V lines
if line[0].contains('V') && line[0].contains('source') && line[0].contains('size') {
start := line[0].index(':') or { 0 }
end := line[0].index('lines,') or { 0 }

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2019-2021 Alexander Medvednikov. All rights reserved.
// Copyright (c) 2019-2022 Alexander Medvednikov. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
import os
@@ -23,20 +23,14 @@ fn main() {
return
}
// println('running ./fast')
resp := os.execute('./fast')
resp := os.execute('./fast -upload')
if resp.exit_code < 0 {
println(resp.output)
return
}
if resp.exit_code != 0 {
println('resp != 0, skipping')
} else {
os.chdir('website')
os.execute_or_exit('git checkout gh-pages')
os.cp('../index.html', 'index.html') ?
os.system('git commit -am "update benchmark"')
os.system('git push origin gh-pages')
os.chdir('..')
println(resp.output)
}
time.sleep(180 * time.second)
}

View File

@@ -10,9 +10,9 @@ fn generate_strings(str_len int, arr_len int) []string {
}
fn fuzz1() {
amount := 200000 - rand.intn(100000)
amount2 := 200000 - rand.intn(100000)
len := 25 - rand.intn(10)
amount := 200000 - rand.intn(100000) or { 0 }
amount2 := 200000 - rand.intn(100000) or { 0 }
len := 25 - rand.intn(10) or { 0 }
arr := generate_strings(len, amount)
arr2 := generate_strings(len, amount2)
mut m := map[string]int{}
@@ -34,8 +34,8 @@ fn fuzz1() {
fn fuzz2() {
mut m := map[string]int{}
amount := rand.intn(500000) + 1
len := 25 - rand.intn(10)
amount := rand.intn(500000) or { 0 } + 1
len := 25 - rand.intn(10) or { 0 }
arr := generate_strings(len, amount)
for i, x in arr {
m[x] = i
@@ -54,8 +54,8 @@ fn fuzz2() {
fn fuzz3() {
mut m := map[string]int{}
amount := rand.intn(500000) + 1
len := 25 - rand.intn(10)
amount := rand.intn(500000) or { 0 } + 1
len := 25 - rand.intn(10) or { 0 }
arr := generate_strings(len, amount)
for i, x in arr {
if (i % 10000) == 0 {
@@ -74,8 +74,8 @@ fn fuzz3() {
}
fn fuzz4() {
amount := rand.intn(500000)
len := 25 - rand.intn(10)
amount := rand.intn(500000) or { 0 }
len := 25 - rand.intn(10) or { 0 }
arr := generate_strings(len, amount)
mut m := map[string]int{}
for i in 0 .. amount {
@@ -93,7 +93,7 @@ fn fuzz4() {
}
fn fuzz5() {
amount := rand.intn(500000) + 1
amount := rand.intn(500000) or { 0 } + 1
arr := generate_strings(20, amount)
mut m := map[string]int{}
for i in 0 .. amount {
@@ -114,8 +114,8 @@ fn fuzz5() {
fn fuzz6() {
mut m := map[string]int{}
amount := rand.intn(500000) + 1
len := 25 - rand.intn(10)
amount := rand.intn(500000) or { 0 } + 1
len := 25 - rand.intn(10) or { 0 }
arr := generate_strings(len, amount)
for i, x in arr {
m[x]++

View File

@@ -3,7 +3,7 @@ fn main() {
println('
fn foo${i}() {
x := $i
mut a := 1
mut a := 1 + x
a += 2
print(a)
a = 0

View File

@@ -82,7 +82,7 @@ struct GenVC {
// flag options
options FlagOptions
mut:
logger &log.Log
logger &log.Log = unsafe { nil }
// true if error was experienced running generate
gen_error bool
}
@@ -91,7 +91,7 @@ mut:
struct WebhookServer {
vweb.Context
mut:
gen_vc &GenVC = 0 // initialized in init_server
gen_vc &GenVC = unsafe { nil } // initialized in init_server
}
// storage for flag options
@@ -169,10 +169,10 @@ pub fn (mut ws WebhookServer) genhook() {
ws.gen_vc.generate()
// error in generate
if ws.gen_vc.gen_error {
ws.json('{status: "failed"}')
ws.json('{ status: "failed" }')
return
}
ws.json('{status: "ok"}')
ws.json('{ status: "ok" }')
}
pub fn (ws &WebhookServer) reset() {
@@ -215,7 +215,7 @@ fn (mut gen_vc GenVC) generate() {
}
}
// cd to gen_vc dir
os.chdir(gen_vc.options.work_dir)
os.chdir(gen_vc.options.work_dir) or {}
// if we are not running with the --serve flag (webhook server)
// rather than deleting and re-downloading the repo each time
// first check to see if the local v repo is behind master

View File

@@ -0,0 +1,67 @@
import os
import time
import v.ast
import v.pref
import v.parser
import v.errors
import v.scanner
fn main() {
files := os.args#[1..]
if files.len > 0 && files[0].starts_with('@') {
lst_path := files[0].all_after('@')
listed_files := os.read_file(lst_path)!.split('\n')
process_files(listed_files)!
return
}
process_files(files)!
}
fn process_files(files []string) ! {
mut table := ast.new_table()
mut pref := pref.new_preferences()
pref.is_fmt = true
pref.skip_warnings = true
pref.output_mode = .silent
mut sw := time.new_stopwatch()
mut total_us := i64(0)
mut total_bytes := i64(0)
mut total_tokens := i64(0)
for f in files {
if f == '' {
continue
}
if f.ends_with('_test.v') {
continue
}
// do not measure the scanning, but only the parsing:
mut p := new_parser(f, .skip_comments, table, pref)
///
sw.restart()
_ := p.parse()
f_us := sw.elapsed().microseconds()
///
total_us += f_us
total_bytes += p.scanner.text.len
total_tokens += p.scanner.all_tokens.len
println('${f_us:10}us ${p.scanner.all_tokens.len:10} ${p.scanner.text.len:10} ${(f64(p.scanner.text.len) / p.scanner.all_tokens.len):7.3} ${p.errors.len:4} $f')
}
println('${total_us:10}us ${total_tokens:10} ${total_bytes:10} ${(f64(total_tokens) / total_bytes):7.3} | speed: ${(f64(total_bytes) / total_us):2.5f} MB/s')
}
fn new_parser(path string, comments_mode scanner.CommentsMode, table &ast.Table, pref &pref.Preferences) &parser.Parser {
mut p := &parser.Parser{
scanner: scanner.new_scanner_file(path, comments_mode, pref) or { panic(err) }
comments_mode: comments_mode
table: table
pref: pref
scope: &ast.Scope{
start_pos: 0
parent: table.global_scope
}
errors: []errors.Error{}
warnings: []errors.Warning{}
}
p.set_path(path)
return p
}

View File

@@ -0,0 +1,42 @@
import os
import time
import v.scanner
import v.pref
fn main() {
files := os.args#[1..]
if files.len > 0 && files[0].starts_with('@') {
lst_path := files[0].all_after('@')
listed_files := os.read_file(lst_path)!.split('\n')
process_files(listed_files)!
return
}
process_files(files)!
}
fn process_files(files []string) ! {
mut pref := pref.new_preferences()
pref.is_fmt = true
pref.skip_warnings = true
pref.output_mode = .silent
mut sw := time.new_stopwatch()
mut total_us := i64(0)
mut total_bytes := i64(0)
mut total_tokens := i64(0)
for f in files {
if f == '' {
continue
}
if f.ends_with('_test.v') {
continue
}
sw.restart()
s := scanner.new_scanner_file(f, .skip_comments, pref)!
f_us := sw.elapsed().microseconds()
total_us += f_us
total_bytes += s.text.len
total_tokens += s.all_tokens.len
println('${f_us:10}us ${s.all_tokens.len:10} ${s.text.len:10} ${(f64(s.text.len) / s.all_tokens.len):7.3f} $f')
}
println('${total_us:10}us ${total_tokens:10} ${total_bytes:10} ${(f64(total_tokens) / total_bytes):7.3f} | speed: ${(f64(total_bytes) / total_us):2.5f} MB/s')
}

View File

@@ -1,141 +0,0 @@
// Copyright (c) 2020 Lars Pontoppidan. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
import os
import flag
const (
tool_name = os.file_name(os.executable())
tool_version = '0.0.2'
tool_description = 'Prints all V functions in .v files under PATH/, that do not yet have documentation comments.'
)
struct UndocumentedFN {
line int
signature string
tags []string
}
struct Options {
show_help bool
collect_tags bool
deprecated bool
}
fn collect(path string, mut l []string, f fn (string, mut []string)) {
if !os.is_dir(path) {
return
}
mut files := os.ls(path) or { return }
for file in files {
p := path + os.path_separator + file
if os.is_dir(p) && !os.is_link(p) {
collect(p, mut l, f)
} else if os.exists(p) {
f(p, mut l)
}
}
return
}
fn report_undocumented_functions_in_path(opt Options, path string) {
mut files := []string{}
collect_fn := fn (path string, mut l []string) {
if os.file_ext(path) == '.v' {
l << os.real_path(path)
}
}
collect(path, mut files, collect_fn)
for file in files {
if file.ends_with('_test.v') {
continue
}
report_undocumented_functions_in_file(opt, file)
}
}
fn report_undocumented_functions_in_file(opt Options, file string) {
contents := os.read_file(file) or { panic(err) }
lines := contents.split('\n')
mut info := []UndocumentedFN{}
for i, line in lines {
if line.starts_with('pub fn') || (line.starts_with('fn ') && !(line.starts_with('fn C.')
|| line.starts_with('fn main'))) {
// println('Match: $line')
if i > 0 && lines.len > 0 {
mut line_above := lines[i - 1]
if !line_above.starts_with('//') {
mut tags := []string{}
mut grab := true
for j := i - 1; j >= 0; j-- {
prev_line := lines[j]
if prev_line.contains('}') { // We've looked back to the above scope, stop here
break
} else if prev_line.starts_with('[') {
tags << collect_tags(prev_line)
continue
} else if prev_line.starts_with('//') { // Single-line comment
grab = false
break
}
}
if grab {
clean_line := line.all_before_last(' {')
info << UndocumentedFN{i + 1, clean_line, tags}
}
}
}
}
}
if info.len > 0 {
for undocumented_fn in info {
tags_str := if opt.collect_tags && undocumented_fn.tags.len > 0 {
'$undocumented_fn.tags'
} else {
''
}
if opt.deprecated {
println('$file:$undocumented_fn.line:0:$undocumented_fn.signature $tags_str')
} else {
if 'deprecated' !in undocumented_fn.tags {
println('$file:$undocumented_fn.line:0:$undocumented_fn.signature $tags_str')
}
}
}
}
}
fn collect_tags(line string) []string {
mut cleaned := line.all_before('/')
cleaned = cleaned.replace_each(['[', '', ']', '', ' ', ''])
return cleaned.split(',')
}
fn main() {
if os.args.len == 1 {
println('Usage: $tool_name PATH \n$tool_description\n$tool_name -h for more help...')
exit(1)
}
mut fp := flag.new_flag_parser(os.args[1..])
fp.application(tool_name)
fp.version(tool_version)
fp.description(tool_description)
fp.arguments_description('PATH [PATH]...')
// Collect tool options
opt := Options{
show_help: fp.bool('help', `h`, false, 'Show this help text.')
deprecated: fp.bool('deprecated', `d`, false, 'Include deprecated functions in output.')
collect_tags: fp.bool('tags', `t`, false, 'Also print function tags if any is found.')
}
if opt.show_help {
println(fp.usage())
exit(0)
}
for path in os.args[1..] {
if os.is_file(path) {
report_undocumented_functions_in_file(opt, path)
} else {
report_undocumented_functions_in_path(opt, path)
}
}
}

View File

@@ -24,6 +24,7 @@ pub fn cprint(omessage string) {
message = term.cyan(message)
}
print(message)
flush_stdout()
}
pub fn cprint_strong(omessage string) {
@@ -32,16 +33,19 @@ pub fn cprint_strong(omessage string) {
message = term.bright_green(message)
}
print(message)
flush_stdout()
}
pub fn cprintln(omessage string) {
cprint(omessage)
println('')
flush_stdout()
}
pub fn cprintln_strong(omessage string) {
cprint_strong(omessage)
println('')
flush_stdout()
}
pub fn verbose_trace(label string, message string) {
@@ -85,7 +89,10 @@ fn modfn(mname string, fname string) string {
pub fn chdir(path string) {
verbose_trace_strong(modfn(@MOD, @FN), 'cd $path')
os.chdir(path)
os.chdir(path) or {
verbose_trace(modfn(@MOD, @FN), '## failed.')
return
}
}
pub fn mkdir(path string) ? {

View File

@@ -4,17 +4,40 @@ import os
import time
import term
import benchmark
import sync
import sync.pool
import v.pref
import v.util.vtest
import runtime
const github_job = os.getenv('GITHUB_JOB')
pub const github_job = os.getenv('GITHUB_JOB')
const show_start = os.getenv('VTEST_SHOW_START') == '1'
pub const show_start = os.getenv('VTEST_SHOW_START') == '1'
const hide_skips = os.getenv('VTEST_HIDE_SKIP') == '1'
pub const hide_skips = os.getenv('VTEST_HIDE_SKIP') == '1'
const hide_oks = os.getenv('VTEST_HIDE_OK') == '1'
pub const hide_oks = os.getenv('VTEST_HIDE_OK') == '1'
pub const fail_fast = os.getenv('VTEST_FAIL_FAST') == '1'
pub const fail_flaky = os.getenv('VTEST_FAIL_FLAKY') == '1'
pub const test_only = os.getenv('VTEST_ONLY').split_any(',')
pub const test_only_fn = os.getenv('VTEST_ONLY_FN').split_any(',')
pub const is_node_present = os.execute('node --version').exit_code == 0
pub const all_processes = get_all_processes()
fn get_all_processes() []string {
$if windows {
// TODO
return []
} $else {
return os.execute('ps ax').output.split_any('\r\n')
}
}
pub struct TestSession {
pub mut:
@@ -24,7 +47,7 @@ pub mut:
vroot string
vtmp_dir string
vargs string
failed bool
fail_fast bool
benchmark benchmark.Benchmark
rm_binaries bool = true
silent_mode bool
@@ -110,6 +133,7 @@ pub fn (mut ts TestSession) print_messages() {
// progress mode, the last line is rewritten many times:
if is_ok && !ts.silent_mode {
print('\r$empty\r$msg')
flush_stdout()
} else {
// the last \n is needed, so SKIP/FAIL messages
// will not get overwritten by the OK ones
@@ -127,7 +151,16 @@ pub fn (mut ts TestSession) print_messages() {
pub fn new_test_session(_vargs string, will_compile bool) TestSession {
mut skip_files := []string{}
// Skip the call_v_from_c files. They need special instructions for compilation.
// Check the README.md for detailed information.
skip_files << 'examples/call_v_from_c/v_test_print.v'
skip_files << 'examples/call_v_from_c/v_test_math.v'
if will_compile {
$if msvc {
skip_files << 'vlib/v/tests/const_comptime_eval_before_vinit_test.v' // _constructor used
}
$if solaris {
skip_files << 'examples/gg/gg2.v'
skip_files << 'examples/pico/pico.v'
@@ -142,16 +175,38 @@ pub fn new_test_session(_vargs string, will_compile bool) TestSession {
$if windows {
skip_files << 'examples/database/mysql.v'
skip_files << 'examples/database/orm.v'
skip_files << 'examples/smtp/mail.v' // requires OpenSSL
skip_files << 'examples/websocket/ping.v' // requires OpenSSL
skip_files << 'examples/websocket/client-server/client.v' // requires OpenSSL
skip_files << 'examples/websocket/client-server/server.v' // requires OpenSSL
skip_files << 'vlib/v/tests/websocket_logger_interface_should_compile_test.v' // requires OpenSSL
$if tinyc {
skip_files << 'examples/database/orm.v' // try fix it
}
}
$if windows {
// TODO: remove when closures on windows are supported...
skip_files << 'examples/pendulum-simulation/animation.v'
skip_files << 'examples/pendulum-simulation/full.v'
skip_files << 'examples/pendulum-simulation/parallel.v'
skip_files << 'examples/pendulum-simulation/parallel_with_iw.v'
skip_files << 'examples/pendulum-simulation/sequential.v'
}
if testing.github_job == 'ubuntu-docker-musl' {
skip_files << 'vlib/net/openssl/openssl_compiles_test.v'
}
if testing.github_job == 'tests-sanitize-memory-clang' {
skip_files << 'vlib/net/openssl/openssl_compiles_test.v'
}
if testing.github_job == 'windows-tcc' {
// TODO: fix these by adding declarations for the missing functions in the prebuilt tcc
skip_files << 'vlib/net/mbedtls/mbedtls_compiles_test.v'
skip_files << 'vlib/net/ssl/ssl_compiles_test.v'
}
if testing.github_job != 'sokol-shaders-can-be-compiled' {
// These examples need .h files that are produced from the supplied .glsl files,
// using by the shader compiler tools in https://github.com/floooh/sokol-tools-bin/archive/pre-feb2021-api-changes.tar.gz
skip_files << 'examples/sokol/simple_shader_glsl/simple_shader.v'
skip_files << 'examples/sokol/02_cubes_glsl/cube_glsl.v'
skip_files << 'examples/sokol/03_march_tracing_glsl/rt_glsl.v'
skip_files << 'examples/sokol/04_multi_shader_glsl/rt_glsl.v'
@@ -161,6 +216,7 @@ pub fn new_test_session(_vargs string, will_compile bool) TestSession {
}
if testing.github_job != 'ubuntu-tcc' {
skip_files << 'examples/c_interop_wkhtmltopdf.v' // needs installation of wkhtmltopdf from https://github.com/wkhtmltopdf/packaging/releases
skip_files << 'examples/call_v_from_python/test.v' // the example only makes sense to be compiled, when python is installed
// the ttf_test.v is not interactive, but needs X11 headers to be installed, which is done only on ubuntu-tcc for now
skip_files << 'vlib/x/ttf/ttf_test.v'
skip_files << 'vlib/vweb/vweb_app_test.v' // imports the `sqlite` module, which in turn includes sqlite3.h
@@ -170,6 +226,9 @@ pub fn new_test_session(_vargs string, will_compile bool) TestSession {
skip_files << 'examples/sokol/sounds/wav_player.v'
skip_files << 'examples/sokol/sounds/simple_sin_tones.v'
}
$if !macos {
skip_files << 'examples/macos_tray/tray.v'
}
}
vargs := _vargs.replace('-progress', '').replace('-progress', '')
vexe := pref.vexe_path()
@@ -182,6 +241,7 @@ pub fn new_test_session(_vargs string, will_compile bool) TestSession {
vexe: vexe
vroot: vroot
skip_files: skip_files
fail_fast: testing.fail_fast
vargs: vargs
vtmp_dir: new_vtmp_dir
silent_mode: _vargs.contains('-silent')
@@ -209,8 +269,7 @@ pub fn (mut ts TestSession) test() {
ts.init()
mut remaining_files := []string{}
for dot_relative_file in ts.files {
relative_file := dot_relative_file.replace('./', '')
file := os.real_path(relative_file)
file := os.real_path(dot_relative_file)
$if windows {
if file.contains('sqlite') || file.contains('httpbin') {
continue
@@ -231,6 +290,11 @@ pub fn (mut ts TestSession) test() {
remaining_files = vtest.filter_vtest_only(remaining_files, fix_slashes: false)
ts.files = remaining_files
ts.benchmark.set_total_expected_steps(remaining_files.len)
mut njobs := runtime.nr_jobs()
if remaining_files.len < njobs {
njobs = remaining_files.len
}
ts.benchmark.njobs = njobs
mut pool_of_test_runners := pool.new_pool_processor(callback: worker_trunner)
// for handling messages across threads
ts.nmessages = chan LogMessage{cap: 10000}
@@ -243,17 +307,26 @@ pub fn (mut ts TestSession) test() {
ts.append_message(.sentinel, '') // send the sentinel
_ := <-ts.nprint_ended // wait for the stop of the printing thread
eprintln(term.h_divider('-'))
// cleanup generated .tmp.c files after successfull tests:
ts.show_list_of_failed_tests()
// cleanup generated .tmp.c files after successful tests:
if ts.benchmark.nfail == 0 {
if ts.rm_binaries {
os.rmdir_all(ts.vtmp_dir) or { panic(err) }
os.rmdir_all(ts.vtmp_dir) or {}
}
}
ts.show_list_of_failed_tests()
// remove empty session folders:
if os.ls(ts.vtmp_dir) or { [] }.len == 0 {
os.rmdir_all(ts.vtmp_dir) or {}
}
}
fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
mut ts := &TestSession(p.get_shared_context())
if ts.fail_fast {
if ts.failed_cmds.len > 0 {
return pool.no_result
}
}
tmpd := ts.vtmp_dir
show_stats := '-stats' in ts.vargs.split(' ')
// tls_bench is used to format the step messages/timings
@@ -264,8 +337,25 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
p.set_thread_context(idx, tls_bench)
}
tls_bench.no_cstep = true
dot_relative_file := p.get_item<string>(idx)
mut relative_file := dot_relative_file.replace('./', '')
tls_bench.njobs = ts.benchmark.njobs
mut relative_file := os.real_path(p.get_item<string>(idx))
mut cmd_options := [ts.vargs]
mut run_js := false
is_fmt := ts.vargs.contains('fmt')
is_vet := ts.vargs.contains('vet')
produces_file_output := !(is_fmt || is_vet)
if relative_file.ends_with('js.v') {
if produces_file_output {
cmd_options << ' -b js'
run_js = true
}
}
if relative_file.contains('global') && !is_fmt {
cmd_options << ' -enable-globals'
}
if ts.root_relative {
relative_file = relative_file.replace(ts.vroot + os.path_separator, '')
}
@@ -274,22 +364,22 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
// Ensure that the generated binaries will be stored in the temporary folder.
// Remove them after a test passes/fails.
fname := os.file_name(file)
generated_binary_fname := if os.user_os() == 'windows' {
generated_binary_fname := if os.user_os() == 'windows' && !run_js {
fname.replace('.v', '.exe')
} else if !run_js {
fname.replace('.v', '')
} else {
fname.replace('.v', '')
}
generated_binary_fpath := os.join_path(tmpd, generated_binary_fname)
if os.exists(generated_binary_fpath) {
generated_binary_fpath := os.join_path_single(tmpd, generated_binary_fname)
if produces_file_output {
if ts.rm_binaries {
os.rm(generated_binary_fpath) or { panic(err) }
os.rm(generated_binary_fpath) or {}
}
cmd_options << ' -o ${os.quoted_path(generated_binary_fpath)}'
}
mut cmd_options := [ts.vargs]
if !ts.vargs.contains('fmt') {
cmd_options << ' -o "$generated_binary_fpath"'
}
cmd := '"$ts.vexe" ' + cmd_options.join(' ') + ' "$file"'
cmd := '${os.quoted_path(ts.vexe)} ' + cmd_options.join(' ') + ' ${os.quoted_path(file)}'
ts.benchmark.step()
tls_bench.step()
if relative_file.replace('\\', '/') in ts.skip_files {
@@ -302,24 +392,42 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
}
if show_stats {
ts.append_message(.ok, term.h_divider('-'))
status := os.system(cmd)
if status == 0 {
ts.benchmark.ok()
tls_bench.ok()
} else {
ts.failed = true
mut status := os.system(cmd)
if status != 0 {
details := get_test_details(file)
os.setenv('VTEST_RETRY_MAX', '$details.retry', true)
for retry := 1; retry <= details.retry; retry++ {
ts.append_message(.info, ' [stats] retrying $retry/$details.retry of $relative_file ; known flaky: $details.flaky ...')
os.setenv('VTEST_RETRY', '$retry', true)
status = os.system(cmd)
if status == 0 {
unsafe {
goto test_passed_system
}
}
time.sleep(500 * time.millisecond)
}
if details.flaky && !testing.fail_flaky {
ts.append_message(.info, ' *FAILURE* of the known flaky test file $relative_file is ignored, since VTEST_FAIL_FLAKY is 0 . Retry count: $details.retry .')
unsafe {
goto test_passed_system
}
}
ts.benchmark.fail()
tls_bench.fail()
ts.add_failed_cmd(cmd)
return pool.no_result
} else {
test_passed_system:
ts.benchmark.ok()
tls_bench.ok()
}
} else {
if testing.show_start {
ts.append_message(.info, ' starting $relative_file ...')
}
r := os.execute(cmd)
mut r := os.execute(cmd)
if r.exit_code < 0 {
ts.failed = true
ts.benchmark.fail()
tls_bench.fail()
ts.append_message(.fail, tls_bench.step_message_fail(normalised_relative_file))
@@ -327,13 +435,31 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
return pool.no_result
}
if r.exit_code != 0 {
ts.failed = true
details := get_test_details(file)
os.setenv('VTEST_RETRY_MAX', '$details.retry', true)
for retry := 1; retry <= details.retry; retry++ {
ts.append_message(.info, ' retrying $retry/$details.retry of $relative_file ; known flaky: $details.flaky ...')
os.setenv('VTEST_RETRY', '$retry', true)
r = os.execute(cmd)
if r.exit_code == 0 {
unsafe {
goto test_passed_execute
}
}
}
if details.flaky && !testing.fail_flaky {
ts.append_message(.info, ' *FAILURE* of the known flaky test file $relative_file is ignored, since VTEST_FAIL_FLAKY is 0 . Retry count: $details.retry .')
unsafe {
goto test_passed_execute
}
}
ts.benchmark.fail()
tls_bench.fail()
ending_newline := if r.output.ends_with('\n') { '\n' } else { '' }
ts.append_message(.fail, tls_bench.step_message_fail('$normalised_relative_file\n$r.output.trim_space()$ending_newline'))
ts.add_failed_cmd(cmd)
} else {
test_passed_execute:
ts.benchmark.ok()
tls_bench.ok()
if !testing.hide_oks {
@@ -341,26 +467,20 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
}
}
}
if os.exists(generated_binary_fpath) {
if ts.rm_binaries {
os.rm(generated_binary_fpath) or { panic(err) }
}
if produces_file_output && ts.rm_binaries {
os.rm(generated_binary_fpath) or {}
}
return pool.no_result
}
pub fn vlib_should_be_present(parent_dir string) {
vlib_dir := os.join_path(parent_dir, 'vlib')
vlib_dir := os.join_path_single(parent_dir, 'vlib')
if !os.is_dir(vlib_dir) {
eprintln('$vlib_dir is missing, it must be next to the V executable')
exit(1)
}
}
pub fn v_build_failing(zargs string, folder string) bool {
return v_build_failing_skipped(zargs, folder, [])
}
pub fn prepare_test_session(zargs string, folder string, oskipped []string, main_label string) TestSession {
vexe := pref.vexe_path()
parent_dir := os.dir(vexe)
@@ -371,17 +491,17 @@ pub fn prepare_test_session(zargs string, folder string, oskipped []string, main
eprintln('v compiler args: "$vargs"')
}
mut session := new_test_session(vargs, true)
files := os.walk_ext(os.join_path(parent_dir, folder), '.v')
files := os.walk_ext(os.join_path_single(parent_dir, folder), '.v')
mut mains := []string{}
mut skipped := oskipped.clone()
next_file: for f in files {
fnormalised := f.replace('\\', '/')
// NB: a `testdata` folder, is the preferred name of a folder, containing V code,
// Note: a `testdata` folder, is the preferred name of a folder, containing V code,
// that you *do not want* the test framework to find incidentally for various reasons,
// for example module import tests, or subtests, that are compiled/run by other parent tests
// in specific configurations, etc.
if fnormalised.contains('testdata/') || fnormalised.contains('modules/')
|| f.contains('preludes/') {
|| fnormalised.contains('preludes/') {
continue
}
$if windows {
@@ -392,14 +512,15 @@ pub fn prepare_test_session(zargs string, folder string, oskipped []string, main
}
}
c := os.read_file(f) or { panic(err) }
maxc := if c.len > 300 { 300 } else { c.len }
maxc := if c.len > 500 { 500 } else { c.len }
start := c[0..maxc]
if start.contains('module ') && !start.contains('module main') {
skipped_f := f.replace(os.join_path(parent_dir, ''), '')
skipped_f := f.replace(os.join_path_single(parent_dir, ''), '')
skipped << skipped_f
}
for skip_prefix in oskipped {
if f.starts_with(skip_prefix) {
skip_folder := skip_prefix + '/'
if fnormalised.starts_with(skip_folder) {
continue next_file
}
}
@@ -410,13 +531,16 @@ pub fn prepare_test_session(zargs string, folder string, oskipped []string, main
return session
}
pub fn v_build_failing_skipped(zargs string, folder string, oskipped []string) bool {
pub type FnTestSetupCb = fn (mut session TestSession)
pub fn v_build_failing_skipped(zargs string, folder string, oskipped []string, cb FnTestSetupCb) bool {
main_label := 'Building $folder ...'
finish_label := 'building $folder'
mut session := prepare_test_session(zargs, folder, oskipped, main_label)
cb(mut session)
session.test()
eprintln(session.benchmark.total_message(finish_label))
return session.failed
return session.failed_cmds.len > 0
}
pub fn build_v_cmd_failed(cmd string) bool {
@@ -438,12 +562,11 @@ pub fn building_any_v_binaries_failed() bool {
vexe := pref.vexe_path()
parent_dir := os.dir(vexe)
vlib_should_be_present(parent_dir)
os.chdir(parent_dir)
os.chdir(parent_dir) or { panic(err) }
mut failed := false
v_build_commands := ['$vexe -o v_g -g cmd/v', '$vexe -o v_prod_g -prod -g cmd/v',
'$vexe -o v_cg -cg cmd/v', '$vexe -o v_prod_cg -prod -cg cmd/v',
'$vexe -o v_prod -prod cmd/v',
]
'$vexe -o v_prod -prod cmd/v']
mut bmark := benchmark.new_benchmark()
for cmd in v_build_commands {
bmark.step()
@@ -471,12 +594,42 @@ pub fn eheader(msg string) {
pub fn header(msg string) {
println(term.header_left(msg, '-'))
flush_stdout()
}
pub fn setup_new_vtmp_folder() string {
now := time.sys_mono_now()
new_vtmp_dir := os.join_path(os.temp_dir(), 'v', 'test_session_$now')
new_vtmp_dir := os.join_path(os.temp_dir(), 'v', 'tsession_${sync.thread_id().hex()}_$now')
os.mkdir_all(new_vtmp_dir) or { panic(err) }
os.setenv('VTMP', new_vtmp_dir, true)
return new_vtmp_dir
}
pub struct TestDetails {
pub mut:
retry int
flaky bool // when flaky tests fail, the whole run is still considered successfull, unless VTEST_FAIL_FLAKY is 1
}
pub fn get_test_details(file string) TestDetails {
mut res := TestDetails{}
lines := os.read_lines(file) or { [] }
for line in lines {
if line.starts_with('// vtest retry:') {
res.retry = line.all_after(':').trim_space().int()
}
if line.starts_with('// vtest flaky:') {
res.flaky = line.all_after(':').trim_space().bool()
}
}
return res
}
pub fn find_started_process(pname string) ?string {
for line in testing.all_processes {
if line.contains(pname) {
return line
}
}
return error('could not find process matching $pname')
}

View File

@@ -75,8 +75,8 @@ pub fn prepare_vc_source(vcdir string, cdir string, commit string) (string, stri
}
pub fn clone_or_pull(remote_git_url string, local_worktree_path string) {
// NB: after clone_or_pull, the current repo branch is === HEAD === master
if os.is_dir(local_worktree_path) && os.is_dir(os.join_path(local_worktree_path, '.git')) {
// Note: after clone_or_pull, the current repo branch is === HEAD === master
if os.is_dir(local_worktree_path) && os.is_dir(os.join_path_single(local_worktree_path, '.git')) {
// Already existing ... Just pulling in this case is faster usually.
scripting.run('git -C "$local_worktree_path" checkout --quiet master')
scripting.run('git -C "$local_worktree_path" pull --quiet ')
@@ -107,15 +107,15 @@ pub mut:
pub fn (mut vgit_context VGitContext) compile_oldv_if_needed() {
vgit_context.vexename = if os.user_os() == 'windows' { 'v.exe' } else { 'v' }
vgit_context.vexepath = os.real_path(os.join_path(vgit_context.path_v, vgit_context.vexename))
vgit_context.vexepath = os.real_path(os.join_path_single(vgit_context.path_v, vgit_context.vexename))
mut command_for_building_v_from_c_source := ''
mut command_for_selfbuilding := ''
if 'windows' == os.user_os() {
command_for_building_v_from_c_source = '$vgit_context.cc -std=c99 -municode -w -o cv.exe "$vgit_context.path_vc/v_win.c" '
command_for_selfbuilding = './cv.exe -o $vgit_context.vexename {SOURCE}'
command_for_building_v_from_c_source = '$vgit_context.cc -std=c99 -I ./thirdparty/stdatomic/win -municode -w -o cv.exe "$vgit_context.path_vc/v_win.c" '
command_for_selfbuilding = './cv.exe -o $vgit_context.vexename \{SOURCE}'
} else {
command_for_building_v_from_c_source = '$vgit_context.cc -std=gnu11 -w -o cv "$vgit_context.path_vc/v.c" -lm -lpthread'
command_for_selfbuilding = './cv -o $vgit_context.vexename {SOURCE}'
command_for_building_v_from_c_source = '$vgit_context.cc -std=gnu11 -I ./thirdparty/stdatomic/nix -w -o cv "$vgit_context.path_vc/v.c" -lm -lpthread'
command_for_selfbuilding = './cv -o $vgit_context.vexename \{SOURCE}'
}
scripting.chdir(vgit_context.workdir)
clone_or_pull(vgit_context.v_repo_url, vgit_context.path_v)
@@ -146,7 +146,7 @@ pub fn (mut vgit_context VGitContext) compile_oldv_if_needed() {
scripting.run('make fresh_tcc')
}
scripting.run(command_for_building_v_from_c_source)
build_cmd := command_for_selfbuilding.replace('{SOURCE}', vgit_context.vvlocation)
build_cmd := command_for_selfbuilding.replace('\{SOURCE}', vgit_context.vvlocation)
scripting.run(build_cmd)
// At this point, there exists a file vgit_context.vexepath
// which should be a valid working V executable.

View File

@@ -16,7 +16,7 @@ const (
| git checkout known_good_commit
| git bisect good
| ## Now git will automatically checkout a middle commit between the bad and the good
| cmd/tools/oldv HEAD --command="run commands in oldv folder, to verify if the commit is good or bad"
| cmd/tools/oldv --bisect --command="run commands in oldv folder, to verify if the commit is good or bad"
| ## See what the result is, and either do: ...
| git bisect good
| ## ... or do:
@@ -40,6 +40,7 @@ mut:
cleanup bool // should the tool run a cleanup first
use_cache bool // use local cached copies for --vrepo and --vcrepo in
fresh_tcc bool // do use `make fresh_tcc`
is_bisect bool // bisect mode; usage: `cmd/tools/oldv -b -c './v run bug.v'`
}
fn (mut c Context) compile_oldv_if_needed() {
@@ -56,7 +57,7 @@ fn (mut c Context) compile_oldv_if_needed() {
c.vgcontext.compile_oldv_if_needed()
c.commit_v_hash = c.vgcontext.commit_v__hash
if !os.exists(c.vgcontext.vexepath) && c.cmd_to_run.len > 0 {
// NB: 125 is a special code, that git bisect understands as 'skip this commit'.
// Note: 125 is a special code, that git bisect understands as 'skip this commit'.
// it is used to inform git bisect that the current commit leads to a build failure.
exit(125)
}
@@ -122,8 +123,9 @@ fn main() {
context.vgo.vc_repo_url = 'https://github.com/vlang/vc'
}
should_sync := fp.bool('cache-sync', `s`, false, 'Update the local cache')
if !should_sync {
fp.limit_free_args(1, 1)
context.is_bisect = fp.bool('bisect', `b`, false, 'Bisect mode. Use the current commit in the repo where oldv is.')
if !should_sync && !context.is_bisect {
fp.limit_free_args(1, 1)!
}
////
context.cleanup = fp.bool('clean', 0, false, 'Clean before running (slower).')
@@ -141,6 +143,10 @@ fn main() {
}
if commits.len > 0 {
context.commit_v = commits[0]
if context.is_bisect {
eprintln('In bisect mode, you should not pass any commits, since oldv will use the current one.')
exit(2)
}
} else {
context.commit_v = scripting.run('git rev-list -n1 HEAD')
}
@@ -171,6 +177,9 @@ fn main() {
}
scripting.cprint_strong('# result: ')
print(cmdres.output)
if !cmdres.output.ends_with('\n') {
println('')
}
exit(cmdres.exit_code)
}
}

View File

@@ -56,15 +56,18 @@ fn (c Context) compare_versions() {
'v @DEBUG@ -o source.c examples/hello_world.v',
'v -o source.c examples/hello_world.v',
])
perf_files << c.compare_v_performance('source_v', ['vprod @DEBUG@ -o source.c @COMPILER@',
'vprod -o source.c @COMPILER@', 'v @DEBUG@ -o source.c @COMPILER@',
perf_files << c.compare_v_performance('source_v', [
'vprod @DEBUG@ -o source.c @COMPILER@',
'vprod -o source.c @COMPILER@',
'v @DEBUG@ -o source.c @COMPILER@',
'v -o source.c @COMPILER@',
])
perf_files << c.compare_v_performance('binary_hello', [
'vprod -o hello examples/hello_world.v',
'v -o hello examples/hello_world.v',
])
perf_files << c.compare_v_performance('binary_v', ['vprod -o binary @COMPILER@',
perf_files << c.compare_v_performance('binary_v', [
'vprod -o binary @COMPILER@',
'v -o binary @COMPILER@',
])
println('All performance files:')
@@ -107,8 +110,7 @@ fn (c &Context) prepare_v(cdir string, commit string) {
scripting.show_sizes_of_files(['$cdir/cv', '$cdir/cv_stripped', '$cdir/cv_stripped_upxed'])
scripting.show_sizes_of_files(['$cdir/v', '$cdir/v_stripped', '$cdir/v_stripped_upxed'])
scripting.show_sizes_of_files(['$cdir/vprod', '$cdir/vprod_stripped',
'$cdir/vprod_stripped_upxed',
])
'$cdir/vprod_stripped_upxed'])
vversion := scripting.run('$cdir/v -version')
vcommit := scripting.run('git rev-parse --short --verify HEAD')
println('V version is: $vversion , local source commit: $vcommit')
@@ -192,7 +194,7 @@ fn main() {
fp.description(tool_description)
fp.arguments_description('COMMIT_BEFORE [COMMIT_AFTER]')
fp.skip_executable()
fp.limit_free_args(1, 2)
fp.limit_free_args(1, 2)!
context.vflags = fp.string('vflags', 0, '', 'Additional options to pass to the v commands, for example "-cc tcc"')
context.hyperfineopts = fp.string('hyperfine_options', 0, '', 'Additional options passed to hyperfine.
${flag.space}For example on linux, you may want to pass:

79
cmd/tools/regress.v Normal file
View File

@@ -0,0 +1,79 @@
import os
import term
import flag
const tools_folder = os.real_path(os.dir(os.executable()))
const oldvexe = fullpath(tools_folder, 'oldv')
const oldv_source = fullpath(tools_folder, 'oldv.v')
const vroot = os.real_path(os.dir(os.dir(tools_folder)))
const vexe = fullpath(vroot, 'v')
fn fullpath(folder string, fname string) string {
return os.real_path(os.join_path_single(folder, exename(fname)))
}
fn exename(n string) string {
if n.ends_with('.v') || os.user_os() != 'windows' {
return n
}
return '${n}.exe'
}
struct Context {
mut:
old_commit string
new_commit string
command string
}
fn main() {
mut fp := flag.new_flag_parser(os.args)
mut context := Context{}
fp.application(os.file_name(os.executable()))
fp.version('0.0.2')
fp.description('\n Find at what commit a regression occurred.
To find when a regression happened (regression_bug.v should fail on master):
./v run cmd/tools/regress.v --old a7019ac --command " ./v run /abs/path/to/regression_bug.v"
To find when a feature was implemented (feature.v should succeed on master):
./v run cmd/tools/regress.v --old a7019ac --command "! ./v run /abs/path/to/feature.v"')
fp.skip_executable()
//
context.new_commit = fp.string('new', `n`, 'master', 'The new commit, by default: master.')
context.old_commit = fp.string('old', `o`, '', 'A known old commit, required (for it, COMMAND should exit with 0).')
context.command = fp.string('command', `c`, '', 'A command to execute. Should exit with 0 for the *old* commits.')
fp.finalize() or {}
if context.old_commit == '' {
eprintln('--old COMMIT is required')
exit(1)
}
if context.command == '' {
eprintln('--command "COMMAND" is required')
exit(2)
}
if !os.exists(oldvexe) {
if 0 != execute('${os.quoted_path(vexe)} -o ${os.quoted_path(oldvexe)} ${os.quoted_path(oldv_source)}') {
panic('can not compile $oldvexe')
}
}
os.execute('git checkout master')
os.execute('git bisect reset')
os.execute('git checkout $context.new_commit')
os.execute('git bisect start')
os.execute('git bisect new')
os.execute('git checkout $context.old_commit')
os.execute('git bisect old')
println(term.colorize(term.bright_yellow, term.header('', '-')))
execute('git bisect run ${os.quoted_path(oldvexe)} --bisect -c "$context.command"')
println(term.colorize(term.bright_yellow, term.header('', '-')))
os.execute('git bisect reset')
os.execute('git checkout master')
}
fn execute(cmd string) int {
eprintln('### $cmd')
return os.system(cmd)
}

View File

@@ -6,7 +6,6 @@ import time
import term
import math
import scripting
import v.util
struct CmdResult {
mut:
@@ -127,8 +126,12 @@ fn new_aints(ovals []int, extreme_mins int, extreme_maxs int) Aints {
return res
}
fn bold(s string) string {
return term.colorize(term.bold, s)
}
fn (a Aints) str() string {
return util.bold('${a.average:6.2f}') +
return bold('${a.average:6.2f}') +
'ms ± σ: ${a.stddev:4.1f}ms, min: ${a.imin:4}ms, max: ${a.imax:4}ms, runs:${a.values.len:3}, nmins:${a.nmins:2}, nmaxs:${a.nmaxs:2}'
}
@@ -140,30 +143,30 @@ const (
fn main() {
mut context := Context{}
context.parse_options()
context.parse_options()!
context.run()
context.show_diff_summary()
}
fn (mut context Context) parse_options() {
fn (mut context Context) parse_options() ! {
mut fp := flag.new_flag_parser(os.args)
fp.application(os.file_name(os.executable()))
fp.version('0.0.1')
fp.description('Repeat command(s) and collect statistics. NB: you have to quote each command, if it contains spaces.')
fp.description('Repeat command(s) and collect statistics. Note: you have to quote each command, if it contains spaces.')
fp.arguments_description('CMD1 CMD2 ...')
fp.skip_executable()
fp.limit_free_args_to_at_least(1)
fp.limit_free_args_to_at_least(1)!
context.count = fp.int('count', `c`, 10, 'Repetition count.')
context.series = fp.int('series', `s`, 2, 'Series count. `-s 2 -c 4 a b` => aaaabbbbaaaabbbb, while `-s 3 -c 2 a b` => aabbaabbaabb.')
context.warmup = fp.int('warmup', `w`, 2, 'Warmup runs. These are done *only at the start*, and are ignored.')
context.show_help = fp.bool('help', `h`, false, 'Show this help screen.')
context.use_newline = fp.bool('newline', `n`, false, 'Use \\n, do not overwrite the last line. Produces more output, but easier to diagnose.')
context.show_output = fp.bool('output', `O`, false, 'Show command stdout/stderr in the progress indicator for each command. NB: slower, for verbose commands.')
context.show_output = fp.bool('output', `O`, false, 'Show command stdout/stderr in the progress indicator for each command. Note: slower, for verbose commands.')
context.verbose = fp.bool('verbose', `v`, false, 'Be more verbose.')
context.fail_on_maxtime = fp.int('max_time', `m`, max_time, 'Fail with exit code 2, when first cmd takes above M milliseconds (regression).')
context.fail_on_regress_percent = fp.int('fail_percent', `f`, max_fail_percent, 'Fail with exit code 3, when first cmd is X% slower than the rest (regression).')
context.cmd_template = fp.string('template', `t`, '{T}', 'Command template. {T} will be substituted with the current command.')
cmd_params := fp.string_multi('parameter', `p`, 'A parameter substitution list. `{p}=val1,val2,val2` means that {p} in the template, will be substituted with each of val1, val2, val3.')
context.cmd_template = fp.string('template', `t`, r'{T}', r'Command template. {T} will be substituted with the current command.')
cmd_params := fp.string_multi('parameter', `p`, r'A parameter substitution list. `{p}=val1,val2,val2` means that {p} in the template, will be substituted with each of val1, val2, val3.')
context.nmins = fp.int('nmins', `i`, 0, 'Ignore the BOTTOM X results (minimum execution time). Makes the results more robust to performance flukes.')
context.nmaxs = fp.int('nmaxs', `a`, 1, 'Ignore the TOP X results (maximum execution time). Makes the results more robust to performance flukes.')
for p in cmd_params {
@@ -197,14 +200,19 @@ fn (mut context Context) parse_options() {
}
}
fn flushed_print(s string) {
print(s)
flush_stdout()
}
fn (mut context Context) clear_line() {
print(context.cline)
flushed_print(context.cline)
}
fn (mut context Context) expand_all_commands(commands []string) []string {
mut all_commands := []string{}
for cmd in commands {
maincmd := context.cmd_template.replace('{T}', cmd)
maincmd := context.cmd_template.replace(r'{T}', cmd)
mut substituted_commands := []string{}
substituted_commands << maincmd
for paramk, paramlist in context.cmd_params {
@@ -244,7 +252,7 @@ fn (mut context Context) run() {
println('Series: ${si:4}/${context.series:-4}, command: $cmd')
if context.warmup > 0 && run_warmups < context.commands.len {
for i in 1 .. context.warmup + 1 {
print('${context.cgoback}warming up run: ${i:4}/${context.warmup:-4} for ${cmd:-50s} took ${duration:6} ms ...')
flushed_print('${context.cgoback}warming up run: ${i:4}/${context.warmup:-4} for ${cmd:-50s} took ${duration:6} ms ...')
mut sw := time.new_stopwatch()
res := os.execute(cmd)
if res.exit_code != 0 {
@@ -257,9 +265,9 @@ fn (mut context Context) run() {
context.clear_line()
for i in 1 .. (context.count + 1) {
avg := f64(sum) / f64(i)
print('${context.cgoback}Average: ${avg:9.3f}ms | run: ${i:4}/${context.count:-4} | took ${duration:6} ms')
flushed_print('${context.cgoback}Average: ${avg:9.3f}ms | run: ${i:4}/${context.count:-4} | took ${duration:6} ms')
if context.show_output {
print(' | result: ${oldres:s}')
flushed_print(' | result: ${oldres:s}')
}
mut sw := time.new_stopwatch()
res := scripting.exec(cmd) or { continue }
@@ -285,7 +293,7 @@ fn (mut context Context) run() {
context.results[icmd].atiming = new_aints(context.results[icmd].timings, context.nmins,
context.nmaxs)
context.clear_line()
print(context.cgoback)
flushed_print(context.cgoback)
mut m := map[string][]int{}
ioutputs := context.results[icmd].outputs
for o in ioutputs {
@@ -346,7 +354,7 @@ fn (mut context Context) show_diff_summary() {
first_marker = ' '
cpercent := (r.atiming.average / base) * 100 - 100
if r.icmd == 0 {
first_marker = util.bold('>')
first_marker = bold('>')
first_cmd_percentage = cpercent
}
println(' $first_marker${(i + 1):3} | ${cpercent:5.1f}% slower | ${r.cmd:-57s} | $r.atiming')
@@ -355,7 +363,7 @@ fn (mut context Context) show_diff_summary() {
println('context: $context')
}
if int(base) > context.fail_on_maxtime {
print(performance_regression_label)
flushed_print(performance_regression_label)
println('average time: ${base:6.1f} ms > $context.fail_on_maxtime ms threshold.')
exit(2)
}
@@ -364,7 +372,7 @@ fn (mut context Context) show_diff_summary() {
}
fail_threshold_max := f64(context.fail_on_regress_percent)
if first_cmd_percentage > fail_threshold_max {
print(performance_regression_label)
flushed_print(performance_regression_label)
println('${first_cmd_percentage:5.1f}% > ${fail_threshold_max:5.1f}% threshold.')
exit(3)
}

View File

@@ -0,0 +1,68 @@
module main
import os
const vexe = @VEXE
const known_skip_patterns_env = os.getenv('VKNOWN_SKIP_PATTERNS')
const known_folder_patterns_that_are_not_module_ones = [
'vlib/sync/bench',
'/tests',
'/testdata',
'/preludes_js',
'vlib/builtin/js', // TODO: fix compiler panic
'vlib/fontstash', // used by `gg`
'vlib/sokol/sfons', // used by `gg`, and by examples/sokol/fonts.v
'vlib/sokol/sapp', // used by `gg`, and many examples/
'vlib/sokol/gfx', // used by `gg`, `x.ttf`
'vlib/sokol/sgl', // used by `gg`
'vlib/toml', // toml is well tested, even if the top level folder does not have _test.v files, the ones below do
'vlib/v/', // the compiler itself is well tested
]
fn main() {
mut places := if os.args.len > 1 {
os.args#[1..]
} else {
eprintln('> check the current folder only by default ...')
['.']
}
mut known_skip_patterns := known_folder_patterns_that_are_not_module_ones.clone()
if known_skip_patterns_env != '' {
known_skip_patterns = known_skip_patterns_env.split(',').filter(it != '')
}
for path in places {
eprintln('> Checking folder: `$path` ...')
mut found := 0
files := os.walk_ext(path, '.v')
mut v_files := map[string]int{}
mut v_test_files := map[string]int{}
for f in files {
folder := os.to_slash(os.dir(f))
if known_skip_patterns.any(f.contains(it)) {
continue
}
if f.ends_with('.v') {
v_files[folder]++
}
if f.ends_with('_test.v') {
v_test_files[folder]++
}
}
eprintln('> Found ${v_files.len:5} potential V module folders (containing .v files).')
for folder, n_v_files in v_files {
n_test_v_files := v_test_files[folder]
if n_v_files > 1 && n_test_v_files == 0 {
println('> ${n_test_v_files:5} _test.v files, with ${n_v_files:5} .v files, in folder: $folder')
compilation := os.execute('${os.quoted_path(vexe)} -shared -W -Wfatal-errors -check ${os.quoted_path(folder)}')
if compilation.exit_code != 0 {
eprintln('> $folder has parser/checker errors!')
eprintln(compilation.output)
}
found++
}
}
eprintln('> Found $found module folders without _test.v files in `$path` .')
}
}

View File

@@ -6,7 +6,7 @@ import os
import rand
const (
vexe = get_vexe_path()
vexe = os.quoted_path(get_vexe_path())
vroot = os.dir(vexe)
tdir = new_tdir()
)
@@ -26,34 +26,69 @@ fn get_vexe_path() string {
}
fn new_tdir() string {
tdir_ := os.join_path(os.temp_dir(), rand.ulid())
if os.exists(tdir_) {
os.rmdir(tdir_) or { panic(err) }
}
os.mkdir(tdir_) or { panic(err) }
dir := os.join_path(os.temp_dir(), 'v', rand.ulid())
os.rmdir_all(dir) or {}
os.mkdir_all(dir) or { panic(err) }
C.atexit(cleanup_tdir)
return tdir_
return dir
}
fn cleanup_tdir() {
println('... removing tdir: $tdir')
os.rmdir_all(tdir) or { panic(err) }
os.rmdir_all(tdir) or { eprintln(err) }
}
fn main() {
println('> vroot: $vroot | vexe: $vexe | tdir: $tdir')
ok_fpath := os.join_path(tdir, 'single_test.v')
os.write_file(ok_fpath, 'fn test_ok(){ assert true }') ?
check_ok('"$vexe" $ok_fpath')
check_ok('"$vexe" test $ok_fpath')
fail_fpath := os.join_path(tdir, 'failing_test.v')
os.write_file(fail_fpath, 'fn test_fail(){ assert 1 == 2 }') ?
check_fail('"$vexe" $fail_fpath')
check_fail('"$vexe" test $fail_fpath')
check_fail('"$vexe" test $tdir')
type MyResult = string
[noreturn]
fn (result MyResult) fail(reason string) {
eprintln('> $reason, but it does not. Result:\n$result')
exit(1)
}
fn check_ok(cmd string) string {
fn (result MyResult) has(sub string) MyResult {
if !result.contains(sub) {
result.fail(' result should have the substring `$sub`')
}
return result
}
fn (result MyResult) matches(gpattern string) MyResult {
if !result.match_glob(gpattern) {
result.fail('result should match the glob pattern `$gpattern`')
}
return result
}
fn create_test(tname string, tcontent string) !string {
tpath := os.join_path(tdir, tname)
os.write_file(tpath, tcontent)!
eprintln('>>>>>>>> tpath: $tpath | tcontent: $tcontent')
return os.quoted_path(tpath)
}
fn check_assert_continues_works() ! {
os.chdir(tdir)!
create_test('assert_continues_option_works_test.v', 'fn test_fail1() { assert 2==4\nassert 2==1\nassert 2==0 }\nfn test_ok(){ assert true }\nfn test_fail2() { assert false }')!
result := check_fail('$vexe -assert continues assert_continues_option_works_test.v')
result.has('assert_continues_option_works_test.v:1: fn test_fail1')
result.has('assert_continues_option_works_test.v:2: fn test_fail1')
result.has('assert_continues_option_works_test.v:3: fn test_fail1')
result.has('assert_continues_option_works_test.v:5: fn test_fail2')
result.has('> assert 2 == 4').has('> assert 2 == 1').has('> assert 2 == 0')
// Check if a test function, tagged with [assert_continues], has the same behaviour, without needing additional options
create_test('assert_continues_tag_works_test.v', '[assert_continues]fn test_fail1() { assert 2==4\nassert 2==1\nassert 2==0 }\nfn test_ok(){ assert true }\nfn test_fail2() { assert false\n assert false }')!
tag_res := check_fail('$vexe assert_continues_tag_works_test.v')
tag_res.has('assert_continues_tag_works_test.v:1: fn test_fail1')
tag_res.has('assert_continues_tag_works_test.v:2: fn test_fail1')
tag_res.has('assert_continues_tag_works_test.v:3: fn test_fail1')
tag_res.has('assert_continues_tag_works_test.v:5: fn test_fail2')
if tag_res.contains('assert_continues_tag_works_test.v:6: fn test_fail2') {
exit(1)
}
}
fn check_ok(cmd string) MyResult {
println('> check_ok cmd: $cmd')
res := os.execute(cmd)
if res.exit_code != 0 {
@@ -63,7 +98,7 @@ fn check_ok(cmd string) string {
return res.output
}
fn check_fail(cmd string) string {
fn check_fail(cmd string) MyResult {
println('> check_fail cmd: $cmd')
res := os.execute(cmd)
if res.exit_code == 0 {
@@ -72,3 +107,29 @@ fn check_fail(cmd string) string {
}
return res.output
}
fn main() {
defer {
os.chdir(os.wd_at_startup) or {}
}
println('> vroot: $vroot | vexe: $vexe | tdir: $tdir')
ok_fpath := create_test('a_single_ok_test.v', 'fn test_ok(){ assert true }')!
if check_ok('$vexe $ok_fpath') != '' {
exit(1)
}
check_ok('$vexe test $ok_fpath').matches('*OK*a_single_ok_test.v*')
check_ok('$vexe test "$tdir"').matches('*OK*a_single_ok_test.v*')
//
fail_fpath := create_test('a_single_failing_test.v', 'fn test_fail(){ assert 1 == 2 }')!
check_fail('$vexe $fail_fpath').has('> assert 1 == 2').has('a_single_failing_test.v:1: fn test_fail')
check_fail('$vexe test $fail_fpath').has('> assert 1 == 2').has('a_single_failing_test.v:1: fn test_fail')
check_fail('$vexe test "$tdir"').has('> assert 1 == 2')
rel_dir := os.join_path(tdir, rand.ulid())
os.mkdir(rel_dir)!
os.chdir(rel_dir)!
relative_path := '..' + os.path_separator + 'a_single_ok_test.v'
check_ok('$vexe test ${os.quoted_path(relative_path)}').has('OK').has('a_single_ok_test.v')
//
check_assert_continues_works()!
println('> all done')
}

53
cmd/tools/translate.v Normal file
View File

@@ -0,0 +1,53 @@
// Copyright (c) 2019-2022 Alexander Medvednikov. All rights reserved.
// Use of this source code is governed by an MIT license that can be found in the LICENSE file.
module main
import os
import v.util
const vexe = os.getenv('VEXE')
fn main() {
vmodules := os.vmodules_dir()
c2v_dir := os.join_path(vmodules, 'c2v')
mut c2v_bin := os.join_path(c2v_dir, 'c2v')
$if windows {
c2v_bin += '.exe'
}
// Git clone c2v
if !os.exists(c2v_dir) {
os.mkdir_all(vmodules)!
println('C2V is not installed. Cloning C2V to $c2v_dir ...')
os.chdir(vmodules)!
res := os.execute('git clone https://github.com/vlang/c2v')
if res.exit_code != 0 {
eprintln('Failed to download C2V.')
exit(1)
}
}
// Compile c2v
if !os.exists(c2v_bin) {
os.chdir(c2v_dir)!
println('Compiling c2v ...')
res2 := os.execute('${os.quoted_path(vexe)} -o ${os.quoted_path(c2v_bin)} -keepc -g -experimental .')
if res2.exit_code != 0 {
eprintln(res2.output)
eprintln('Failed to compile C2V. This should not happen. Please report it via GitHub.')
exit(2)
}
}
if os.args.len < 3 {
eprintln('Wrong number of arguments. Use `v translate file.c` .')
exit(3)
}
passed_args := util.args_quote_paths(os.args[2..])
// println(passed_args)
os.chdir(os.wd_at_startup)!
c2v_cmd := '${os.quoted_path(c2v_bin)} $passed_args'
res := os.system(c2v_cmd)
if res != 0 {
eprintln('C2V command: $c2v_cmd')
eprintln('C2V failed to translate the C files. Please report it via GitHub.')
exit(4)
}
}

View File

@@ -24,7 +24,7 @@ fn C.cJSON_CreateNull() &C.cJSON
// fn C.cJSON_CreateNumber() &C.cJSON
// fn C.cJSON_CreateString() &C.cJSON
fn C.cJSON_CreateRaw(&byte) &C.cJSON
fn C.cJSON_CreateRaw(&u8) &C.cJSON
fn C.cJSON_IsInvalid(voidptr) bool
@@ -45,13 +45,13 @@ fn C.cJSON_IsObject(voidptr) bool
fn C.cJSON_IsRaw(voidptr) bool
fn C.cJSON_AddItemToObject(voidptr, &byte, voidptr)
fn C.cJSON_AddItemToObject(voidptr, &u8, voidptr)
fn C.cJSON_AddItemToArray(voidptr, voidptr)
fn C.cJSON_Delete(voidptr)
fn C.cJSON_Print(voidptr) &byte
fn C.cJSON_Print(voidptr) &u8
[inline]
fn create_object() &C.cJSON {

View File

@@ -119,3 +119,13 @@ struct GenericStruct<T> {
mut:
model T
}
// generic interface
interface Gettable<T> {
get() T
}
// generic sumtype
struct None {}
type MyOption<T> = Error | None | T

File diff suppressed because it is too large Load Diff

View File

@@ -46,12 +46,12 @@ fn (context Context) footer() string {
return ')\n'
}
fn (context Context) file2v(bname string, fbytes []byte, bn_max int) string {
fn (context Context) file2v(bname string, fbytes []u8, bn_max int) string {
mut sb := strings.new_builder(1000)
bn_diff_len := bn_max - bname.len
sb.write_string('\t${bname}_len' + ' '.repeat(bn_diff_len - 4) + ' = $fbytes.len\n')
fbyte := fbytes[0]
bnmae_line := '\t$bname' + ' '.repeat(bn_diff_len) + ' = [byte($fbyte), '
bnmae_line := '\t$bname' + ' '.repeat(bn_diff_len) + ' = [u8($fbyte), '
sb.write_string(bnmae_line)
mut line_len := bnmae_line.len + 3
for i := 1; i < fbytes.len; i++ {
@@ -73,11 +73,11 @@ fn (context Context) file2v(bname string, fbytes []byte, bn_max int) string {
return sb.str()
}
fn (context Context) bname_and_bytes(file string) ?(string, []byte) {
fn (context Context) bname_and_bytes(file string) !(string, []u8) {
fname := os.file_name(file)
fname_escaped := fname.replace_each(['.', '_', '-', '_'])
byte_name := '$context.prefix$fname_escaped'.to_lower()
fbytes := os.read_bytes(file) or { return error('Error: $err.msg') }
fbytes := os.read_bytes(file) or { return error('Error: $err.msg()') }
return byte_name, fbytes
}
@@ -108,7 +108,7 @@ fn main() {
exit(0)
}
files := fp.finalize() or {
eprintln('Error: $err.msg')
eprintln('Error: $err.msg()')
exit(1)
}
real_files := files.filter(it != 'bin2v')
@@ -120,22 +120,22 @@ fn main() {
if context.write_file != '' && os.file_ext(context.write_file) !in ['.vv', '.v'] {
context.write_file += '.v'
}
mut file_byte_map := map[string][]byte{}
mut file_byte_map := map[string][]u8{}
for file in real_files {
bname, fbytes := context.bname_and_bytes(file) or {
eprintln(err.msg)
eprintln(err.msg())
exit(1)
}
file_byte_map[bname] = fbytes
}
max_bname := context.max_bname_len(file_byte_map.keys())
if context.write_file.len > 0 {
mut out_file := os.create(context.write_file) ?
out_file.write_string(context.header()) ?
mut out_file := os.create(context.write_file)!
out_file.write_string(context.header())!
for bname, fbytes in file_byte_map {
out_file.write_string(context.file2v(bname, fbytes, max_bname)) ?
out_file.write_string(context.file2v(bname, fbytes, max_bname))!
}
out_file.write_string(context.footer()) ?
out_file.write_string(context.footer())!
} else {
print(context.header())
for bname, fbytes in file_byte_map {

View File

@@ -1,4 +1,3 @@
import dl
import net.urllib
import os
import readline
@@ -9,7 +8,7 @@ const vroot = @VMODROOT
fn get_vdoctor_output(is_verbose bool) string {
vexe := os.getenv('VEXE')
verbose_flag := if is_verbose { '-v' } else { '' }
result := os.execute('$vexe $verbose_flag doctor')
result := os.execute('${os.quoted_path(vexe)} $verbose_flag doctor')
if result.exit_code != 0 {
eprintln('unable to get `v doctor` output: $result.output')
return ''
@@ -22,19 +21,19 @@ fn get_v_build_output(is_verbose bool, is_yes bool, file_path string) string {
mut vexe := os.getenv('VEXE')
// prepare a V compiler with -g to have better backtraces if possible
wd := os.getwd()
os.chdir(vroot)
os.chdir(vroot) or {}
verbose_flag := if is_verbose { '-v' } else { '' }
vdbg_path := $if windows { '$vroot/vdbg.exe' } $else { '$vroot/vdbg' }
vdbg_compilation_cmd := '"$vexe" $verbose_flag -g -o "$vdbg_path" cmd/v'
vdbg_compilation_cmd := '${os.quoted_path(vexe)} $verbose_flag -g -o ${os.quoted_path(vdbg_path)} cmd/v'
vdbg_result := os.execute(vdbg_compilation_cmd)
os.chdir(wd)
os.chdir(wd) or {}
if vdbg_result.exit_code == 0 {
vexe = vdbg_path
} else {
eprintln('unable to compile V in debug mode: $vdbg_result.output\ncommand: $vdbg_compilation_cmd\n')
}
//
mut result := os.execute('"$vexe" $verbose_flag "$file_path"')
mut result := os.execute('${os.quoted_path(vexe)} $verbose_flag ${os.quoted_path(file_path)}')
defer {
os.rm(vdbg_path) or {
if is_verbose {
@@ -57,7 +56,7 @@ fn get_v_build_output(is_verbose bool, is_yes bool, file_path string) string {
run := is_yes
|| ask('It looks like the compilation went well, do you want to run the file?')
if run {
result = os.execute('"$vexe" $verbose_flag run "$file_path"')
result = os.execute('${os.quoted_path(vexe)} $verbose_flag run ${os.quoted_path(file_path)}')
if result.exit_code == 0 && !is_yes {
confirm_or_exit('It looks like the file ran correctly as well, are you sure you want to continue?')
}
@@ -66,46 +65,6 @@ fn get_v_build_output(is_verbose bool, is_yes bool, file_path string) string {
return result.output
}
type ShellExecuteWin = fn (voidptr, &u16, &u16, &u16, &u16, int)
// open a uri using the default associated application
fn open_browser(uri string) ? {
$if macos {
result := os.execute('open "$uri"')
if result.exit_code != 0 {
return error('unable to open url: $result.output')
}
} $else $if freebsd || openbsd {
result := os.execute('xdg-open "$uri"')
if result.exit_code != 0 {
return error('unable to open url: $result.output')
}
} $else $if linux {
providers := ['xdg-open', 'x-www-browser', 'www-browser', 'wslview']
// There are multiple possible providers to open a browser on linux
// One of them is xdg-open, another is x-www-browser, then there's www-browser, etc.
// Look for one that exists and run it
for provider in providers {
if os.exists_in_system_path(provider) {
result := os.execute('$provider "$uri"')
if result.exit_code != 0 {
return error('unable to open url: $result.output')
}
break
}
}
} $else $if windows {
handle := dl.open_opt('shell32', dl.rtld_now) ?
// https://docs.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shellexecutew
func := ShellExecuteWin(dl.sym_opt(handle, 'ShellExecuteW') ?)
func(C.NULL, 'open'.to_wide(), uri.to_wide(), C.NULL, C.NULL, C.SW_SHOWNORMAL)
dl.close(handle)
} $else {
return error('unsupported platform')
}
}
fn ask(msg string) bool {
prompt := os.input_opt('$msg [Y/n] ') or { 'y' }
return prompt == '' || prompt[0].ascii_str().to_lower() != 'n'
@@ -146,6 +105,7 @@ fn main() {
eprintln('v bug: no v file listed to report')
exit(1)
}
os.unsetenv('VCOLORS')
// collect error information
// output from `v doctor`
vdoctor_output := get_vdoctor_output(is_verbose)
@@ -158,7 +118,7 @@ fn main() {
build_output := get_v_build_output(is_verbose, is_yes, file_path)
// ask the user if he wants to submit even after an error
if !is_yes && (vdoctor_output == '' || file_content == '' || build_output == '') {
confirm_or_exit('An error occured retrieving the information, do you want to continue?')
confirm_or_exit('An error occurred retrieving the information, do you want to continue?')
}
expected_result := readline.read_line('What did you expect to see? ') or {
@@ -176,11 +136,12 @@ fn main() {
raw_body := '<!-- It is advisable to update all relevant modules using `v outdated` and `v install` -->
**V doctor:**
```
$vdoctor_output```
$vdoctor_output
```
**What did you do?**
`v -g -o vdbg cmd/v && vdbg $file_path`
{file_content}
\{file_content}
**What did you expect to see?**
@@ -189,16 +150,16 @@ $expected_result
**What did you see instead?**
```
$build_output```'
mut encoded_body := urllib.query_escape(raw_body.replace_once('{file_content}', '```v\n$file_content\n```'))
mut encoded_body := urllib.query_escape(raw_body.replace_once(r'{file_content}', '```v\n$file_content\n```'))
mut generated_uri := 'https://github.com/vlang/v/issues/new?labels=Bug&body=$encoded_body'
if generated_uri.len > 8192 {
// GitHub doesn't support URLs longer than 8192 characters
encoded_body = urllib.query_escape(raw_body.replace_once('{file_content}', 'See attached file `$file_path`'))
encoded_body = urllib.query_escape(raw_body.replace_once(r'{file_content}', 'See attached file `$file_path`'))
generated_uri = 'https://github.com/vlang/v/issues/new?labels=Bug&body=$encoded_body'
println('Your file is too big to be submitted. Head over to the following URL and attach your file.')
println(generated_uri)
} else {
open_browser(generated_uri) or {
os.open_uri(generated_uri) or {
if is_verbose {
eprintln(err)
}

View File

@@ -3,13 +3,31 @@ module main
import os
import testing
const vroot = @VMODROOT
// build as a project folder
const efolders = [
'examples/viewer',
'examples/vweb_orm_jwt',
]
fn main() {
args_string := os.args[1..].join(' ')
params := args_string.all_before('build-examples')
if testing.v_build_failing(params, 'examples') {
skip_prefixes := efolders.map(os.real_path(os.join_path_single(vroot, it)).replace('\\',
'/'))
res := testing.v_build_failing_skipped(params, 'examples', skip_prefixes, fn (mut session testing.TestSession) {
for x in efolders {
pathsegments := x.split_any('/')
session.add(os.real_path(os.join_path(vroot, ...pathsegments)))
}
})
if res {
exit(1)
}
if testing.v_build_failing(params + '-live', os.join_path('examples', 'hot_reload')) {
if testing.v_build_failing_skipped(params + '-live', os.join_path_single('examples',
'hot_reload'), skip_prefixes, fn (mut session testing.TestSession) {})
{
exit(1)
}
}

View File

@@ -4,14 +4,14 @@ import os
import testing
import v.util
// NB: tools like vdoc are compiled in their own subfolder
// Note: tools like vdoc are compiled in their own subfolder
// => cmd/tools/vdoc/vdoc.exe
// Usually, they have several top level .v files in the subfolder,
// that cannot be compiled separately, but instead, the whole folder,
// should be compiled (v folder).
// To implement that, these folders are initially skipped, then added
// as a whole *after the testing.prepare_test_session call*.
const tools_in_subfolders = ['vdoc', 'vvet', 'vast']
const tools_in_subfolders = ['vdoc', 'vvet', 'vast', 'vwhere']
// non_packaged_tools are tools that should not be packaged with
// prebuild versions of V, to keep the size smaller.
@@ -23,7 +23,7 @@ fn main() {
args_string := os.args[1..].join(' ')
vexe := os.getenv('VEXE')
vroot := os.dir(vexe)
os.chdir(vroot)
os.chdir(vroot)!
folder := os.join_path('cmd', 'tools')
tfolder := os.join_path(vroot, 'cmd', 'tools')
main_label := 'Building $folder ...'
@@ -31,7 +31,7 @@ fn main() {
//
mut skips := []string{}
for stool in tools_in_subfolders {
skips << os.join_path(tfolder, stool)
skips << os.join_path(tfolder, stool).replace('\\', '/')
}
buildopts := args_string.all_before('build-tools')
mut session := testing.prepare_test_session(buildopts, folder, skips, main_label)
@@ -43,11 +43,11 @@ fn main() {
// eprintln('> session.skip_files: $session.skip_files')
session.test()
eprintln(session.benchmark.total_message(finish_label))
if session.failed {
if session.failed_cmds.len > 0 {
exit(1)
}
//
mut executables := os.ls(session.vtmp_dir) ?
mut executables := os.ls(session.vtmp_dir)!
executables.sort()
for texe in executables {
tname := texe.replace(os.file_ext(texe), '')
@@ -56,14 +56,19 @@ fn main() {
}
//
tpath := os.join_path(session.vtmp_dir, texe)
if texe.ends_with('_builder') || texe.ends_with('_builder.exe') {
os.mv_by_cp(tpath, os.join_path(tfolder, 'builders', texe)) or { panic(err) }
continue
}
if tname in tools_in_subfolders {
os.mv_by_cp(tpath, os.join_path(tfolder, tname, texe)) or { panic(err) }
continue
}
target_path := os.join_path(tfolder, texe)
os.mv_by_cp(tpath, target_path) or {
if !err.msg.contains('vbuild-tools') && !err.msg.contains('vtest-all') {
eprintln('error while moving $tpath to $target_path: $err.msg')
emsg := err.msg()
if !emsg.contains('vbuild-tools') && !emsg.contains('vtest-all') {
eprintln('error while moving $tpath to $target_path: $emsg')
}
continue
}

188
cmd/tools/vbump.v Normal file
View File

@@ -0,0 +1,188 @@
// Copyright (c) 2019-2022 Subhomoy Haldar. All rights reserved.
// Use of this source code is governed by an MIT license that can be found in the LICENSE file.
module main
import flag
import os
import regex
import semver
const (
tool_name = os.file_name(os.executable())
tool_version = '0.0.1'
tool_description = '\n Bump the semantic version of the v.mod and/or specified files.
The first instance of a version number is replaced with the new version.
Additionally, the line affected must contain the word "version" in any
form of capitalization. For instance, the following lines will be
recognized by the heuristic:
tool_version = \'1.2.1\'
version: \'0.2.42\'
VERSION = "1.23.8"
Examples:
Bump the patch version in v.mod if it exists
v bump --patch
Bump the major version in v.mod and vls.v
v bump --major v.mod vls.v
Upgrade the minor version in sample.v only
v bump --minor sample.v
'
semver_query = r'((0)|([1-9]\d*)\.){2}(0)|([1-9]\d*)(\-[\w\d\.\-_]+)?(\+[\w\d\.\-_]+)?'
)
struct Options {
show_help bool
major bool
minor bool
patch bool
}
type ReplacementFunction = fn (re regex.RE, input string, start int, end int) string
fn replace_with_increased_patch_version(re regex.RE, input string, start int, end int) string {
version := semver.from(input[start..end]) or { return input }
return version.increment(.patch).str()
}
fn replace_with_increased_minor_version(re regex.RE, input string, start int, end int) string {
version := semver.from(input[start..end]) or { return input }
return version.increment(.minor).str()
}
fn replace_with_increased_major_version(re regex.RE, input string, start int, end int) string {
version := semver.from(input[start..end]) or { return input }
return version.increment(.major).str()
}
fn get_replacement_function(options Options) ReplacementFunction {
if options.patch {
return replace_with_increased_patch_version
} else if options.minor {
return replace_with_increased_minor_version
} else if options.major {
return replace_with_increased_major_version
}
return replace_with_increased_patch_version
}
fn process_file(input_file string, options Options) {
lines := os.read_lines(input_file) or { panic('Failed to read file: $input_file') }
mut re := regex.regex_opt(semver_query) or { panic('Could not create a RegEx parser.') }
repl_fn := get_replacement_function(options)
mut new_lines := []string{cap: lines.len}
mut replacement_complete := false
for line in lines {
// Copy over the remaining lines normally if the replacement is complete
if replacement_complete {
new_lines << line
continue
}
// Check if replacement is necessary
updated_line := if line.to_lower().contains('version') {
replacement_complete = true
re.replace_by_fn(line, repl_fn)
} else {
line
}
new_lines << updated_line
}
// Add a trailing newline
new_lines << ''
backup_file := input_file + '.cache'
// Remove the backup file if it exists.
os.rm(backup_file) or {}
// Rename the original to the backup.
os.mv(input_file, backup_file) or { panic('Failed to copy file: $input_file') }
// Process the old file and write it back to the original.
os.write_file(input_file, new_lines.join_lines()) or {
panic('Failed to write file: $input_file')
}
// Remove the backup file.
os.rm(backup_file) or {}
if replacement_complete {
println('Bumped version in $input_file')
} else {
println('No changes made in $input_file')
}
}
fn main() {
if os.args.len < 2 {
println('Usage: $tool_name [options] [file1 file2 ...]
$tool_description
Try $tool_name -h for more help...')
exit(1)
}
mut fp := flag.new_flag_parser(os.args)
fp.application(tool_name)
fp.version(tool_version)
fp.description(tool_description)
fp.arguments_description('[file1 file2 ...]')
fp.skip_executable()
options := Options{
show_help: fp.bool('help', `h`, false, 'Show this help text.')
patch: fp.bool('patch', `p`, false, 'Bump the patch version.')
minor: fp.bool('minor', `n`, false, 'Bump the minor version.')
major: fp.bool('major', `m`, false, 'Bump the major version.')
}
if options.show_help {
println(fp.usage())
exit(0)
}
validate_options(options) or { panic(err) }
files := os.args[3..]
if files.len == 0 {
if !os.exists('v.mod') {
println('v.mod does not exist. You can create one using "v init".')
exit(1)
}
process_file('v.mod', options)
}
for input_file in files {
if !os.exists(input_file) {
println('File not found: $input_file')
exit(1)
}
process_file(input_file, options)
}
}
fn validate_options(options Options) ? {
if options.patch && options.major {
return error('Cannot specify both --patch and --major.')
}
if options.patch && options.minor {
return error('Cannot specify both --patch and --minor.')
}
if options.major && options.minor {
return error('Cannot specify both --major and --minor.')
}
if !(options.patch || options.major || options.minor) {
return error('Must specify one of --patch, --major, or --minor.')
}
}

101
cmd/tools/vbump_test.v Normal file
View File

@@ -0,0 +1,101 @@
import os
const vexe = @VEXE
const tfolder = os.join_path(os.temp_dir(), 'v', 'vbump')
fn testsuite_begin() {
os.mkdir_all(tfolder) or {}
}
fn testsuite_end() {
os.rmdir_all(tfolder) or {}
}
struct BumpTestCase {
file_name string
contents string
line int
expected_patch string
expected_minor string
expected_major string
}
const test_cases = [
BumpTestCase{
file_name: 'v.mod'
contents: "Module {
name: 'Sample'
description: 'Sample project'
version: '1.2.6'
license: 'MIT'
dependencies: []
}
"
line: 3
expected_patch: " version: '1.2.7'"
expected_minor: " version: '1.3.0'"
expected_major: " version: '2.0.0'"
},
BumpTestCase{
file_name: 'random_versions.vv'
contents: "
1.1.2
1.2.5
3.21.73
version = '1.5.1'
"
line: 4
expected_patch: "version = '1.5.2'"
expected_minor: "version = '1.6.0'"
expected_major: "version = '2.0.0'"
},
BumpTestCase{
file_name: 'sample_tool.v'
contents: "// Module comment and copyright information
import os
import flag
const (
tool_name = os.file_name(os.executable())
tool_version = '0.1.33'
)
fn main() {
// stuff
}
"
line: 6
expected_patch: " tool_version = '0.1.34'"
expected_minor: " tool_version = '0.2.0'"
expected_major: " tool_version = '1.0.0'"
},
]
fn run_individual_test(case BumpTestCase) ! {
test_file := os.join_path_single(tfolder, case.file_name)
os.rm(test_file) or {}
os.write_file(test_file, case.contents)!
//
os.execute_or_exit('${os.quoted_path(vexe)} bump --patch ${os.quoted_path(test_file)}')
patch_lines := os.read_lines(test_file)!
assert patch_lines[case.line] == case.expected_patch
os.execute_or_exit('${os.quoted_path(vexe)} bump --minor ${os.quoted_path(test_file)}')
minor_lines := os.read_lines(test_file)!
assert minor_lines[case.line] == case.expected_minor
os.execute_or_exit('${os.quoted_path(vexe)} bump --major ${os.quoted_path(test_file)}')
major_lines := os.read_lines(test_file)!
assert major_lines[case.line] == case.expected_major
//
os.rm(test_file)!
}
fn test_all_bump_cases() {
for case in test_cases {
run_individual_test(case) or { panic(err) }
}
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2019-2021 Alexander Medvednikov. All rights reserved.
// Copyright (c) 2019-2022 Alexander Medvednikov. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
module main
@@ -8,15 +8,22 @@ import os.cmdline
import rand
import term
import vhelp
import v.pref
import regex
const (
too_long_line_length = 100
term_colors = term.can_show_color_on_stderr()
hide_warnings = '-hide-warnings' in os.args || '-w' in os.args
show_progress = os.getenv('GITHUB_JOB') == '' && '-silent' !in os.args
non_option_args = cmdline.only_non_options(os.args[2..])
too_long_line_length_example = 120
too_long_line_length_codeblock = 120
too_long_line_length_table = 120
too_long_line_length_link = 150
too_long_line_length_other = 100
term_colors = term.can_show_color_on_stderr()
hide_warnings = '-hide-warnings' in os.args || '-w' in os.args
show_progress = os.getenv('GITHUB_JOB') == '' && '-silent' !in os.args
non_option_args = cmdline.only_non_options(os.args[2..])
is_verbose = os.getenv('VERBOSE') != ''
vcheckfolder = os.join_path(os.temp_dir(), 'v', 'vcheck_$os.getuid()')
should_autofix = os.getenv('VAUTOFIX') != ''
vexe = @VEXE
)
struct CheckResult {
@@ -52,6 +59,10 @@ fn main() {
if term_colors {
os.setenv('VCOLORS', 'always', true)
}
os.mkdir_all(vcheckfolder, mode: 0o700) or {} // keep directory private
defer {
os.rmdir_all(vcheckfolder) or {}
}
for i := 0; i < files_paths.len; i++ {
file_path := files_paths[i]
if os.is_dir(file_path) {
@@ -71,7 +82,7 @@ fn main() {
res += mdfile.check()
}
if res.errors == 0 && show_progress {
term.clear_previous_line()
clear_previous_line()
}
if res.warnings > 0 || res.errors > 0 || res.oks > 0 {
println('\nWarnings: $res.warnings | Errors: $res.errors | OKs: $res.oks')
@@ -127,9 +138,7 @@ fn eline(file_path string, lnumber int, column int, message string) string {
return btext('$file_path:${lnumber + 1}:${column + 1}:') + btext(rtext(' error: $message'))
}
const (
default_command = 'compile'
)
const default_command = 'compile'
struct VCodeExample {
mut:
@@ -146,9 +155,9 @@ enum MDFileParserState {
}
struct MDFile {
path string
lines []string
path string
mut:
lines []string
examples []VCodeExample
current VCodeExample
state MDFileParserState = .markdown
@@ -156,7 +165,7 @@ mut:
fn (mut f MDFile) progress(message string) {
if show_progress {
term.clear_previous_line()
clear_previous_line()
println('File: ${f.path:-30s}, Lines: ${f.lines.len:5}, $message')
}
}
@@ -166,28 +175,34 @@ fn (mut f MDFile) check() CheckResult {
mut anchor_data := AnchorData{}
for j, line in f.lines {
// f.progress('line: $j')
if line.len > too_long_line_length {
if f.state == .vexample {
wprintln(wline(f.path, j, line.len, 'long V example line'))
if f.state == .vexample {
if line.len > too_long_line_length_example {
wprintln(wline(f.path, j, line.len, 'example lines must be less than $too_long_line_length_example characters'))
wprintln(line)
res.warnings++
} else if f.state == .codeblock {
wprintln(wline(f.path, j, line.len, 'long code block line'))
wprintln(line)
res.warnings++
} else if line.starts_with('|') {
wprintln(wline(f.path, j, line.len, 'long table'))
wprintln(line)
res.warnings++
} else if line.contains('https') {
wprintln(wline(f.path, j, line.len, 'long link'))
wprintln(line)
res.warnings++
} else {
eprintln(eline(f.path, j, line.len, 'line too long'))
eprintln(line)
res.errors++
}
} else if f.state == .codeblock {
if line.len > too_long_line_length_codeblock {
wprintln(wline(f.path, j, line.len, 'code lines must be less than $too_long_line_length_codeblock characters'))
wprintln(line)
res.warnings++
}
} else if line.starts_with('|') {
if line.len > too_long_line_length_table {
wprintln(wline(f.path, j, line.len, 'table lines must be less than $too_long_line_length_table characters'))
wprintln(line)
res.warnings++
}
} else if line.contains('http') {
if line.all_after('https').len > too_long_line_length_link {
wprintln(wline(f.path, j, line.len, 'link lines must be less than $too_long_line_length_link characters'))
wprintln(line)
res.warnings++
}
} else if line.len > too_long_line_length_other {
eprintln(eline(f.path, j, line.len, 'must be less than $too_long_line_length_other characters'))
eprintln(line)
res.errors++
}
if f.state == .markdown {
anchor_data.add_links(j, line)
@@ -328,7 +343,7 @@ fn (mut ad AnchorData) check_link_target_match(fpath string, mut res CheckResult
}
}
for link, anchor_lists in ad.anchors {
if !(link in checked_headlines) {
if link !in checked_headlines {
if anchor_lists.len > 1 {
for anchor in anchor_lists {
line := match anchor {
@@ -384,6 +399,7 @@ fn (mut f MDFile) debug() {
}
fn cmdexecute(cmd string) int {
verbose_println(cmd)
res := os.execute(cmd)
if res.exit_code < 0 {
return 1
@@ -395,19 +411,19 @@ fn cmdexecute(cmd string) int {
}
fn silent_cmdexecute(cmd string) int {
verbose_println(cmd)
res := os.execute(cmd)
return res.exit_code
}
fn get_fmt_exit_code(vfile string, vexe string) int {
return silent_cmdexecute('"$vexe" fmt -verify $vfile')
return silent_cmdexecute('${os.quoted_path(vexe)} fmt -verify ${os.quoted_path(vfile)}')
}
fn (mut f MDFile) check_examples() CheckResult {
mut errors := 0
mut oks := 0
vexe := pref.vexe_path()
for e in f.examples {
recheck_all_examples: for e in f.examples {
if e.command == 'ignore' {
continue
}
@@ -416,7 +432,9 @@ fn (mut f MDFile) check_examples() CheckResult {
}
fname := os.base(f.path).replace('.md', '_md')
uid := rand.ulid()
vfile := os.join_path(os.temp_dir(), 'check_${fname}_example_${e.sline}__${e.eline}__${uid}.v')
cfile := os.join_path(vcheckfolder, '${uid}.c')
vfile := os.join_path(vcheckfolder, 'check_${fname}_example_${e.sline}__${e.eline}__${uid}.v')
efile := os.join_path(vcheckfolder, 'check_${fname}_example_${e.sline}__${e.eline}__${uid}.exe')
mut should_cleanup_vfile := true
// eprintln('>>> checking example $vfile ...')
vcontent := e.text.join('\n') + '\n'
@@ -428,14 +446,33 @@ fn (mut f MDFile) check_examples() CheckResult {
fmt_res := if nofmt { 0 } else { get_fmt_exit_code(vfile, vexe) }
match command {
'compile' {
res := cmdexecute('"$vexe" -w -Wfatal-errors -o x.c $vfile')
os.rm('x.c') or {}
res := cmdexecute('${os.quoted_path(vexe)} -w -Wfatal-errors -o ${os.quoted_path(efile)} ${os.quoted_path(vfile)}')
if res != 0 || fmt_res != 0 {
if res != 0 {
eprintln(eline(f.path, e.sline, 0, 'example failed to compile'))
}
if fmt_res != 0 {
eprintln(eline(f.path, e.sline, 0, 'example is not formatted'))
f.report_not_formatted_example_if_needed(e, fmt_res, vfile) or {
unsafe {
goto recheck_all_examples
}
}
eprintln(vcontent)
should_cleanup_vfile = false
errors++
continue
}
oks++
}
'cgen' {
res := cmdexecute('${os.quoted_path(vexe)} -w -Wfatal-errors -o ${os.quoted_path(cfile)} ${os.quoted_path(vfile)}')
if res != 0 || fmt_res != 0 {
if res != 0 {
eprintln(eline(f.path, e.sline, 0, 'example failed to generate C code'))
}
f.report_not_formatted_example_if_needed(e, fmt_res, vfile) or {
unsafe {
goto recheck_all_examples
}
}
eprintln(vcontent)
should_cleanup_vfile = false
@@ -445,14 +482,15 @@ fn (mut f MDFile) check_examples() CheckResult {
oks++
}
'globals' {
res := cmdexecute('"$vexe" -w -Wfatal-errors -enable-globals -o x.c $vfile')
os.rm('x.c') or {}
res := cmdexecute('${os.quoted_path(vexe)} -w -Wfatal-errors -enable-globals -o ${os.quoted_path(cfile)} ${os.quoted_path(vfile)}')
if res != 0 || fmt_res != 0 {
if res != 0 {
eprintln(eline(f.path, e.sline, 0, '`example failed to compile with -enable-globals'))
}
if fmt_res != 0 {
eprintln(eline(f.path, e.sline, 0, '`example is not formatted'))
f.report_not_formatted_example_if_needed(e, fmt_res, vfile) or {
unsafe {
goto recheck_all_examples
}
}
eprintln(vcontent)
should_cleanup_vfile = false
@@ -462,13 +500,15 @@ fn (mut f MDFile) check_examples() CheckResult {
oks++
}
'live' {
res := cmdexecute('"$vexe" -w -Wfatal-errors -live -o x.c $vfile')
res := cmdexecute('${os.quoted_path(vexe)} -w -Wfatal-errors -live -o ${os.quoted_path(cfile)} ${os.quoted_path(vfile)}')
if res != 0 || fmt_res != 0 {
if res != 0 {
eprintln(eline(f.path, e.sline, 0, 'example failed to compile with -live'))
}
if fmt_res != 0 {
eprintln(eline(f.path, e.sline, 0, 'example is not formatted'))
f.report_not_formatted_example_if_needed(e, fmt_res, vfile) or {
unsafe {
goto recheck_all_examples
}
}
eprintln(vcontent)
should_cleanup_vfile = false
@@ -478,14 +518,15 @@ fn (mut f MDFile) check_examples() CheckResult {
oks++
}
'failcompile' {
res := silent_cmdexecute('"$vexe" -w -Wfatal-errors -o x.c $vfile')
os.rm('x.c') or {}
res := silent_cmdexecute('${os.quoted_path(vexe)} -w -Wfatal-errors -o ${os.quoted_path(cfile)} ${os.quoted_path(vfile)}')
if res == 0 || fmt_res != 0 {
if res == 0 {
eprintln(eline(f.path, e.sline, 0, '`failcompile` example compiled'))
}
if fmt_res != 0 {
eprintln(eline(f.path, e.sline, 0, 'example is not formatted'))
f.report_not_formatted_example_if_needed(e, fmt_res, vfile) or {
unsafe {
goto recheck_all_examples
}
}
eprintln(vcontent)
should_cleanup_vfile = false
@@ -495,13 +536,29 @@ fn (mut f MDFile) check_examples() CheckResult {
oks++
}
'oksyntax' {
res := cmdexecute('"$vexe" -w -Wfatal-errors -check-syntax $vfile')
res := cmdexecute('${os.quoted_path(vexe)} -w -Wfatal-errors -check-syntax ${os.quoted_path(vfile)}')
if res != 0 || fmt_res != 0 {
if res != 0 {
eprintln(eline(f.path, e.sline, 0, '`oksyntax` example with invalid syntax'))
}
if fmt_res != 0 {
eprintln(eline(f.path, e.sline, 0, '`oksyntax` example is not formatted'))
f.report_not_formatted_example_if_needed(e, fmt_res, vfile) or {
unsafe {
goto recheck_all_examples
}
}
eprintln(vcontent)
should_cleanup_vfile = false
errors++
continue
}
oks++
}
'okfmt' {
if fmt_res != 0 {
f.report_not_formatted_example_if_needed(e, fmt_res, vfile) or {
unsafe {
goto recheck_all_examples
}
}
eprintln(vcontent)
should_cleanup_vfile = false
@@ -511,7 +568,7 @@ fn (mut f MDFile) check_examples() CheckResult {
oks++
}
'badsyntax' {
res := silent_cmdexecute('"$vexe" -w -Wfatal-errors -check-syntax $vfile')
res := silent_cmdexecute('${os.quoted_path(vexe)} -w -Wfatal-errors -check-syntax ${os.quoted_path(vfile)}')
if res == 0 {
eprintln(eline(f.path, e.sline, 0, '`badsyntax` example can be parsed fine'))
eprintln(vcontent)
@@ -523,12 +580,14 @@ fn (mut f MDFile) check_examples() CheckResult {
}
'nofmt' {}
else {
eprintln(eline(f.path, e.sline, 0, 'unrecognized command: "$command", use one of: wip/ignore/compile/failcompile/oksyntax/badsyntax'))
eprintln(eline(f.path, e.sline, 0, 'unrecognized command: "$command", use one of: wip/ignore/compile/cgen/failcompile/okfmt/oksyntax/badsyntax/nofmt'))
should_cleanup_vfile = false
errors++
}
}
}
os.rm(cfile) or {}
os.rm(efile) or {}
if should_cleanup_vfile {
os.rm(vfile) or { panic(err) }
}
@@ -538,3 +597,65 @@ fn (mut f MDFile) check_examples() CheckResult {
oks: oks
}
}
fn verbose_println(message string) {
if is_verbose {
println(message)
}
}
fn clear_previous_line() {
if is_verbose {
return
}
term.clear_previous_line()
}
fn (mut f MDFile) report_not_formatted_example_if_needed(e VCodeExample, fmt_res int, vfile string) ! {
if fmt_res == 0 {
return
}
eprintln(eline(f.path, e.sline, 0, 'example is not formatted'))
if !should_autofix {
return
}
f.autofix_example(e, vfile) or {
if err is ExampleWasRewritten {
eprintln('>> f.path: $f.path | example from $e.sline to $e.eline was re-formated by vfmt')
return err
}
eprintln('>> f.path: $f.path | encountered error while autofixing the example: $err')
}
}
struct ExampleWasRewritten {
Error
}
fn (mut f MDFile) autofix_example(e VCodeExample, vfile string) ! {
eprintln('>>> AUTOFIXING f.path: $f.path | e.sline: $e.sline | vfile: $vfile')
res := cmdexecute('${os.quoted_path(vexe)} fmt -w ${os.quoted_path(vfile)}')
if res != 0 {
return error('could not autoformat the example')
}
formatted_content_lines := os.read_lines(vfile) or { return }
mut new_lines := []string{}
new_lines << f.lines#[0..e.sline + 1]
new_lines << formatted_content_lines
new_lines << f.lines#[e.eline..]
f.update_examples(new_lines)!
os.rm(vfile) or {}
f.examples = f.examples.filter(it.sline >= e.sline)
return ExampleWasRewritten{}
}
fn (mut f MDFile) update_examples(new_lines []string) ! {
os.write_file(f.path, new_lines.join('\n'))!
f.lines = new_lines
f.examples = []
f.current = VCodeExample{}
f.state = .markdown
for j, line in f.lines {
f.parse_line(j, line)
}
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2019-2021 Alexander Medvednikov. All rights reserved.
// Copyright (c) 2019-2022 Alexander Medvednikov. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
//
@@ -44,36 +44,77 @@ import os
const (
auto_complete_shells = ['bash', 'fish', 'zsh', 'powershell'] // list of supported shells
vexe = os.getenv('VEXE')
help_text = "Usage:
v complete [options] [SUBCMD] QUERY...
Description:
Tool for bridging auto completion between various shells and v
Supported shells:
bash, fish, zsh, powershell
Examples:
Echo auto-detected shell install script to STDOUT
v complete
Echo specific shell install script to STDOUT
v complete setup bash
Auto complete input `v tes`*USER PUSHES TAB* (in Bash compatible format).
This is not meant for manual invocation - it's called by the relevant
shell via the script installed with `v complete` or `v complete setup SHELL`.
v complete bash v tes
Options:
-h, --help Show this help text.
SUBCMD:
setup : setup [SHELL] - returns the code for completion setup for SHELL
bash : [QUERY] - returns Bash compatible completion code with completions computed from QUERY
fish : [QUERY] - returns Fish compatible completion code with completions computed from QUERY
zsh : [QUERY] - returns ZSH compatible completion code with completions computed from QUERY
powershell: [QUERY] - returns PowerShell compatible completion code with completions computed from QUERY"
)
// Snooped from cmd/v/v.v, vlib/v/pref/pref.v
const (
auto_complete_commands = [
auto_complete_commands = [
// simple_cmd
'fmt',
'up',
'vet',
'self',
'tracev',
'symlink',
'bin2v',
'test',
'test-fmt',
'test-self',
'test-cleancode',
'repl',
'complete',
'build-tools',
'build-examples',
'build-vbinaries',
'setup-freetype',
'ast',
'doc',
'vet',
// tools in one .v file
'bin2v',
'bug',
'build-examples',
'build-tools',
'build-vbinaries',
'bump',
'check-md',
'complete',
'compress',
'create',
'doctor',
'fmt',
'gret',
'ls',
'repl',
'self',
'setup-freetype',
'shader',
'symlink',
'test-all',
'test-cleancode',
'test-fmt',
'test-parser',
'test-self',
'test',
'tracev',
'up',
'watch',
'wipe-cache',
// commands
'help',
'new',
'init',
'complete',
'translate',
'self',
'search',
@@ -89,11 +130,17 @@ const (
'run',
'build',
'build-module',
'missdoc',
]
auto_complete_flags = [
// Entries in the flag arrays below should be entered as is:
// * Short flags, e.g.: "-v", should be entered: '-v'
// * Long flags, e.g.: "--version", should be entered: '--version'
// * Single-dash flags, e.g.: "-version", should be entered: '-version'
auto_complete_flags = [
'-apk',
'-show-timings',
'-check-syntax',
'-check',
'-v',
'-progress',
'-silent',
@@ -108,6 +155,7 @@ const (
'-autofree',
'-compress',
'-freestanding',
'-no-parallel',
'-no-preludes',
'-prof',
'-profile',
@@ -131,6 +179,7 @@ const (
'-w',
'-print-v-files',
'-error-limit',
'-message-limit',
'-os',
'-printfn',
'-cflags',
@@ -147,7 +196,7 @@ const (
'-version',
'--version',
]
auto_complete_flags_doc = [
auto_complete_flags_doc = [
'-all',
'-f',
'-h',
@@ -160,12 +209,13 @@ const (
'-pos',
'-no-timestamp',
'-inline-assets',
'-theme-dir',
'-open',
'-p',
'-s',
'-l',
]
auto_complete_flags_fmt = [
auto_complete_flags_fmt = [
'-c',
'-diff',
'-l',
@@ -173,7 +223,7 @@ const (
'-debug',
'-verify',
]
auto_complete_flags_bin2v = [
auto_complete_flags_bin2v = [
'-h',
'--help',
'-m',
@@ -183,10 +233,46 @@ const (
'-w',
'--write',
]
auto_complete_flags_self = [
auto_complete_flags_shader = [
'--help',
'-h',
'--force-update',
'-u',
'--verbose',
'-v',
'--slang',
'-l',
'--output',
'-o',
]
auto_complete_flags_missdoc = [
'--help',
'-h',
'--tags',
'-t',
'--deprecated',
'-d',
'--private',
'-p',
'--no-line-numbers',
'-n',
'--exclude',
'-e',
'--relative-paths',
'-r',
'--js',
'--verify',
'--diff',
]
auto_complete_flags_bump = [
'--patch',
'--minor',
'--major',
]
auto_complete_flags_self = [
'-prod',
]
auto_complete_compilers = [
auto_complete_compilers = [
'cc',
'gcc',
'tcc',
@@ -202,6 +288,16 @@ const (
fn auto_complete(args []string) {
if args.len <= 1 || args[0] != 'complete' {
if args.len == 1 {
shell_path := os.getenv('SHELL')
if shell_path.len > 0 {
shell_name := os.file_name(shell_path).to_lower()
if shell_name in auto_complete_shells {
println(setup_for_shell(shell_name))
exit(0)
}
eprintln('Unknown shell ${shell_name}. Supported shells are: $auto_complete_shells')
exit(1)
}
eprintln('auto completion require arguments to work.')
} else {
eprintln('auto completion failed for "$args".')
@@ -217,62 +313,7 @@ fn auto_complete(args []string) {
exit(1)
}
shell := sub_args[1]
mut setup := ''
match shell {
'bash' {
setup = '
_v_completions() {
local src
local limit
# Send all words up to the word the cursor is currently on
let limit=1+\$COMP_CWORD
src=\$($vexe complete bash \$(printf "%s\\n" \${COMP_WORDS[@]: 0:\$limit}))
if [[ \$? == 0 ]]; then
eval \${src}
#echo \${src}
fi
}
complete -o nospace -F _v_completions v
'
}
'fish' {
setup = '
function __v_completions
# Send all words up to the one before the cursor
$vexe complete fish (commandline -cop)
end
complete -f -c v -a "(__v_completions)"
'
}
'zsh' {
setup = '
#compdef v
_v() {
local src
# Send all words up to the word the cursor is currently on
src=\$($vexe complete zsh \$(printf "%s\\n" \${(@)words[1,\$CURRENT]}))
if [[ \$? == 0 ]]; then
eval \${src}
#echo \${src}
fi
}
compdef _v v
'
}
'powershell' {
setup = '
Register-ArgumentCompleter -Native -CommandName v -ScriptBlock {
param(\$commandName, \$wordToComplete, \$cursorPosition)
$vexe complete powershell "\$wordToComplete" | ForEach-Object {
[System.Management.Automation.CompletionResult]::new(\$_, \$_, \'ParameterValue\', \$_)
}
}
'
}
else {}
}
println(setup)
println(setup_for_shell(shell))
}
'bash' {
if sub_args.len <= 1 {
@@ -307,6 +348,9 @@ Register-ArgumentCompleter -Native -CommandName v -ScriptBlock {
}
println(lines.join('\n'))
}
'-h', '--help' {
println(help_text)
}
else {}
}
exit(0)
@@ -321,12 +365,26 @@ fn append_separator_if_dir(path string) string {
return path
}
// nearest_path_or_root returns the nearest valid path searching
// backwards from `path`.
fn nearest_path_or_root(path string) string {
mut fixed_path := path
if !os.is_dir(fixed_path) {
fixed_path = path.all_before_last(os.path_separator)
if fixed_path == '' {
fixed_path = '/'
}
}
return fixed_path
}
// auto_complete_request retuns a list of completions resolved from a full argument list.
fn auto_complete_request(args []string) []string {
// Using space will ensure a uniform input in cases where the shell
// returns the completion input as a string (['v','run'] vs. ['v run']).
split_by := ' '
request := args.join(split_by)
mut do_home_expand := false
mut list := []string{}
// new_part := request.ends_with('\n\n')
mut parts := request.trim_right(' ').split(split_by)
@@ -335,7 +393,7 @@ fn auto_complete_request(args []string) []string {
list << command
}
} else {
part := parts.last().trim(' ')
mut part := parts.last().trim(' ')
mut parent_command := ''
for i := parts.len - 1; i >= 0; i-- {
if parts[i].starts_with('-') {
@@ -344,12 +402,17 @@ fn auto_complete_request(args []string) []string {
parent_command = parts[i]
break
}
get_flags := fn (base []string, flag string) []string {
if flag.len == 1 { return base
} else { return base.filter(it.starts_with(flag))
}
}
if part.starts_with('-') { // 'v -<tab>' -> flags.
if part.starts_with('-') { // 'v [subcmd] -<tab>' or 'v [subcmd] --<tab>'-> flags.
get_flags := fn (base []string, flag string) []string {
mut results := []string{}
for entry in base {
if entry.starts_with(flag) {
results << entry
}
}
return results
}
match parent_command {
'bin2v' { // 'v bin2v -<tab>'
list = get_flags(auto_complete_flags_bin2v, part)
@@ -366,6 +429,15 @@ fn auto_complete_request(args []string) []string {
'self' { // 'v self -<tab>' -> flags.
list = get_flags(auto_complete_flags_self, part)
}
'shader' { // 'v shader -<tab>' -> flags.
list = get_flags(auto_complete_flags_shader, part)
}
'missdoc' { // 'v missdoc -<tab>' -> flags.
list = get_flags(auto_complete_flags_missdoc, part)
}
'bump' { // 'v bump -<tab>' -> flags.
list = get_flags(auto_complete_flags_bump, part)
}
else {
for flag in auto_complete_flags {
if flag == part {
@@ -383,6 +455,11 @@ fn auto_complete_request(args []string) []string {
}
}
}
// Clear the list if the result is identical to the part examined
// (the flag must have already been completed)
if list.len == 1 && part == list[0] {
list.clear()
}
} else {
match part {
'help' { // 'v help <tab>' -> top level commands except "help".
@@ -405,17 +482,34 @@ fn auto_complete_request(args []string) []string {
mut ls_path := '.'
mut collect_all := part in auto_complete_commands
mut path_complete := false
do_home_expand = part.starts_with('~')
if do_home_expand {
add_sep := if part == '~' { os.path_separator } else { '' }
part = part.replace_once('~', os.home_dir().trim_right(os.path_separator)) + add_sep
}
is_abs_path := part.starts_with(os.path_separator) // TODO Windows support for drive prefixes
if part.ends_with(os.path_separator) || part == '.' || part == '..' {
// 'v <command>(.*/$|.|..)<tab>' -> output full directory list
ls_path = '.' + os.path_separator + part
if is_abs_path {
ls_path = nearest_path_or_root(part)
}
collect_all = true
} else if !collect_all && part.contains(os.path_separator) && os.is_dir(os.dir(part)) {
// 'v <command>(.*/.* && os.is_dir)<tab>' -> output completion friendly directory list
ls_path = os.dir(part)
if is_abs_path {
ls_path = nearest_path_or_root(part)
} else {
ls_path = os.dir(part)
}
path_complete = true
}
entries := os.ls(ls_path) or { return list }
last := part.all_after_last(os.path_separator)
mut last := part.all_after_last(os.path_separator)
if is_abs_path && os.is_dir(part) {
last = ''
}
if path_complete {
path := part.all_before_last(os.path_separator)
for entry in entries {
@@ -423,27 +517,80 @@ fn auto_complete_request(args []string) []string {
list << append_separator_if_dir(os.join_path(path, entry))
}
}
// If only one possible file - send full path to completion system.
// Please note that this might be bash specific - needs more testing.
if list.len == 1 {
list = [list[0]]
}
} else {
for entry in entries {
if collect_all {
if collect_all || entry.starts_with(last) {
list << append_separator_if_dir(entry)
} else {
if entry.starts_with(last) {
list << append_separator_if_dir(entry)
}
}
}
}
}
}
if do_home_expand {
return list.map(it.replace_once(os.home_dir().trim_right(os.path_separator), '~'))
}
return list
}
fn setup_for_shell(shell string) string {
mut setup := ''
match shell {
'bash' {
setup = '
_v_completions() {
local src
local limit
# Send all words up to the word the cursor is currently on
let limit=1+\$COMP_CWORD
src=\$($vexe complete bash \$(printf "%s\\n" \${COMP_WORDS[@]: 0:\$limit}))
if [[ \$? == 0 ]]; then
eval \${src}
#echo \${src}
fi
}
complete -o nospace -F _v_completions v
'
}
'fish' {
setup = '
function __v_completions
# Send all words up to the one before the cursor
$vexe complete fish (commandline -cop)
end
complete -f -c v -a "(__v_completions)"
'
}
'zsh' {
setup = '
#compdef v
_v() {
local src
# Send all words up to the word the cursor is currently on
src=\$($vexe complete zsh \$(printf "%s\\n" \${(@)words[1,\$CURRENT]}))
if [[ \$? == 0 ]]; then
eval \${src}
#echo \${src}
fi
}
compdef _v v
'
}
'powershell' {
setup = '
Register-ArgumentCompleter -Native -CommandName v -ScriptBlock {
param(\$commandName, \$wordToComplete, \$cursorPosition)
$vexe complete powershell "\$wordToComplete" | ForEach-Object {
[System.Management.Automation.CompletionResult]::new(\$_, \$_, \'ParameterValue\', \$_)
}
}
'
}
else {}
}
return setup
}
fn main() {
args := os.args[1..]
// println('"$args"')

44
cmd/tools/vcompress.v Normal file
View File

@@ -0,0 +1,44 @@
module main
import compress.zlib
import os
enum CompressionType {
zlib
}
fn main() {
if os.args.len != 5 {
eprintln('v compress <type> <in> <out>')
eprintln('supported types: zlib')
exit(1)
}
compression_type := match os.args[2] {
'zlib' {
CompressionType.zlib
}
else {
eprintln('unsupported type: ${os.args[1]}')
exit(1)
}
}
path := os.args[3]
content := os.read_bytes(path) or {
eprintln('unable to read "$path": $err')
exit(1)
}
compressed := match compression_type {
.zlib {
zlib.compress(content) or {
eprintln('compression error: $err')
exit(1)
}
}
}
out_path := os.args[4]
os.write_file_array(out_path, compressed) or {
eprintln('failed to write "$out_path": $err')
exit(1)
}
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2019-2021 Alexander Medvednikov. All rights reserved.
// Copyright (c) 2019-2022 Alexander Medvednikov. All rights reserved.
// Use of this source code is governed by an MIT license that can be found in the LICENSE file.
module main
@@ -42,50 +42,62 @@ fn check_name(name string) string {
}
fn vmod_content(c Create) string {
return [
'Module {',
" name: '$c.name'",
" description: '$c.description'",
" version: '$c.version'",
" license: '$c.license'",
' dependencies: []',
'}',
'',
].join('\n')
return "Module {
name: '$c.name'
description: '$c.description'
version: '$c.version'
license: '$c.license'
dependencies: []
}
"
}
fn main_content() string {
return [
'module main\n',
'fn main() {',
" println('Hello World!')",
'}',
'',
].join('\n')
return "module main
fn main() {
println('Hello World!')
}
"
}
fn gen_gitignore(name string) string {
return [
'# Binaries for programs and plugins',
'main',
'$name',
'*.exe',
'*.exe~',
'*.so',
'*.dylib',
'*.dll',
'',
].join('\n')
return '# Binaries for programs and plugins
main
$name
*.exe
*.exe~
*.so
*.dylib
*.dll
vls.log
'
}
fn gitattributes_content() string {
return '*.v linguist-language=V text=auto eol=lf
*.vv linguist-language=V text=auto eol=lf
*.vsh linguist-language=V text=auto eol=lf
**/v.mod linguist-language=V text=auto eol=lf
'
}
fn editorconfig_content() string {
return '[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.v]
indent_style = tab
indent_size = 4
'
}
fn (c &Create) write_vmod(new bool) {
vmod_path := if new { '$c.name/v.mod' } else { 'v.mod' }
mut vmod := os.create(vmod_path) or {
cerror(err.msg)
exit(1)
}
vmod.write_string(vmod_content(c)) or { panic(err) }
vmod.close()
os.write_file(vmod_path, vmod_content(c)) or { panic(err) }
}
fn (c &Create) write_main(new bool) {
@@ -93,12 +105,23 @@ fn (c &Create) write_main(new bool) {
return
}
main_path := if new { '$c.name/${c.name}.v' } else { '${c.name}.v' }
mut mainfile := os.create(main_path) or {
cerror(err.msg)
exit(2)
os.write_file(main_path, main_content()) or { panic(err) }
}
fn (c &Create) write_gitattributes(new bool) {
gitattributes_path := if new { '$c.name/.gitattributes' } else { '.gitattributes' }
if !new && os.exists(gitattributes_path) {
return
}
mainfile.write_string(main_content()) or { panic(err) }
mainfile.close()
os.write_file(gitattributes_path, gitattributes_content()) or { panic(err) }
}
fn (c &Create) write_editorconfig(new bool) {
editorconfig_path := if new { '$c.name/.editorconfig' } else { '.editorconfig' }
if !new && os.exists(editorconfig_path) {
return
}
os.write_file(editorconfig_path, editorconfig_content()) or { panic(err) }
}
fn (c &Create) create_git_repo(dir string) {
@@ -110,13 +133,9 @@ fn (c &Create) create_git_repo(dir string) {
exit(4)
}
}
if !os.exists('$dir/.gitignore') {
mut fl := os.create('$dir/.gitignore') or {
// We don't really need a .gitignore, it's just a nice-to-have
return
}
fl.write_string(gen_gitignore(c.name)) or { panic(err) }
fl.close()
gitignore_path := '$dir/.gitignore'
if !os.exists(gitignore_path) {
os.write_file(gitignore_path, gen_gitignore(c.name)) or {}
}
}
@@ -141,7 +160,7 @@ fn create(args []string) {
if c.version == '' {
c.version = default_version
}
default_license := 'MIT'
default_license := os.getenv_opt('VLICENSE') or { 'MIT' }
c.license = os.input('Input your project license: ($default_license) ')
if c.license == '' {
c.license = default_license
@@ -150,22 +169,23 @@ fn create(args []string) {
os.mkdir(c.name) or { panic(err) }
c.write_vmod(true)
c.write_main(true)
c.write_gitattributes(true)
c.write_editorconfig(true)
c.create_git_repo(c.name)
}
fn init_project() {
if os.exists('v.mod') {
cerror('`v init` cannot be run on existing v modules')
exit(3)
}
mut c := Create{}
c.name = check_name(os.file_name(os.getwd()))
c.description = ''
c.write_vmod(false)
if !os.exists('v.mod') {
c.description = ''
c.write_vmod(false)
println('Change the description of your project in `v.mod`')
}
c.write_main(false)
c.write_gitattributes(false)
c.write_editorconfig(false)
c.create_git_repo('.')
println('Change the description of your project in `v.mod`')
}
fn main() {

View File

@@ -1,20 +1,19 @@
import os
const test_path = 'vcreate_test'
const test_path = os.join_path(os.temp_dir(), 'v', 'vcreate_test')
fn init_and_check() ? {
vexe := @VEXE
os.execute_or_exit('$vexe init')
fn init_and_check() ! {
os.execute_or_exit('${os.quoted_path(@VEXE)} init')
assert os.read_file('vcreate_test.v') ? == [
assert os.read_file('vcreate_test.v')! == [
'module main\n',
'fn main() {',
" println('Hello World!')",
'}',
'',
].join('\n')
].join_lines()
assert os.read_file('v.mod') ? == [
assert os.read_file('v.mod')! == [
'Module {',
" name: 'vcreate_test'",
" description: ''",
@@ -23,9 +22,9 @@ fn init_and_check() ? {
' dependencies: []',
'}',
'',
].join('\n')
].join_lines()
assert os.read_file('.gitignore') ? == [
assert os.read_file('.gitignore')! == [
'# Binaries for programs and plugins',
'main',
'vcreate_test',
@@ -34,46 +33,77 @@ fn init_and_check() ? {
'*.so',
'*.dylib',
'*.dll',
'vls.log',
'',
].join('\n')
].join_lines()
assert os.read_file('.gitattributes')! == [
'*.v linguist-language=V text=auto eol=lf',
'*.vv linguist-language=V text=auto eol=lf',
'*.vsh linguist-language=V text=auto eol=lf',
'**/v.mod linguist-language=V text=auto eol=lf',
'',
].join_lines()
assert os.read_file('.editorconfig')! == [
'[*]',
'charset = utf-8',
'end_of_line = lf',
'insert_final_newline = true',
'trim_trailing_whitespace = true',
'',
'[*.v]',
'indent_style = tab',
'indent_size = 4',
'',
].join_lines()
}
fn test_v_init() ? {
dir := os.join_path(os.temp_dir(), test_path)
os.rmdir_all(dir) or {}
os.mkdir(dir) or {}
defer {
os.rmdir_all(dir) or {}
}
os.chdir(dir)
init_and_check() ?
fn prepare_test_path() ! {
os.rmdir_all(test_path) or {}
os.mkdir_all(test_path) or {}
os.chdir(test_path)!
}
fn test_v_init_in_git_dir() ? {
dir := os.join_path(os.temp_dir(), test_path)
os.rmdir_all(dir) or {}
os.mkdir(dir) or {}
defer {
os.rmdir_all(dir) or {}
}
os.chdir(dir)
fn test_v_init() {
prepare_test_path()!
init_and_check()!
}
fn test_v_init_in_git_dir() {
prepare_test_path()!
os.execute_or_exit('git init .')
init_and_check() ?
init_and_check()!
}
fn test_v_init_no_overwrite_gitignore() ? {
dir := os.join_path(os.temp_dir(), test_path)
os.rmdir_all(dir) or {}
os.mkdir(dir) or {}
os.write_file('$dir/.gitignore', 'blah') ?
defer {
os.rmdir_all(dir) or {}
}
os.chdir(dir)
vexe := @VEXE
os.execute_or_exit('$vexe init')
assert os.read_file('.gitignore') ? == 'blah'
fn test_v_init_no_overwrite_gitignore() {
prepare_test_path()!
os.write_file('.gitignore', 'blah')!
os.execute_or_exit('${os.quoted_path(@VEXE)} init')
assert os.read_file('.gitignore')! == 'blah'
}
fn test_v_init_no_overwrite_gitattributes_and_editorconfig() {
git_attributes_content := '*.v linguist-language=V text=auto eol=lf'
editor_config_content := '[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.v]
indent_style = tab
indent_size = 4
'
prepare_test_path()!
os.write_file('.gitattributes', git_attributes_content)!
os.write_file('.editorconfig', editor_config_content)!
os.execute_or_exit('${os.quoted_path(@VEXE)} init')
assert os.read_file('.gitattributes')! == git_attributes_content
assert os.read_file('.editorconfig')! == editor_config_content
}
fn testsuite_end() {
os.rmdir_all(test_path) or {}
}

View File

@@ -4,6 +4,7 @@ import os
import net.urllib
import strings
import markdown
import regex
import v.scanner
import v.ast
import v.token
@@ -11,68 +12,13 @@ import v.doc
import v.pref
const (
css_js_assets = ['doc.css', 'normalize.css', 'doc.js', 'dark-mode.js']
res_path = os.resource_abs_path('resources')
favicons_path = os.join_path(res_path, 'favicons')
link_svg = '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg>'
html_content = '<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="x-ua-compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ title }} | vdoc</title>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Work+Sans:wght@400;500;600&display=swap" rel="stylesheet">
<link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png">
<link rel="manifest" href="site.webmanifest">
<link rel="mask-icon" href="safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">
{{ head_assets }}
</head>
<body>
<div id="page">
<header class="doc-nav hidden">
<div class="heading-container">
<div class="heading">
<div class="info">
<div class="module">{{ head_name }}</div>
<div class="toggle-version-container">
<span>{{ version }}</span>
<div id="dark-mode-toggle" role="switch" aria-checked="false" aria-label="Toggle dark mode">{{ light_icon }}{{ dark_icon }}</div>
</div>
{{ menu_icon }}
</div>
<input type="text" id="search" placeholder="Search... (beta)" autocomplete="off">
</div>
</div>
<nav class="search hidden"></nav>
<nav class="content hidden">
<ul>
{{ toc_links }}
</ul>
</nav>
</header>
<div class="doc-scrollview">
<div class="doc-container">
<div class="doc-content">
{{ contents }}
<div class="footer">
{{ footer_content }}
</div>
</div>
{{ right_content }}
</div>
</div>
</div>
{{ footer_assets }}
<script async src="search_index.js" type="text/javascript"></script>
</body>
</html>'
css_js_assets = ['doc.css', 'normalize.css', 'doc.js', 'dark-mode.js']
default_theme = os.resource_abs_path('theme')
link_svg = '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg>'
single_quote = "'"
double_quote = '"'
no_quotes_replacement = [single_quote, '', double_quote, '']
)
enum HighlightTokenTyp {
@@ -133,7 +79,7 @@ fn (vd VDoc) render_search_index(out Output) {
}
fn (mut vd VDoc) render_static_html(out Output) {
vd.assets = map{
vd.assets = {
'doc_css': vd.get_resource(css_js_assets[0], out)
'normalize_css': vd.get_resource(css_js_assets[1], out)
'doc_js': vd.get_resource(css_js_assets[2], out)
@@ -147,7 +93,7 @@ fn (mut vd VDoc) render_static_html(out Output) {
fn (vd VDoc) get_resource(name string, out Output) string {
cfg := vd.cfg
path := os.join_path(res_path, name)
path := os.join_path(cfg.theme_dir, name)
mut res := os.read_file(path) or { panic('vdoc: could not read $path') }
/*
if minify {
@@ -251,7 +197,8 @@ fn (vd VDoc) gen_html(d doc.Doc) string {
write_toc(cn, mut symbols_toc)
} // write head
// write css
version := if vd.manifest.version.len != 0 { vd.manifest.version } else { '' }
mut version := if vd.manifest.version.len != 0 { vd.manifest.version } else { '' }
version = [version, @VHASH].join(' ')
header_name := if cfg.is_multi && vd.docs.len > 1 {
os.file_name(os.real_path(cfg.input_path))
} else {
@@ -297,8 +244,9 @@ fn (vd VDoc) gen_html(d doc.Doc) string {
}
modules_toc_str := modules_toc.str()
symbols_toc_str := symbols_toc.str()
result := html_content.replace('{{ title }}', d.head.name).replace('{{ head_name }}',
header_name).replace('{{ version }}', version).replace('{{ light_icon }}', vd.assets['light_icon']).replace('{{ dark_icon }}',
result := (os.read_file(os.join_path(cfg.theme_dir, 'index.html')) or { panic(err) }).replace('{{ title }}',
d.head.name).replace('{{ head_name }}', header_name).replace('{{ version }}',
version).replace('{{ light_icon }}', vd.assets['light_icon']).replace('{{ dark_icon }}',
vd.assets['dark_icon']).replace('{{ menu_icon }}', vd.assets['menu_icon']).replace('{{ head_assets }}',
if cfg.inline_assets {
'\n${tabs[0]}<style>' + vd.assets['doc_css'] + '</style>\n${tabs[0]}<style>' +
@@ -354,6 +302,8 @@ fn html_highlight(code string, tb &ast.Table) string {
"'$tok.lit'"
} else if typ == .char {
'`$tok.lit`'
} else if typ == .comment {
if tok.lit != '' && tok.lit[0] == 1 { '//${tok.lit[1..]}' } else { '//$tok.lit' }
} else {
tok.lit
}
@@ -376,7 +326,8 @@ fn html_highlight(code string, tb &ast.Table) string {
tok_typ = .builtin
} else if next_tok.kind == .lcbr {
tok_typ = .symbol
} else if next_tok.kind == .lpar {
} else if next_tok.kind == .lpar || (!tok.lit[0].is_capital()
&& next_tok.kind == .lt && next_tok.pos == tok.pos + tok.lit.len) {
tok_typ = .function
} else {
tok_typ = .name
@@ -397,14 +348,15 @@ fn html_highlight(code string, tb &ast.Table) string {
.key_true, .key_false {
tok_typ = .boolean
}
.lpar, .lcbr, .rpar, .rcbr, .lsbr, .rsbr, .semicolon, .colon, .comma, .dot {
.lpar, .lcbr, .rpar, .rcbr, .lsbr, .rsbr, .semicolon, .colon, .comma, .dot,
.dotdot, .ellipsis {
tok_typ = .punctuation
}
else {
if token.is_key(tok.lit) || token.is_decl(tok.kind) {
tok_typ = .keyword
} else if tok.kind == .decl_assign || tok.kind.is_assign() || tok.is_unary()
|| tok.kind.is_relational() || tok.kind.is_infix() {
|| tok.kind.is_relational() || tok.kind.is_infix() || tok.kind.is_postfix() {
tok_typ = .operator
}
}
@@ -418,7 +370,7 @@ fn html_highlight(code string, tb &ast.Table) string {
break
}
} else {
buf.write_b(code[i])
buf.write_u8(code[i])
i++
}
}
@@ -441,8 +393,9 @@ fn doc_node_html(dn doc.DocNode, link string, head bool, include_examples bool,
highlighted_code := html_highlight(dn.content, tb)
node_class := if dn.kind == .const_group { ' const' } else { '' }
sym_name := get_sym_name(dn)
has_deprecated := 'deprecated' in dn.tags
mut tags := dn.tags.filter(it != 'deprecated')
mut deprecated_tags := dn.tags.filter(it.starts_with('deprecated'))
deprecated_tags.sort()
mut tags := dn.tags.filter(!it.starts_with('deprecated'))
tags.sort()
mut node_id := get_node_id(dn)
mut hash_link := if !head { ' <a href="#$node_id">#</a>' } else { '' }
@@ -462,13 +415,12 @@ fn doc_node_html(dn doc.DocNode, link string, head bool, include_examples bool,
}
dnw.write_string('</div>')
}
if tags.len > 0 || has_deprecated {
mut attributes := if has_deprecated {
'<div class="attribute attribute-deprecated">deprecated</div>'
} else {
''
}
attributes += tags.map('<div class="attribute">$it</div>').join('')
if deprecated_tags.len > 0 {
attributes := deprecated_tags.map('<div class="attribute attribute-deprecated">${no_quotes(it)}</div>').join('')
dnw.writeln('<div class="attributes">$attributes</div>')
}
if tags.len > 0 {
attributes := tags.map('<div class="attribute">$it</div>').join('')
dnw.writeln('<div class="attributes">$attributes</div>')
}
if !head && dn.content.len > 0 {
@@ -482,8 +434,8 @@ fn doc_node_html(dn doc.DocNode, link string, head bool, include_examples bool,
example_title := if examples.len > 1 { 'Examples' } else { 'Example' }
dnw.writeln('<section class="doc-node examples"><h4>$example_title</h4>')
for example in examples {
// hl_example := html_highlight(example, tb)
dnw.writeln('<pre><code class="language-v">$example</code></pre>')
hl_example := html_highlight(example, tb)
dnw.writeln('<pre><code class="language-v">$hl_example</code></pre>')
}
dnw.writeln('</section>')
}
@@ -493,7 +445,12 @@ fn doc_node_html(dn doc.DocNode, link string, head bool, include_examples bool,
}
fn html_tag_escape(str string) string {
return str.replace_each(['<', '&lt;', '>', '&gt;'])
excaped_string := str.replace_each(['<', '&lt;', '>', '&gt;'])
mut re := regex.regex_opt(r'`.+[(&lt;)(&gt;)].+`') or { regex.RE{} }
if re.find_all_str(excaped_string).len > 0 {
return str
}
return excaped_string
}
/*
@@ -545,3 +502,7 @@ fn write_toc(dn doc.DocNode, mut toc strings.Builder) {
}
toc.writeln('</li>')
}
fn no_quotes(s string) string {
return s.replace_each(no_quotes_replacement)
}

View File

@@ -0,0 +1,6 @@
module main
fn test_html_tag_escape() {
assert html_tag_escape('<abc>') == '&lt;abc&gt;'
assert html_tag_escape('`<abc>`') == '`<abc>`'
}

View File

@@ -47,7 +47,8 @@ fn (vd VDoc) write_markdown_content(contents []doc.DocNode, mut cw strings.Build
}
cw.writeln('```\n')
}
cw.writeln('[\[Return to contents\]](#Contents)\n')
cw.writeln(r'[[Return to contents]](#Contents)')
cw.writeln('')
}
vd.write_markdown_content(cn.children, mut cw, mut hw, indent + 1, with_toc)
}

View File

@@ -0,0 +1,13 @@
module main
const (
source_root = 'temp' // some const
another = int(5) //
)
const (
windowpos_undefined_mask = C.SDL_WINDOWPOS_UNDEFINED_MASK // 0x1FFF0000u
windowpos_undefined = C.SDL_WINDOWPOS_UNDEFINED //
)
Used to indicate that you don't care what the window position is.
fn funky()
funky - comment for function below

View File

@@ -0,0 +1,11 @@
module main
const (
source_root = 'temp' // some const
another = int(5) //
)
const (
windowpos_undefined_mask = C.SDL_WINDOWPOS_UNDEFINED_MASK // 0x1FFF0000u
windowpos_undefined = C.SDL_WINDOWPOS_UNDEFINED //
)
fn funky()

View File

@@ -0,0 +1,15 @@
pub const (
source_root = 'temp' // some const
another = int(5) //
)
// Used to indicate that you don't care what the window position is.
pub const (
windowpos_undefined_mask = C.SDL_WINDOWPOS_UNDEFINED_MASK // 0x1FFF0000u
windowpos_undefined = C.SDL_WINDOWPOS_UNDEFINED //
)
// funky - comment for function below
pub fn funky() {
println('hi')
}

View File

@@ -0,0 +1,9 @@
module main
fn a1()
normal comment
fn a2()
this should be merged into the same line
fn a3()
This should be its own parapgraph, because it ends with a dot.
This should be another paragraph.

View File

@@ -0,0 +1,5 @@
module main
fn a1()
fn a2()
fn a3()

View File

@@ -0,0 +1,16 @@
// normal comment
pub fn a1() {
println('hi')
}
// this should be merged
// into the same line
pub fn a2() {
println('hi')
}
// This should be its own parapgraph, because it ends with a dot.
// This should be another paragraph.
pub fn a3() {
println('hi')
}

View File

@@ -0,0 +1,22 @@
module main
fn funky()
hello
empty line
newline using a full stop.
```v
code
```
test
====
- foo
- bar
# test
########### deep test
#a shouldnt have a newline test
| foo bar | yes |
|-----------|--------|
| working | yup |

View File

@@ -0,0 +1,3 @@
module main
fn funky()

View File

@@ -0,0 +1,23 @@
// hello
//
// empty line
// newline using a full stop.
// ```v
// code
// ```
//
// test
// ====
// - foo
// - bar
// # test
// ########### deep test
// #a shouldnt have a newline
// test
//
// | foo bar | yes |
// |-----------|--------|
// | working | yup |
pub fn funky() {
println('hi')
}

View File

@@ -1 +0,0 @@
vdoc: No documentation found for /v/vmaster/cmd/tools/vdoc/tests/testdata/project1/main.v

View File

@@ -1,8 +0,0 @@
const (
source_root = 'temp'
)
// funky - comment for function below
fn funky() {
println('hi')
}

View File

@@ -16,7 +16,7 @@ fn find_diff_cmd() string {
fn test_vet() {
os.setenv('VCOLORS', 'never', true)
os.chdir(vroot)
os.chdir(vroot)!
test_dir := 'cmd/tools/vdoc/tests/testdata'
main_files := get_main_files_in_dir(test_dir)
fails := check_path(vexe, test_dir, main_files)
@@ -35,7 +35,7 @@ fn check_path(vexe string, dir string, tests []string) int {
for path in paths {
program := path
print(path + ' ')
res := os.execute('$vexe doc $program')
res := os.execute('${os.quoted_path(vexe)} doc ${os.quoted_path(program)}')
if res.exit_code < 0 {
panic(res.output)
}
@@ -43,25 +43,45 @@ fn check_path(vexe string, dir string, tests []string) int {
expected = clean_line_endings(expected)
found := clean_line_endings(res.output)
if expected != found {
println(term.red('FAIL'))
println('============')
println('expected:')
println(expected)
println('============')
println('found:')
println(found)
println('============\n')
println('diff:')
println(diff.color_compare_strings(diff_cmd, rand.ulid(), found, expected))
println('============\n')
nb_fail++
} else {
print_compare(expected, found)
}
res_comments := os.execute('${os.quoted_path(vexe)} doc -comments ${os.quoted_path(program)}')
if res_comments.exit_code < 0 {
panic(res_comments.output)
}
mut expected_comments := os.read_file(program.replace('main.v', 'main.comments.out')) or {
panic(err)
}
expected_comments = clean_line_endings(expected_comments)
found_comments := clean_line_endings(res_comments.output)
if expected_comments != found_comments {
print_compare(expected_comments, found_comments)
}
if expected == found && expected_comments == found_comments {
println(term.green('OK'))
} else {
nb_fail++
}
}
return nb_fail
}
fn print_compare(expected string, found string) {
println(term.red('FAIL'))
println('============')
println('expected:')
println(expected)
println('============')
println('found:')
println(found)
println('============\n')
println('diff:')
println(diff.color_compare_strings(diff_cmd, rand.ulid(), found, expected))
println('============\n')
}
fn clean_line_endings(s string) string {
mut res := s.trim_space()
res = res.replace(' \n', '\n')

View File

Before

Width:  |  Height:  |  Size: 175 B

After

Width:  |  Height:  |  Size: 175 B

Some files were not shown because too many files have changed in this diff Show More