Commit Graph

7730 Commits (f580597ffcdb1bf9ecc259badaa985b6f31023d0)

Author SHA1 Message Date
Uwe Krüger 2ac39d9112
all: new function `isreftype(T)` to know if `T` contains pointers (#10438) 2021-06-13 06:26:13 +03:00
Delyan Angelov 4a59316600
v.pref: remove 'unknown host CPU architecture' label to fix msvc CI 2021-06-13 03:05:00 +03:00
Delyan Angelov ed07f00729
v.checker: bump checker_match_exhaustive_cutoff_limit to 12 2021-06-13 02:04:08 +03:00
Delyan Angelov 9e270bacf7
v.pref: do not panic in get_host_arch, assume Arch.amd64 as a default 2021-06-13 01:45:13 +03:00
JalonSolov 6e41561124
net: fix download_file (#10439) 2021-06-13 01:40:32 +03:00
Delyan Angelov 2ff0f62866
v: fix passing `-arch arm64` to `$if arm64{}` 2021-06-13 01:15:35 +03:00
Delyan Angelov 5870751769
v.gen.c: use the __V_architecture macro in v.pref.get_host_arch() 2021-06-13 00:49:30 +03:00
Delyan Angelov dc1c8820cc
Revert "Revert "v.gen.c: add a __V_architecture macro""
This reverts commit 339f2cd180.
2021-06-13 00:46:27 +03:00
Delyan Angelov dc654b0121
Revert "v.gen.c: use the __V_architecture macro in v.pref.get_host_arch()"
This reverts commit 5452ba4653.
2021-06-12 23:15:48 +03:00
Delyan Angelov 339f2cd180
Revert "v.gen.c: add a __V_architecture macro"
This reverts commit 6e9218c088.
2021-06-12 23:15:36 +03:00
Delyan Angelov 5452ba4653
v.gen.c: use the __V_architecture macro in v.pref.get_host_arch() 2021-06-12 22:15:08 +03:00
Delyan Angelov 6e9218c088
v.gen.c: add a __V_architecture macro 2021-06-12 22:01:00 +03:00
yuyi 0e34ce2759
cgen: format generated code in match_expr() (#10397) 2021-06-12 21:14:08 +03:00
Delyan Angelov b7f9bc2a96
sync: support linking with libatomic with tcc on ubuntu aarch64 2021-06-12 20:34:45 +03:00
Delyan Angelov 9f2dc7332f
gen.v.c: fix -usecache with modules having dump() 2021-06-12 18:10:55 +03:00
Alexander Medvednikov 9ac661be5a checker: use a correct type name in an error 2021-06-12 17:28:30 +03:00
Uwe Krüger 6acf32b869
v.parser: prepare for splitting of `map.v` (#10432) 2021-06-12 17:01:37 +03:00
Delyan Angelov e70bde54dc
ast: improve Expr.str() for `sizeof(Type)` and `__offsetof(StructName, fieldname)`, for more informative asserts/dumps 2021-06-12 16:49:14 +03:00
pancake 3b6045865b
checker: improve error message when using fields as methods (#10367) 2021-06-12 15:15:25 +03:00
Alexander Medvednikov 635f045b14 ast: make is_int() work with aliases 2021-06-12 14:35:38 +03:00
Uwe Krüger 652e7ba973
gc: extend optimized mode to strings (#10431) 2021-06-12 11:27:08 +03:00
Alexander Medvednikov e02d1d4a4b Revert "gc: extend optimized mode to strings (#10409)"
This reverts commit 3f654a69e3.
2021-06-12 01:52:06 +03:00
Uwe Krüger 3f654a69e3
gc: extend optimized mode to strings (#10409) 2021-06-12 00:03:05 +03:00
Alexander Medvednikov d0100faf26 all: fix sanitizer build 2021-06-11 18:41:50 +03:00
Alexander Medvednikov 6761697088 checker: do not allow dereferencing function calls on the left side of an = 2021-06-11 16:07:41 +03:00
Uwe Krüger daeeaef030
vfmt: hot fix to allow separate `array_d_gcboehm_opt.v` (#10413) 2021-06-11 12:00:18 +03:00
yuyi f26626117d
cgen: fix match struct type cond (#10421) 2021-06-11 11:58:25 +03:00
crthpl 6576d876fc
cgen: support a `[_naked]` fn attribute (#10418) 2021-06-11 11:03:39 +03:00
yuyi 7878bad95e
checker: check array type mismatch of array append (#10405) 2021-06-10 21:34:36 +03:00
yuyi 9d852e22b2
cgen: fix match array or map cond (#10411) 2021-06-10 21:33:35 +03:00
Uwe Krüger 0e2c86310a
GC-boehm: extend optimized mode to all `array` methods (#10406) 2021-06-10 21:26:17 +03:00
yuyi 9a9d539e6f
csv: fix csv fields with double quotes (#10399) 2021-06-10 19:24:20 +03:00
shadowninja55 10b9ea3258
checker: add an error for assigning to array slices `a[..2] = [0, 0]` (#10412) 2021-06-10 19:18:14 +03:00
pancake 5be982d63e
builtin: fix memory leak on empty strings (#10408) 2021-06-10 15:21:57 +03:00
Andreas Heissenberger 96c8d147b2
v.gen.js: add source map creation support (inline only, no src) (#10384) 2021-06-10 08:33:46 +03:00
Enzo 14519bbf5c
cgen: clean up interface methods generation (#10400) 2021-06-09 22:44:18 +03:00
Uwe Krüger 811a3e1d38
builtin: optimize `array.repeat()` (#10396) 2021-06-09 12:52:30 +03:00
Delyan Angelov 115edff7e9
v.checker: restrict `x T` in `fn test<T>(x T){ unsafe{ println(x[0]) }`, but allow `x &T` 2021-06-09 12:07:08 +03:00
Delyan Angelov f351ff037e
Revert "checker: check generic type indexing error (#10345)"
This reverts commit 103c777ad6.

Passing references to values should be allowed, and is already used in vinix:
`pub fn cas<T>(_here &T, _ifthis T, writethis T) bool {`
2021-06-09 11:46:17 +03:00
yuyi 49de1f8e64
checker: cleanup in infix_expr() (#10368) 2021-06-09 00:06:29 +03:00
Uwe Krüger a2243054a5
builtin: fix memory corruption in array `.clone()` and `.repeat()` (#10394) 2021-06-08 23:23:28 +03:00
Delyan Angelov 3dc4d13160
v.parser: do not treat test_ functions specially outside of _test.v files 2021-06-08 23:01:49 +03:00
Delyan Angelov 000790b112
vfmt: fix eating JS. from `JS.Struct{}` 2021-06-08 21:27:05 +03:00
Delyan Angelov 95cf120e2e
ci: fix linux-cross job; os.real_path cleanup 2021-06-08 18:34:15 +03:00
Delyan Angelov f9c4365dc7
v.gen.c: free `indents` in autogenerated .str() methods 2021-06-08 17:24:08 +03:00
Delyan Angelov d820f2da6f
os: use arr.trim() in read_bytes, instead of a arr[0..x].clone() 2021-06-08 17:24:07 +03:00
Delyan Angelov 40ac7d4892
builtin: support -d trace_vcalloc, -d trace_realloc 2021-06-08 17:24:07 +03:00
yuyi 103c777ad6
checker: check generic type indexing error (#10345) 2021-06-08 17:23:44 +03:00
Delyan Angelov 665c386771
builtin: simplify the .si_c and .si_vp cases in StrIntpData.get_fmt_format, free intermediate results 2021-06-08 13:29:03 +03:00
Khalyomede d2bc9ee7bc
doc: tablename -> table (#10359) 2021-06-08 00:48:42 +03:00
Delyan Angelov 98613036c1 gg: fix draw_line on m1 2021-06-07 21:31:24 +03:00
Delyan Angelov 2e6611372a mysql: use `v oksyntax` for the example in the README.md, so that the check passes on m1 without installed mysql 2021-06-07 18:39:42 +03:00
Delyan Angelov 9f6c4030f6 tests: fix `-cstrict` self compilation on m0 with clang 2021-06-07 18:23:18 +03:00
Delyan Angelov 4772146a7e tests: fix failing tests on M1 2021-06-07 18:23:18 +03:00
Lukas Neubert 98cdde8247
assert: print enum value of CTempVars on fail (#10378) 2021-06-07 15:49:48 +03:00
yuyi cd464010d4
cgen: fix match with multi sumtype exprs (#10377) 2021-06-07 14:16:30 +03:00
youyuanwu 3582118b7c
mssql: support windows (#10336) 2021-06-07 14:02:15 +03:00
yuyi 0615f2e236
checker: check generic method receivers with no type parameter (#10374) 2021-06-07 12:11:29 +03:00
Carlos Esquerdo Bernat 86778d06b1
net.http: add a Header.starting_with method, to get the first header, starting with a key (#10119) 2021-06-07 11:18:40 +03:00
crthpl 8a497080b3
cgen: fix assembly in generic fns (#10370) 2021-06-07 10:53:33 +03:00
yuyi 114c382c46
parser: fix generic fn typeof name (#10363) 2021-06-06 17:40:13 +03:00
Lukas Neubert c14b357fec
checker: fix enums in builtin (#10366) 2021-06-06 16:27:46 +03:00
pancake 012f866619
native: support more arithmetic, int/string arrays, function returns and internal_strlen (#10279) 2021-06-06 16:19:10 +03:00
Delyan Angelov 007ba5178e
v: add more timing points 2021-06-06 12:23:00 +03:00
Alexander Medvednikov aea93c3a96 net.http: vfmt and remove unused ws_func 2021-06-06 01:51:49 +03:00
yuyi 329a6c974e
table, checker, cgen: implement generic fn infering fixed array (#10352) 2021-06-06 01:11:08 +03:00
Miccah c2981de4d5
http: add server.v and organize HTTP request and response code (#10355) 2021-06-06 00:43:14 +03:00
Lukas Neubert 3f00ff465b
checker: check or block inside println calls (#10354) 2021-06-05 23:01:58 +03:00
Delyan Angelov 9924f6c54b
ci: fix build-vc job 2021-06-05 18:26:56 +03:00
Delyan Angelov 55ef849cd2
v.markused: trim unused map fns for programs that do not use them 2021-06-05 17:30:25 +03:00
yuyi 8af7558e0c
checker: minor cleanup of return_stmt() (#10315) 2021-06-05 14:06:48 +03:00
Yuriy Zymlex a716a00e38
builder: fix a bug with submodule import (#10318) 2021-06-05 12:45:23 +03:00
Lukas Neubert dc431a3c47
checker: prevent enum value duplication check bypass (#10287) 2021-06-05 12:28:17 +03:00
crthpl 9553c5a4e6
parser: fix multiple output modifiers in asm (#10347) 2021-06-04 23:18:11 +03:00
KJ Lawrence 751b1cffd3
gg: fix default font style loading (#10309) 2021-06-04 20:00:32 +03:00
zakuro b0c9a87292
v: show an error and exit, when no module name is given in `v build-module` (#10338) 2021-06-04 18:30:43 +03:00
Ken 5266b4921d
sqlite: add a last_insert_rowid fn (#10341) 2021-06-04 18:10:20 +03:00
Uwe Krüger 89aab95177
builtin: fix -gc boehm on windows (#10330) 2021-06-04 17:38:51 +03:00
Lucas Rodrigues fdc03f70b5
rand.util: workaround for inaccurate `v` warning in vlib/rand/util/util.v (#10344) 2021-06-04 17:05:58 +03:00
yuyi f4486d79c3
checker: minor cleanup of selector_expr() (#10316) 2021-06-03 16:49:50 +03:00
Miccah c8d5e783a3
net: use custom error for invalid headers (#10323) 2021-06-03 09:50:07 +03:00
yuyi fedf07ddd8
checker: minor cleanup of assign_stmt() (#10314) 2021-06-03 09:49:03 +03:00
yuyi 86d70fade7
checker: minor cleanup of struct_init() (#10310) 2021-06-03 09:48:19 +03:00
zakuro 4089aa38c5
fmt: fix removal of `Abc` in `import mod { Abc }`, where `Abc` is used in a `x as Abc` expression #10306 2021-06-03 06:35:54 +03:00
Ehsan Afzali 672bb6ca7f
parser: fix required function members in struct (#10299) 2021-06-03 02:55:58 +03:00
yuyi b0bafa6376
cgen: fix or_block in for declaration (#10317) 2021-06-03 01:18:52 +03:00
Delyan Angelov b28def7c11
tests: add vlib/v/tests/failing_tests_test.v, support `testdata` in `v test-self` too 2021-06-03 00:32:09 +03:00
yuyi 1747e546bf
parser, checker: check assert optional (#10319) 2021-06-02 20:38:26 +03:00
Delyan Angelov 5400a765a4
tests: make `fn test_fn() ? { return error(fail) }` count as a fail 2021-06-02 19:14:37 +03:00
Ryan Roden-Corrent a368800b26
net.urllib: don't crash on str() if url is missing host (#10313) 2021-06-02 16:12:27 +03:00
Larpon f6bb4d9a4a
strings.textscanner: fix doc strings (#10298) 2021-06-02 16:11:16 +03:00
pancake 4b2319fd67
native: fix macho header for amd64 macOS 'Big Sur' (#10304) 2021-06-02 16:09:57 +03:00
KJ Lawrence 452a51c8fe
gg: render text if we fell back to system default (#10307) 2021-06-02 16:00:14 +03:00
Uwe Krüger ce3e71cb8e
OpenBSD: support Boehm-GC, X11 and Sqlite (#10300) 2021-06-01 22:28:30 +03:00
Delyan Angelov 14d09aa7c2
ci: fix failing `v -cstrict vlib/v/tests/channels_test.v` 2021-06-01 16:48:49 +03:00
Delyan Angelov 8fee140fc0
builtin: small cleanup in string_interpolation.v 2021-06-01 16:21:43 +03:00
Delyan Angelov 5cb2683e97
v.gen.c,v.markused: fix `println(ch)` when ch is a channel 2021-06-01 13:46:59 +03:00
zakuro 0afeba5588
cgen: fix C error with clang, when declaring a fn type with an alias type argument (#10297) 2021-06-01 12:37:27 +03:00
Wertzui123 148bb31f6e
v.parser: allow for `if x { $if y {} } else {}`, fix #10243 (#10294) 2021-06-01 12:19:39 +03:00
youyuanwu 98505207c4
mssql: support orm create and drop table (#10296) 2021-06-01 11:10:27 +03:00
zakuro 90292ce981
fmt: fix removal of `Abc` in `import mod { Abc }`, where Abc is used in a `x is Abc` expression (#10286) 2021-05-31 17:35:16 +03:00
yuyi cb19079d53
all: move cur_concrete_types to Table (#10269) 2021-05-31 17:14:45 +03:00
yuyi 9fc5b9dc54
cgen: fix match in map or expr (#10283) 2021-05-31 17:10:33 +03:00
Uwe Krüger d39a55ac11
checker: forbid leaving function from inside `defer` block (#10285) 2021-05-31 17:09:57 +03:00
Louis Schmieder 38796521fa
all: allow defer use from other scope (#10284) 2021-05-31 14:43:44 +03:00
Delyan Angelov eac1e25c5d
strings: simplify Builder (#10263) 2021-05-31 14:21:06 +03:00
youyuanwu 8990114b4b
vlib: add a vlib/mssql module (#10280) 2021-05-31 14:08:31 +03:00
yuyi 5aa4f622b6
checker: fix match expr returning optional (#10281) 2021-05-31 12:34:55 +03:00
Lukas Neubert 5b9256ba0b
cgen: write alias typedefs just before interfaces (#10272) 2021-05-31 12:26:06 +03:00
Lukas Neubert 09e3099580
checker: error on direct map alias init (#10282) 2021-05-31 12:14:37 +03:00
Delyan Angelov 955dc12523
v: replace execuast => executable 2021-05-31 09:39:18 +03:00
KJ Lawrence 9a5768395d
cgen: fix embeds for msvc (fix #10244) (#10259)
* cgen: fix embed file for mvsc

* define struct fields during init

* vfmt

* wrap string in `cestring` to escape properly

Co-authored-by: klawrence <klawrence@netpark.us>
2021-05-31 07:50:23 +03:00
penguindark 1343787009
builtin: fix interpolation bug for `${x:g/G}`, where `x` is a zero or an infinity (#10271) 2021-05-30 19:30:18 +03:00
Uwe Krüger aa861d1cac
docs: describe array/slice behaviour (#10252) 2021-05-30 14:48:33 +03:00
yuyi 13ddfaa433
checker: fix generic fn infer nested struct (#10262) 2021-05-30 14:06:52 +03:00
yuyi c67891d69f
checker: minor cleanup in match_expr() (#10261) 2021-05-30 13:33:19 +03:00
Thomas Treffner ba86d619fa
builtin: fix print/println on termux (#10253) 2021-05-30 08:10:32 +03:00
Delyan Angelov b29bc9cdce
checker: fix panic on `fn abc()?{ return error() }` 2021-05-29 23:46:56 +03:00
Bastian Buck d6e462a6ca
os: fix os.is_link and os.symlink on windows, add new functions os.getppid, os.getgid, os.getegid (#10251) 2021-05-29 23:26:13 +03:00
yuyi e4f6369cd1
checker: fix match error to none (#10245) 2021-05-29 19:30:57 +03:00
Uwe Krüger 2d8a136d6e
os: fix file read (#10247) 2021-05-29 16:53:42 +03:00
Uwe Krüger 15557161cc
builtin: add trailing `0` to reversed string (#10248) 2021-05-29 16:45:26 +03:00
Uwe Krüger bd467f94ab
encoding: append `0` to strings for compatibility (#10249) 2021-05-29 16:31:52 +03:00
Uwe Krüger 0ff2d9ef78
strconv: fix memory corruption (#10250) 2021-05-29 16:24:09 +03:00
yuyi 8785599094
checker, cgen: fix optional with if expr (#10242) 2021-05-29 10:00:12 +03:00
KJ Lawrence 465860e418
gg: fix ctx.scale for circles (#10210) 2021-05-28 22:37:02 +03:00
Lukas Neubert ddcc22a778
fmt: fix removal of selective imported map key type (#10235) 2021-05-28 22:29:03 +03:00
Lukas Neubert 6b683d31ac
v.parser: support imported enums as map keys (#10234) 2021-05-28 20:09:03 +03:00
yuyi 9ea753e853
checker: fix generic with fixed array parameter (#10233) 2021-05-28 18:51:55 +03:00
penguindark 7089ff3957
builtin: fix a bug in str_intp (#10238) 2021-05-28 18:44:30 +03:00
Alexander Medvednikov ca8158ac41 parser: handle casts in match expressions; c2v: minor fixes 2021-05-28 17:59:43 +03:00
KJ Lawrence 9fab4af3f1
gg: update the mouse click callback to pass what mouse button was clicked too (#10225) 2021-05-28 12:46:23 +03:00
yuyi 6e493ca8ca
checker: check index_expr or_expr types mismatch (#10224) 2021-05-28 11:40:59 +03:00
Delyan Angelov 39de06c200
v.pref: cleanup V options, support the documented -output and -backend 2021-05-28 09:07:06 +03:00
Lukas Neubert 8a109b031c
fmt: minor optimization in call_expr (#10228) 2021-05-27 22:40:54 +03:00
Enzo df2b688337
checker: cleanup type alias pascal case check (#10217) 2021-05-27 22:40:32 +03:00
Wertzui123 a095a27d00
gg: change vid to ved in a comment (#10218) 2021-05-27 20:14:36 +03:00
Ruofan XU 4e55b9c08e
example: improve binary search tree example (#10226) 2021-05-27 20:13:02 +03:00
Delyan Angelov 2b62dca000
v: support for `$if threads {}, depending on whether `go ` was used at all (#10227) 2021-05-27 18:36:07 +03:00
KJ Lawrence 6cdc7646b8
gg: add quit fn (#10223) 2021-05-27 17:56:18 +03:00
Uwe Krüger 8828054e5b
builtin: fix arrays/slices memory bug (#10219) 2021-05-27 15:50:06 +03:00
Anton Zavodchikov 539594bfce
sqlite: add error struct for optional result (#10209) 2021-05-27 12:45:34 +03:00
Lukas Neubert d5cacd1e5f
ast: use string builder for StringInterLiteral.str() (#10207) 2021-05-27 10:17:51 +03:00
zakuro 607dbd36d7
parser: set is_public of TypeSymbol for fn type decl (#10212) 2021-05-27 10:17:08 +03:00
yuyi 7c0cd2f41d
checker, cgen: fix match with complex sumtype exprs (#10215) 2021-05-27 10:13:50 +03:00
Alexander Medvednikov 2abbbcc02d checker: allow int <=> enum usage in c2v'ed code 2021-05-26 11:00:57 +03:00
penguindark 2dd1d3fcbb
all: string interpolation code cleaning (#10204) 2021-05-26 09:30:08 +03:00
Joe Conigliaro 5e26273529
cgen: use __new_array instead of __new_array_with_default for empty vargs 2021-05-26 15:48:48 +10:00
Joe Conigliaro 560301dbfe
cgen: dont preallocate zero length with capacity of 1 2021-05-26 14:51:20 +10:00
yuyi cf07375d1b
checker: fix multi types generic struct init (#10201) 2021-05-25 19:51:55 +03:00