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

11003 Commits

Author SHA1 Message Date
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
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
d4e89de8fb
ci: fix v -cstrict -cc gcc vlib/v/gen/native/macho_test.v 2022-10-10 13:28:18 +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
ade8fdff69
vfmt: fix v -W ./cmd/tools/vfmt.v, (and v -W build-examples) 2022-10-10 03:44:11 +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
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
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
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
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
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
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
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
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