Commit Graph

8031 Commits (b79dd7f0b3c87383281cf8b5f255100eeeb44e87)

Author SHA1 Message Date
Daniel Däschle f6402eae10
checker: check `match` with type alias (#10863) 2021-07-20 15:06:36 +03:00
Daniel Däschle 60b705b4c4
checker, gen: implement basic struct embed direct field init support (#10871) 2021-07-20 15:06:06 +03:00
Daniel Däschle ad3835b598
parser: deprecate short struct init (#10842) 2021-07-20 11:17:08 +03:00
Uwe Krüger de39bba7bd
v.gen.c: fix calling pointer receiver on function return result (#10866) 2021-07-20 08:30:07 +03:00
Delyan Angelov eed4f50d8c
ci: fix sanitize failures with math.big 2021-07-19 20:51:41 +03:00
Enzo 1db354c360
v.gen.c: fix codegen ordering problem with interfaces with interface fields (#10862) 2021-07-19 19:57:12 +03:00
Delyan Angelov 732d8101e0
math.big: add .bytes() and .bytes_trimmed() methods, `big.from_int(1024).bytes_trimmed() == [byte(0x00), 0x04]` 2021-07-19 17:17:08 +03:00
Daniel Däschle 9127e202d5
v.parser: fix error on empty name expr (#10860) 2021-07-19 17:09:51 +03:00
playX 425ca5e3c3
v.gen.js: add three backend options for JS, and comptime if support (#10859) 2021-07-19 15:55:03 +03:00
yuyi 8e99a018df
checker, cgen: fix generics interface method (#10858) 2021-07-19 13:29:46 +03:00
yuyi cf82bd3407
checker: fix fixed array with const unint type size (fix #10826) (#10853) 2021-07-19 12:44:03 +03:00
yuyi fdba3607af
checker: fix generics fn selector expr with unexpected symbol (#10851) 2021-07-19 09:16:15 +03:00
Delyan Angelov 83b0a80ff4
ci: fix MSVC build (delay const string initialiastion to _vinit) 2021-07-19 08:20:09 +03:00
Delyan Angelov 8ea576783b
tests: fix failed consts test (it now works properly) 2021-07-19 01:18:39 +03:00
Delyan Angelov 241a7b760d
strconv,checker,cgen: fix -cstrict compilation of hello_world.v 2021-07-19 01:08:48 +03:00
Delyan Angelov 48546d0f45
all: do compile time const evaluation for `const x = "abc" + "xyz"` and `const x = 16 * 1024 + 5` (fix const prealloc_block_size) 2021-07-18 22:59:18 +03:00
Delyan Angelov 3ccde5ce55
builtin: use `prealloc_block_size = 16777216` temporarily 2021-07-18 17:03:25 +03:00
Delyan Angelov 016240d00b
v: support `-o - x_test.v` too, describe `-o -` in the `v help` screen 2021-07-18 16:41:32 +03:00
Delyan Angelov a007dd5d22
builder: support `-o -` to print the generated C/JS source to stdout 2021-07-18 16:26:50 +03:00
yuyi a5c784830b
all: simplify global_scope processing (#10848) 2021-07-18 15:29:34 +03:00
shadowninja55 eb65ad078d
checker: prohibit passing non-lvalue as `voidptr` (#10838) 2021-07-18 15:04:16 +03:00
Miccah 1a6a7a678a
vweb: change Context.headers from string to struct Header (#10749) 2021-07-18 12:21:07 +03:00
playX d5e0fa6d1b
v.gen.js: port string methods and fix booleans (#10824) 2021-07-18 09:00:20 +03:00
yuyi 8b8f496762
checker: fix generics fn return generic interface (fix #10818) (#10831) 2021-07-18 08:55:19 +03:00
Delyan Angelov 6edfb2c7fe
v.parser: eliminate PrefixExpr from `&Type(x).name` and `&Type(x)[idx]` too (fix vinix build) 2021-07-17 20:20:20 +03:00
Delyan Angelov fc8a8e3b6f
ci: fix failure for function_stored_in_global.vv 2021-07-17 18:19:20 +03:00
Delyan Angelov ee9e91b8e7
builtin: fix `-d no_backtrace` error with tcc 2021-07-17 18:09:16 +03:00
Delyan Angelov 568aa742b2
v.parser: improve conditions for debugging ast.CastExpr parsing 2021-07-17 17:49:29 +03:00
Delyan Angelov b0167297e5
builtin: support `-d no_backtrace` on macos/bsd too 2021-07-17 17:49:28 +03:00
yuyi 3a0fa550b6
checker: fix generics fn inferring map type (fix #10835) (#10839) 2021-07-17 17:49:21 +03:00
div72 d84ffbf73c
runtime: decrement default cpu amount in nr_jobs (#10841) 2021-07-17 17:07:59 +03:00
spaceface 22fcbe70a2
checker: allow omitting `{}` in trailing struct args (#10832) 2021-07-17 15:44:44 +03:00
crthpl ec47cda386
cgen: fix other generic pointer cases (#10834) 2021-07-17 11:51:42 +03:00
William Gooch 51dd8304bb
tools: make the `v` REPL help screen look nicer (#10833) 2021-07-17 11:23:29 +03:00
shadowninja55 355f46f475
gen: implement `thread.str()` (#10820) 2021-07-17 11:19:28 +03:00
shadowninja55 0d587d3580
checker: prohibit using non-lvalue as mut receiver (#10790) 2021-07-16 13:03:40 +03:00
yuyi fe64346ae2
parser: minor optimization of array filtering judgement (#10821) 2021-07-16 12:00:37 +03:00
Delyan Angelov cbe4ac703e
v.builder: remove temporary file.js file after `v -b js run file.v` 2021-07-16 10:03:46 +03:00
Delyan Angelov 0723daf788
tests: add vlib/v/gen/js/program_test.v to ease regression testing `-b js` programs 2021-07-16 09:36:45 +03:00
spaceface ebc34c237b
cgen: fix generating invalid Option decls for generic interfaces (#10817) 2021-07-15 22:15:25 +03:00
yuyi aca66d503d
parser: minor optimization in call_expr() (#10809) 2021-07-15 17:47:59 +03:00
yuyi ddaac5af92
checker: fix generics with multi generic struct types (#10808) 2021-07-15 17:39:55 +03:00
playX 06edbc8a38
v.gen.js: implement most of array and map methods in builtin/js (#10806) 2021-07-15 17:36:53 +03:00
Delyan Angelov 027be2ecd4
tests: show a list of all failed commands in the summary too 2021-07-15 11:53:14 +03:00
shadowninja55 7c0be629ab
checker: prohibit fixed array to fixed array assignment where elem_typ is a pointer (#10775) 2021-07-15 08:38:03 +03:00
spaceface 6e942bf4c2
v: initial support for generic interfaces and sumtypes (#10795) 2021-07-15 08:29:13 +03:00
yuyi 7687b28d8d
cgen: remove Gen.write_expr_to_string() (#10804) 2021-07-15 08:15:28 +03:00
Delyan Angelov 54dd510ace
strconv: fix compilation with `-cc gcc -cstrict -prod` 2021-07-15 01:05:00 +03:00
shadowninja55 de6918b8c9
checker: fix hex literal overflow check (#10782) 2021-07-14 22:33:02 +03:00
penguindark 646c1e15e2
regex: fix a bug with find_all, fixes #10799 (#10801) 2021-07-14 22:20:05 +03:00
yuyi fe1cf2ea26
cgen: fix error of the map literals method call (#10791) 2021-07-14 22:03:47 +03:00
playX 9c710b2a34
v.gen.js: improve reference support (#10793) 2021-07-14 11:43:48 +03:00
playX 0e08d15bc4
v.gen.js: add basic support for references (#10785) 2021-07-13 22:52:01 +03:00
Delyan Angelov 24f5d0afc4
ci: fix `-o x.c` regression introduced in ff62b27 2021-07-13 22:13:28 +03:00
Delyan Angelov ff62b27ef0
v.builder: remove unused vjs_cc vestige (the -b js backend does its job now) 2021-07-13 20:32:30 +03:00
yuyi ed78e638b3
cgen: fix if_expr with array methods cond (#10786) 2021-07-13 19:51:49 +03:00
Daniel Däschle 78a41969f6
vdoc: fancier attributes (#10789) 2021-07-13 19:44:22 +03:00
Miccah c3c420a41c
vweb: remove chunked encoding support in server responses (#10750) 2021-07-13 15:47:16 +03:00
playX ee00d80931
v.gen.js: support global declarations in the JS backend (#10773) 2021-07-13 15:36:06 +03:00
Delyan Angelov d444dbd4d9
tests: add a multilevel pointer cast test too 2021-07-13 14:08:50 +03:00
Delyan Angelov bd0653abab
parser: cleanup `&Type(x)` more, add fmt regression test 2021-07-13 13:12:37 +03:00
crthpl 5089eb4a84
parser: fix pointer cast expressions hack (#10777) 2021-07-13 12:01:24 +03:00
Delyan Angelov 1bf6743987
vinix: support -os vinix (part 2) 2021-07-13 11:41:45 +03:00
Delyan Angelov 05466ce1b6
v.gen.c: fix cheaders.v 2021-07-13 11:30:51 +03:00
Delyan Angelov 85564b7b83
vinix: support -os vinix (part 1) 2021-07-13 11:24:09 +03:00
yuyi 2a9d6fef9f
cgen: fix initialization errors with fixed array aliases (#10784) 2021-07-13 10:51:54 +03:00
shadowninja55 d1f1c5ae51
v doc: add attribute tags to `v doc -f html` (#10778) 2021-07-13 08:27:20 +03:00
shadowninja55 7694afa44c
checker: check that `mut` args are lvalues (#10779) 2021-07-13 08:06:39 +03:00
shadowninja55 02f0a30555
checker: ensure hex character literals don't overflow in strings (#10725) 2021-07-12 22:37:31 +03:00
yuyi 1b26ce1f7a
cgen: fix array of alias's slice() (#10772) 2021-07-12 15:59:01 +03:00
pancake fe65cde03b
tools: use os.symlink instead of system('ln -s') in `v symlink` (#10769) 2021-07-12 14:23:25 +03:00
Miccah 3039092b89
net.http: add header_from_map and join functions (#10747) 2021-07-12 12:16:41 +03:00
yuyi 581280e6fc
parser: cleanup check_cross_variables() (#10754) 2021-07-12 12:10:42 +03:00
Delyan Angelov b5f1cf80a6
ci: fix regression bug in formatting of go_array_wait_test.v (caused by 974737f) 2021-07-12 10:55:30 +03:00
Delyan Angelov 974737f26b
vfmt: keep `module mymodule ... x := []thread MyStruct{}` as it is 2021-07-12 10:46:36 +03:00
yuyi 5c7881feb7
checker: fix error of for_in alias (#10770) 2021-07-12 09:17:00 +03:00
yuyi 719bf63f16
scanner: fix nested multiline comments (#10760) 2021-07-12 07:17:38 +03:00
zakuro ba9b53cc4d
cgen: fix error when using anon generics fn that have generics struct arg (#10751) 2021-07-11 19:30:41 +03:00
yuyi a3ed9c1bbd
cgen: fix fixed array of function str() (fix #10744) (#10753) 2021-07-11 19:24:33 +03:00
yuyi 938e9b61b5
parser: check undefined variables in assign_stmt (#10755) 2021-07-11 19:09:35 +03:00
yuyi c65bfc122d
checker: check assigning array_init with no type (#10757) 2021-07-11 18:52:01 +03:00
Delyan Angelov 9d241f75eb
v.markused: add string_at_with_check to the roots 2021-07-11 12:03:37 +03:00
Delyan Angelov fd644e4e28
flag: add .usage_example/1, .footer/1, .remaining_parameters/0 and tests 2021-07-11 11:06:48 +03:00
yuyi 71e8237483
parser: check undefined variables in array inits (#10746) 2021-07-11 03:49:07 +03:00
shadowninja55 b222e4efae
checker: change expr depth limit to 150 (#10745) 2021-07-10 20:24:53 +03:00
Miccah 44e78a6301
vweb: use http.Response constants instead of strings (#10730) 2021-07-10 11:58:07 +03:00
zakuro cb14e42af8
fmt: fix removal of selective imported Enum (#10729) 2021-07-10 11:06:01 +03:00
shadowninja55 a1088275b9
checker: prohibit illegal types in string interpolation literals (#10705) 2021-07-10 00:00:12 +03:00
waspoza 075e09b10e
os: fix a file descriptor leak in os.read_bytes() (#10723) 2021-07-09 23:49:46 +03:00
Delyan Angelov 477d442f18
flag: add overridable --help and --version by default 2021-07-09 22:08:23 +03:00
Louis Schmieder eb96ad11d9
checker: add pkgconfig to comptime if (#10692) 2021-07-09 18:17:04 +03:00
shadowninja55 aa5b609d95
checker: check integer literals (#10706) 2021-07-09 14:02:10 +03:00
yuyi 310bb1a8a6
cgen: fix generics with variadic generic args (#10700) 2021-07-09 12:09:30 +03:00
pancake 6f234ee34a
v.pref: uncomment the `$if serenity {}` block, after vc gets regenerated (#10716) 2021-07-09 11:57:43 +03:00
Delyan Angelov 972cbe2e9a
serenity: add more support 2021-07-09 11:33:51 +03:00
JalonSolov f62b6b37f0
flag: handle `--` as a parsing stop, and pass everything after it in .finalise() (#10703) 2021-07-09 11:13:32 +03:00
pancake 47bf64473c
vlib: reimplement glob in V for UNIX to not depend on libc (#10707) 2021-07-09 03:27:16 +03:00
pancake 151cd0bfe6
all: SerenityOS support (#10702) 2021-07-09 03:26:43 +03:00
Delyan Angelov 13917dc095
Revert "cgen: fix g.typ() not adding correct number of * for generic types (#10687)"
This reverts commit bfafdb69c9.
2021-07-08 22:15:44 +03:00
crthpl bfafdb69c9
cgen: fix g.typ() not adding correct number of * for generic types (#10687) 2021-07-08 21:28:40 +03:00
Delyan Angelov f5d3a6e020
v.pref: fix `error: duplicate method` with -b native of a file.v with `import os` 2021-07-08 19:19:28 +03:00
yuyi fb9b2e873c
checker: fix generic fn with assign reference generic struct (fix #10681) (#10695) 2021-07-08 16:50:25 +03:00
pancake eac8f77613
cgen: add sys/wait.h in cheaders.v for SerenityOS too (#10698) 2021-07-08 16:29:30 +03:00
Alexander Medvednikov 9ba6c23d5c checker: casted => cast 2021-07-08 05:11:12 +03:00
Delyan Angelov 7b4c342396
os: disable os.glob() on Android for now (fixes termux compilation) 2021-07-08 00:00:40 +03:00
shadowninja55 806d6172cb
checker: prohibit casting `void` (#10690) 2021-07-07 21:59:58 +03:00
yuyi 6436d9a827
cgen: fix error of generic array typedef (#10679) 2021-07-07 12:42:53 +03:00
shadowninja55 f070222124
checker: prohibit option and `IError` in multi-return (#10689) 2021-07-07 11:57:10 +03:00
crthpl d14de5fdaf
all: fix generic functions with pointer args (#10686) 2021-07-07 11:51:05 +03:00
crthpl 9eee6631cc
sokol: add mouse locking (#10684) 2021-07-06 20:43:41 +03:00
Delyan Angelov 55eeb701a9
time: fix `time.parse_iso8601(2037-07-23)?.add_days(181).str() == "1901-12-13 17:31:44"` 2021-07-06 18:54:33 +03:00
yuyi 9f8c3cc159
cgen: fix fn return array of interface (#10677) 2021-07-06 16:33:26 +03:00
Delyan Angelov 6dde9f76c6
cgen: reset g.tmp_count at the start of each fn (minimise v.c commit delta) 2021-07-06 14:50:30 +03:00
Delyan Angelov 1e6230a441
v.scanner: use mathutil instead of `mu` (easier to search) 2021-07-06 13:06:19 +03:00
Delyan Angelov 54f6dc70c3
v.util: add Timers.show_remaining/0, use it in v.builder.compile/2 2021-07-06 13:06:11 +03:00
yuyi 59d80e2758
cgen: fix interface fn return with struct_init (#10675) 2021-07-06 10:14:13 +03:00
El Koulali András dacfb71820
cgen: fix string interpolation where the expression generates multiple C statements (#10674) 2021-07-06 09:04:29 +03:00
yuyi 1857874d1a
tests: rename anon_fn_with_array_arguments.v to anon_fn_with_array_arguments_test.v (#10650) 2021-07-05 21:08:31 +03:00
Uwe Krüger a1f123bd42
cgen: enable string index error handling `s[i] or {...}` (#10670) 2021-07-05 21:00:30 +03:00
Lukas Neubert 9e61321d4c
cgen: fix VUNREACHABLE inside ternary (#10672) 2021-07-05 18:26:01 +03:00
Delyan Angelov d307ab2c7c
v.markused: fix `-skip-unused -gc boehm` after removing of ustring 2021-07-05 16:48:03 +03:00
Alexander Medvednikov 0f72bc9819 parser: temporary [c2v_variadic] fn attr for c2v'ed code 2021-07-05 11:32:15 +03:00
yuyi c4b5805890
checker: check generic method call args mismatch (#10669) 2021-07-05 10:14:00 +03:00
Delyan Angelov 972542d6ee
checker: `[noreturn]` part 2 (cleanup) (#10667) 2021-07-05 05:05:37 +03:00
shadowninja55 da9c75f2ca
checker: string != IError (#10665) 2021-07-05 05:05:08 +03:00
Delyan Angelov 6aecda3be8
all: support `[noreturn] fn abc() { for{} }`, mark panic/1 and exit/1with it too. (#10654) 2021-07-04 20:24:19 +03:00
yuyi b0b4b8e65b
checker: fix missing check generic fn call args (fix #10649) (#10657) 2021-07-04 19:15:15 +03:00
yuyi 665279938e
checker: fix nested generic struct init (fix #10652) (#10659) 2021-07-04 18:37:31 +03:00
shadowninja55 8c43d2450f
vweb: prohibit invalid parameter types in vweb app methods (#10631) 2021-07-04 18:37:09 +03:00
yuyi f246d73d6e
cgen: fix generic fn return mut parameter (#10662) 2021-07-04 18:36:37 +03:00
Alexander Medvednikov 6a64259527 string: bring back the is_lit comment 2021-07-03 20:16:49 +03:00
Daniel Däschle 0f9537ece5
all: remove ustring (#10630) 2021-07-03 20:14:09 +03:00
yuyi 5a4a1997e7
cgen: fix empty struct initilization (#10651) 2021-07-03 20:11:56 +03:00
مهدی 55aa810e8a
gx: complete the string_colors map (#10634) 2021-07-03 10:09:11 +03:00
Tomas Hellström ec973f5c6e
x.websocket: move to net.websocket module (#10648) 2021-07-03 02:56:00 +03:00
Alexander Medvednikov c44a47acb1 gg: fix draw_line on macos (native rendering) 2021-07-03 02:49:20 +03:00
yuyi e4d88a5be5
v.checker: minor cleanup of fn_call() (#10632) 2021-07-02 19:45:12 +03:00
yuyi 21512d1491
checker: fix generic fn inferring multi paras type (fix #10623) (#10626) 2021-07-02 17:38:57 +03:00
yuyi c0f855ace7
cgen: fix anon optional fn (fix #10640) (#10644) 2021-07-02 17:07:05 +03:00
yuyi 8628b19a3a
ast.table: optimize get_final_type_symbol() (#10646) 2021-07-02 16:59:41 +03:00
Flinner 1486258591
strconv: fix `atoi` returning 0 on large strings (#10635) 2021-07-02 10:39:57 +03:00
yuyi abbf71c794
ast.table: cleanup type_implements_interface() (#10643) 2021-07-02 10:18:04 +03:00
Delyan Angelov a33a2ba095
checker: check for `x := []Interface{len: 9}` without `init:` 2021-07-02 08:37:49 +03:00
Enzo d0a09579cc
cgen: cleanup `Gen.gen_*_equality_fn` (#10633) 2021-07-01 15:42:49 +03:00
yuyi 8b901df366
table: optimize generated code for an empty interface (#10624) 2021-07-01 12:25:40 +03:00
Alexander Medvednikov 41e88423aa Revert "builtin: use == 0 instead of isnil()"
This reverts commit 8650ec6916.
2021-07-01 06:21:03 +03:00
Daniel Däschle 3881e97a40
vlib: remove ustring usage (#10618) 2021-06-30 22:30:28 +03:00
div72 9d02ca51d1
checker: relax naming requirements for translated code (#10619) 2021-06-30 14:47:13 +03:00
Bastian Buck 8cc49b5e9e
os: add utime() (#9796) 2021-06-30 10:21:23 +03:00
Enzo b351aa1289
gen: cleanup `Gen.array init` (#10613) 2021-06-30 09:45:18 +03:00