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

1282 Commits

Author SHA1 Message Date
Ruofan XU
51f2eb81f4
checker/cgen: fix mut array of fn as argument (#8469) 2021-02-01 20:10:24 +01:00
Nick Treleaven
79e9084f7b
checker: allow Struct{...expr} where expr is another struct type (#8495) 2021-02-01 20:08:25 +01:00
Uwe Krüger
17746561f2
cgen: put shared arrays and maps always on heap (#8496) 2021-02-01 20:07:01 +01:00
Delyan Angelov
fab7b9d9d9
checker: fix x := match enumexpr { .case2 { fn1 } .case2 { fn2} }, where fn1 and fn2 have compatible signature 2021-02-01 21:01:58 +02:00
Nick Treleaven
c537578481
checker: ensure expr is an lvalue with Struct{...expr (#8489) 2021-02-01 15:18:03 +01:00
yuyi
53a5aad855
cgen: fix fixed array of function (#8490) 2021-02-01 14:50:10 +01:00
Uwe Krüger
44ec9e3ebc
checker/cgen: put shared struct always on heap (#8492) 2021-02-01 14:39:36 +01:00
spaceface
effa3188dd
cgen: fix type casts to interfaces (#8476) 2021-01-31 19:24:33 +02:00
Larpon
d25825df57
all: support compile time $env('ENV_VAR') (#8456) 2021-01-31 19:22:42 +02:00
Nick Treleaven
f992099726
checker: check s.$method(arg) argument is []string (#8455) 2021-01-31 15:28:23 +01:00
yuyi
2963425995
cgen: fix fn_with_mut_args (fix #7139) (#8446) 2021-01-31 02:45:45 +01:00
BigBlack
c5e7956eb5
checker: fix generic_mutable_arrays in functions (#8445) 2021-01-30 18:35:03 +01:00
Nick Treleaven
64d12cdc8d
checker: check number of C function arguments for some cases (#8444) 2021-01-30 18:33:36 +01:00
Nick Treleaven
849bc6c3d8
tests: fix weird CI failure with error details (#8449) 2021-01-30 18:53:39 +02:00
Uwe Krüger
9c82eec529
checker: support nested propagation cases f(g() ?) (#8447) 2021-01-30 16:53:31 +01:00
Nick Treleaven
43c3a3b080
checker: fix compile-time call with string identifier expression (#8415) 2021-01-30 15:24:16 +01:00
div72
8c70920695
all: add offsetof (#8380) 2021-01-30 12:57:09 +01:00
Nick Treleaven
c0685eeefc
parser: add warning for s.$field.name without brackets (#8411) 2021-01-30 12:56:10 +01:00
Lukas Neubert
2774db077d
fmt: keep user choice for newlines in match branches (#8418) 2021-01-30 11:57:57 +01:00
yuyi
77b3d40f46
checker: fix map = {} (#8435) 2021-01-30 11:55:10 +01:00
Uwe Krüger
5e9b528a9d
checker/cgen: support return from nested or (#8430) 2021-01-30 12:46:36 +02:00
Delyan Angelov
760b4c37b9
all: support _test.vv files (to test _test.v errors/checks too) 2021-01-30 10:42:18 +02:00
Delyan Angelov
948f63b507
checker,builder: rename details: to Details: 2021-01-30 10:20:09 +02:00
Delyan Angelov
30e0c478d7
checker: add error for _test.v file without test_ functions 2021-01-30 10:19:29 +02:00
Swastik Baranwal
e03ece2a4b
checker: check the fn decl for anon fns too (#7529) 2021-01-29 23:11:05 +02:00
Uwe Krüger
4a955d9c54
sync: don't force Mutex and Semaphore to be reference (#8331) 2021-01-29 20:52:14 +02:00
zakuro
2a32dac40d
checker: fix panic when calling generic function with too few args (#8416) 2021-01-29 20:14:22 +02:00
yuyi
26c06a56b7
checker: fix array_insert_or_prepend_short_struct_init (#8397) 2021-01-29 14:53:14 +01:00
Nick Treleaven
d012f2713b
checker: improve errors with compile-time field access (#8373) 2021-01-29 00:45:00 +01:00
spaceface
4aee997689
checker: make implementing an interface with another interface an error (#8398) 2021-01-29 00:41:59 +01:00
yuyi
1be7cc14d3
checker: check duplicate of a const name (#8396) 2021-01-28 18:34:55 +01:00
yuyi
684d2e6dbf
checker: merge ambiguous_function_call tests (#8388) 2021-01-28 15:53:54 +02:00
Uwe Krüger
0afe36e153
checker: fix receiver pos for single letter type error message (#8393) 2021-01-28 15:20:07 +02:00
Lukas Neubert
75d85403a6
fmt: better ternary concat wrapping (#8379) 2021-01-28 11:23:48 +01:00
Alexander Medvednikov
d86cb67eda checker: add a test for the single letter receiver 2021-01-28 11:13:51 +01:00
Alexander Medvednikov
68dab101d9 checker: fix one letter receiver panic 2021-01-28 11:05:37 +01:00
Alexander Medvednikov
36e75e5208 Revert "parser: fix panic when single letter receiver parsed (#8381)"
This reverts commit 93b0d8ca64.
2021-01-28 10:59:04 +01:00
Daniel Däschle
93b0d8ca64
parser: fix panic when single letter receiver parsed (#8381) 2021-01-28 10:56:43 +01:00
Tim Basel
5fc7eadd8b
cgen: fix short struct init with mut (#8384) 2021-01-28 10:05:09 +02:00
zakuro
8162396783
checker: deny multi-value in a singe-value context (#8328) 2021-01-27 23:10:51 +02:00
yuyi
d1ab22d45f
checker: fix array append short struct init (#8362) 2021-01-27 13:55:53 +01:00
Enzo
2b30c48770
checker: fix ctdefine check in non-main modules (#8332) 2021-01-27 13:54:33 +01:00
Swastik Baranwal
17921f4171
checker: add checks for optional selector_expr (#8330) 2021-01-27 13:53:20 +01:00
Nick Treleaven
58a76344cb
checker: avoid SelectorExpr filter on Ident unless it's a generic type name (#8357) 2021-01-27 13:52:52 +01:00
yuyi
7a5722c885
parser: check assign_stmt of undefined variable (#8366) 2021-01-27 13:52:10 +01:00
Delyan Angelov
e5a84719ca
all: require calling optfn() ? / optfn() or {...} for fn optfn() ? {} 2021-01-26 16:43:17 +02:00
spaceface
5f2b2df546
checker: don't disallow defining methods on interfaces (#8335) 2021-01-26 11:56:17 +01:00
zakuro
3959ba5751
checker: make a calling no-body function a checker error (#8265) 2021-01-26 11:19:48 +01:00
Lukas Neubert
2007dbc7b5
fmt: put the opening brace on a new line again for infix (#8336) 2021-01-26 11:19:32 +01:00
Daniel Däschle
7bb9c0e7b3
checker: fix multi generic args (#8347) 2021-01-26 09:37:48 +02:00
spaceface
daff085033
checker: fix treating C structs with capitalized fields as embeds (#8343) 2021-01-25 18:47:14 +02:00
Daniel Däschle
006a11454f
cgen: fix generic type $else $if (#8339) 2021-01-25 17:08:02 +01:00
Delyan Angelov
a5b10b5539
parser: improve the error message for unexpected keywords 2021-01-25 15:29:07 +02:00
Delyan Angelov
728344ff65
ci: fix v test-cleancode 2021-01-25 12:55:01 +02:00
Delyan Angelov
94fd3ff431
checker: remove the 'in module main cannot be declared public' error/warning 2021-01-25 12:55:00 +02:00
spaceface
4be45e8d02
checker: add mutability checks for interface fields; add tests (#8312) 2021-01-24 22:11:17 +01:00
Uwe Krüger
815104e5d0
parser: parse -1 and -13.3 as number literals (#8321) 2021-01-24 22:09:51 +01:00
Alexander Medvednikov
12ff1c2702 doc: document the new const rule 2021-01-24 10:23:52 +01:00
Alexander Medvednikov
80e6b090ea checker: remove an obsolete const test 2021-01-24 10:17:36 +01:00
Alexander Medvednikov
8bcb6c10cc checker: remove duplicate const error; fmt: force full path to consts 2021-01-24 10:01:13 +01:00
Daniel Däschle
35432c5e92
gen: fix generic multi return (#8303) 2021-01-23 23:41:32 +02:00
Uwe Krüger
38880b23eb
checker: allow a[i] for shared arrays outside unsafe (#8292) 2021-01-23 13:33:32 +01:00
yuyi
b8857baa98
parser: fix map_init position (#8293) 2021-01-23 13:33:19 +01:00
yuyi
5ee3fecf60
checker: check for mut val in immutable obj (#8285) 2021-01-23 10:40:17 +01:00
Lukas Neubert
8b61891348
fmt: smarter if condition wrapping (#8201) 2021-01-23 10:33:22 +02:00
zakuro
9812230847
checker: make the no-body main function a checker error (#8211) 2021-01-23 10:30:26 +02:00
Daniel Däschle
c5c7addb88
checker: improve infer generic (#8281) 2021-01-23 10:19:08 +02:00
spaceface
c2d501e8a9
all: implement interface fields (#8259) 2021-01-23 08:57:17 +02:00
Louis Schmieder
e06e8b10cd
orm: fix empty struct and simplify (#8246) 2021-01-22 23:28:26 +01:00
Daniel Däschle
dbf84520f1
all: update assoc syntax (#8274) 2021-01-22 23:24:48 +01:00
Daniel Däschle
500ebf77e4
all: implement multiple generics (#8231) 2021-01-22 13:49:56 +01:00
Delyan Angelov
b10b76bb0d
parser: remove the 'non-string keys are work in progress' warning 2021-01-22 12:25:17 +02:00
Nick Treleaven
72168cd6bc
parser: support mut: section in the interface methods, and a mut interface fn modifier (#8092) 2021-01-22 10:02:28 +02:00
zakuro
1b09954622
parser: improve the position of mut receiver warning / error (#8240) 2021-01-22 09:38:37 +02:00
Uwe Krüger
925ffd76f4
sync/channels: expose ch.closed as bool pseudo attribute (#8244) 2021-01-22 09:37:29 +02:00
zakuro
522d875489
checker: make it an error, to use ident outside of anon fn (#8232) 2021-01-22 09:24:49 +02:00
Daniel Däschle
3ee7bc960f
checker/gen: fix smartcast pointer sumtype (#8260) 2021-01-21 22:31:25 +02:00
Louis Schmieder
6b1956fb60
checker: fix warning at comptime call (#8248) 2021-01-21 21:36:11 +02:00
Daniel Däschle
c6d6690064
checker: fix if expr infix (#8215)
* checker: fix if expr infix

* remove debugger code

* fmt

* remove debug

* add test cases
2021-01-21 12:42:24 +01:00
zakuro
29b3077ea1
checker: make negative literal index a checker error (#8242) 2021-01-21 13:27:16 +02:00
Louis Schmieder
4045ec1ca8
checker: remove vweb unused vars (#8180) 2021-01-21 11:09:19 +01:00
zakuro
0c249fa040
parser: improve anon fn pos (#8210) 2021-01-21 11:01:40 +01:00
spaceface
f059a9e96c
builtin: fix sorting arrays of primitives (#8204) 2021-01-20 23:19:35 +02:00
yuyi
190bb38087
checker: check fixed array size (#8224) 2021-01-20 23:17:49 +02:00
Delyan Angelov
d9532eda30
checker: error on a.slice(x,y) outside builtin 2021-01-19 15:55:52 +02:00
Tim Basel
129eee346b
fmt: keep single empty lines (#8189) 2021-01-19 14:49:40 +01:00
Delyan Angelov
85bcfdd636
checker: handle a[i] or { statements expr } the same as the other or blocks 2021-01-19 09:28:34 +02:00
Lukas Neubert
b44c08aff0
fmt: wrap match branch expressions (#8190) 2021-01-19 06:16:42 +01:00
Uwe Krüger
b74690cbec
builtin, checker, cgen: implement x = a[k] or { ... } for maps and arrays (#8193) 2021-01-19 06:06:57 +01:00
Uwe Krüger
5cc591b2b6
all: support generic chan (#8188) 2021-01-18 18:37:45 +01:00
Swastik Baranwal
6f1ae65811
parser: add a warning for only else branch in match (#8185) 2021-01-18 18:31:36 +02:00
Lukas Neubert
ac2c3847af
all: update copyright to 2019-2021 (#8029) 2021-01-18 13:20:06 +01:00
Lukas Neubert
16c9cbce7c
fmt: correctly increase f.line_len for write_indent (#8174) 2021-01-18 06:02:29 +01:00
Delyan Angelov
75af639721
checker: allow ptr++/ptr-- in unsafe{}, for any kind of pointer, except voidptr 2021-01-17 18:09:25 +02:00
Swastik Baranwal
334b66b311
checker/cgen: add checks and fix cgen for [typedef] for C structs (#8169) 2021-01-17 17:18:07 +02:00
Alexander Medvednikov
2b058edc98 checker: do not require ref field init with update expr 2021-01-17 06:24:03 +01:00
yuyi
9376c57a51
cgen: fix for_in_mut_val (fix #8087) (#8129) 2021-01-17 05:32:34 +01:00
Swastik Baranwal
ef627c9d21
checker: improve message and positioning for operator overloading (#8133) 2021-01-17 03:37:44 +01:00
Delyan Angelov
5ae55731b9
embed: move to v.embed_file, fix CI failing test 2021-01-16 20:03:07 +02:00
Daniel Däschle
53941c4a0a
fmt: fix if cond break readability (#8132) 2021-01-16 02:12:17 +01:00
Delyan Angelov
c4c4b9c7b1
gen,checker: implement g.trace/2 and c.trace/2, similar to p.trace/2 2021-01-15 20:28:53 +02:00
Delyan Angelov
263fb7d7a8
checker: fix instance.cb_field(mut arg) 2021-01-15 20:28:42 +02:00
Uwe Krüger
8d014d4646
sync: allow go routine join with return value (#8125) 2021-01-15 13:45:26 +01:00
Swastik Baranwal
0ca36aafe2
cgen: allow assignment operators for type aliases (#8086) 2021-01-15 02:27:19 +01:00
Nick Treleaven
c80cc917c7
checker: check casting struct -> interface; disallow casting struct -> interface pointer (#8110) 2021-01-15 01:20:58 +01:00
Nick Treleaven
127503c77d
checker: disallow indexing a voidptr (#8109) 2021-01-14 20:51:43 +02:00
Nick Treleaven
890fb2d09d
checker: show signature for interface method on error (#8111) 2021-01-14 20:50:06 +02:00
Larpon
f73500f2fe
all: add support for the x := $embed_file('v.png') compile time call (#8048) 2021-01-14 16:20:11 +02:00
Nick Treleaven
0f2a770b9c
checker: improve errors for interface method compatibility (#8097) 2021-01-13 23:44:29 +01:00
zakuro
47536df2d0
table: remove nr_dims from Array (#8053) 2021-01-13 23:43:19 +01:00
yuyi
1d28c4de2a
cgen: fix multi fixed arrays with default init (fix #8038) (#8064) 2021-01-13 22:57:33 +02:00
Nick Treleaven
ac85257ea0
parser: fix sizeof(mod.Type), fix checking sizeof expression (#8065) 2021-01-13 06:13:39 +01:00
Swastik Baranwal
1e853b0efc
cgen: implement argument operator overloading (#8067) 2021-01-13 03:31:14 +01:00
yuyi
03a0534483
all: change fixed array init from [1,2,3]!! to [1,2,3]! (#8068) 2021-01-13 03:28:53 +01:00
Daniel Däschle
3289dff7ff
checker: require explicit return none (#8060) 2021-01-12 11:43:55 +01:00
zakuro
33694665f0
fmt: align each contiguous field of struct. not the whole. (#7981) 2021-01-12 04:38:43 +01:00
Swastik Baranwal
5a1699dec2
checker: add more checks for operator overloading (#8030) 2021-01-12 04:37:20 +01:00
Uwe Krüger
5f95dd54bd
builtin: rename any_* -> *_literal - 2. part (#8032) 2021-01-11 22:58:15 +01:00
yuyi
a1c67232d0
checker: fix duplicate variable name (fix #265) (#7982) 2021-01-10 21:41:29 +01:00
yuyi
a97ed55a09
checker: check for an unknown struct name (fix #8007) (#8010) 2021-01-10 21:16:53 +02:00
Swastik Baranwal
0081e5740d
checker: only allow != and == for enum (#7985) 2021-01-10 12:26:31 +02:00
Swastik Baranwal
1f5255c2bb
cgen: implement >= and <= (#7991) 2021-01-10 12:24:46 +02:00
Daniel Däschle
a8dd13f086
parser: change array decompose syntax (#7965) 2021-01-09 22:48:23 +01:00
Ned Palacios
256ddcee1f
v.ast: add walker submodule for ast walking (#7775) 2021-01-09 05:36:38 +01:00
Daniel Däschle
bbac95a438
parser: error on recursive struct (#7964) 2021-01-09 01:33:36 +01:00
Nick Treleaven
141b0cb882
checker: fix warning & allow assigning to a union field without unsafe (#7970) 2021-01-09 01:32:33 +01:00
Swastik Baranwal
9291fb5e0c
checker: disallow comparison between enum and int (#7886) 2021-01-08 17:41:52 +01:00
yuyi
828120a918
checker: check unknown generic type (#7954) 2021-01-08 07:04:06 +01:00
Alexander Medvednikov
0998cbaaba vweb: fix routing test 2021-01-08 05:59:23 +01:00
Alexander Medvednikov
352cf91ba2 vweb: remove return vweb.Result{} everywhere 2021-01-08 04:57:02 +01:00
Alexander Medvednikov
e3f8d448c1 all: [noinit] struct attribute 2021-01-08 04:49:16 +01:00
Daniel Däschle
1ce93536d0
checker: fix panic in generic methods (#7944) 2021-01-08 00:50:59 +01:00
Daniel Däschle
88d18f3303
checker: smartcast in for loops (#7942) 2021-01-07 21:35:32 +01:00
Nick Treleaven
cbefe6c32f
parser: warn about old use of typeof (#7923) 2021-01-07 20:32:02 +01:00
Daniel Däschle
085085a2b9
parser: fix sumtype match with array type (#7939) 2021-01-07 20:12:35 +01:00
Alexander Medvednikov
15ba53be21 checker: handle different pointer levels 2021-01-07 07:36:11 +01:00
Uwe Krüger
ffd753abdc
all: implement ch <- x or {...} and ch <- x ? (#7928) 2021-01-06 21:19:40 +01:00
Daniel Däschle
9025c3528f
all: implement comptime if for generic type $if T is string { (#7901) 2021-01-06 19:58:53 +02:00
Alexander Medvednikov
3722e16073 builtin: fix byte.str() (part 2) 2021-01-05 19:26:50 +01:00
Nick Treleaven
7a6b160d63
checker: fix indexing a type alias instance (#7889) 2021-01-05 19:17:18 +01:00
Alexander Medvednikov
5a70eba8e1 all: byte.str() => byte.ascii_str() 2021-01-05 19:14:37 +01:00
Nick Treleaven
8fc33bc27d
checker: warn when casting number or a voidptr to reference type outside unsafe (#7900) 2021-01-05 20:07:45 +02:00
Alexander Medvednikov
3e04dfc79f builtin: fix byte.str() (part 1) 2021-01-05 18:59:51 +01:00
Daniel Däschle
c137a79666
checker: check if $if left is selector expr (#7897) 2021-01-05 18:14:55 +02:00
Nick Treleaven
3203a124b2
checker: warn when casting between reference types outside of unsafe (#7892) 2021-01-05 17:02:04 +02:00
Daniel Däschle
5841d5d8e1
all: implement basic comptime field selector (#7888) 2021-01-05 16:11:43 +02:00
zakuro
3dae44db73
checker: do not allow empty enums (#7848) 2021-01-05 01:46:32 +01:00
spaceface
efb80bdffd
all: implement iterators in for loops (#7867) 2021-01-05 01:06:44 +01:00
Nick Treleaven
040b923665
checker: warn when accessing union fields outside unsafe (#7869) 2021-01-04 21:44:37 +02:00
Uwe Krüger
bf904c2f82
checker, cgen: allow using literals as int and f64 for sum types (#7864) 2021-01-04 20:48:13 +02:00