Alexander Medvednikov
6463dfca29
Revert "Revert "builder: create the binary in the current directory if -o is not provided""
...
This reverts commit f2b73fe3ca
.
2021-03-23 14:49:09 +03:00
Delyan Angelov
f2b73fe3ca
Revert "builder: create the binary in the current directory if -o is not provided"
...
This reverts commit 9ae64e7fce
.
2021-03-23 13:27:26 +02:00
Alexander Medvednikov
9ae64e7fce
builder: create the binary in the current directory if -o is not provided
2021-03-23 12:31:02 +03:00
Delyan Angelov
a00c80b98f
v: support compiler notices. Use them for `[deprecated_after: '2021-05-01']` tags
...
Compiler notices are like warnings, with these differences:
a) notices use a different color.
b) notices use a different label.
c) notices do not prevent compilation with -prod.
(warnings are converted to errors with -prod)
2021-03-22 19:59:00 +02:00
zakuro
0258482caf
cgen: auto eq method for sumtype ( #9408 )
2021-03-22 06:39:07 +01:00
zakuro
f9bbc119aa
checker: make optional arguments in func call an error ( #9362 )
2021-03-20 17:27:16 +01:00
zakuro
4ae2c22c18
checker: make optional array element an error ( #9343 )
2021-03-18 15:11:51 +02:00
Alexander Medvednikov
88097125f7
checker: remove "use `++` instead of `+= 1`"
2021-03-18 01:37:36 +03:00
zakuro
6cfc2c217b
checker: fix #9330 ( #9342 )
2021-03-17 20:57:14 +02:00
crthpl
fafb035fb5
all: reimplement inline assembly ( #8645 )
2021-03-17 01:43:17 +01:00
yuyi
dd9f9c2718
checker: check array.sort(a < b) ( #9321 )
2021-03-17 01:42:51 +01:00
Nick Treleaven
446631ceb5
checker: fixed array cannot implicitly convert to fooptr (again) ( #9302 )
2021-03-15 15:55:07 +02:00
Uwe Krüger
9d168895ed
checker: check write access to shared elements of `struct` and `array` ( #9314 )
2021-03-15 15:54:06 +02:00
Alexander Medvednikov
167dcc415d
tests: fix a generic init test
2021-03-13 18:46:02 +03:00
Alexander Medvednikov
2f1810634e
checker: do not allow direct initialization of builtin types (s := string{})
2021-03-13 18:20:46 +03:00
Nick Treleaven
9db8a61b92
checker: disallow array append in an expression ( #9265 )
2021-03-12 16:09:01 +01:00
Uwe Krüger
dbbf96702b
checker: require `shared a` to be `rlocked` to read `a[i]` or `a.e` ( #9266 )
2021-03-12 16:08:39 +01:00
Nick Treleaven
e229d0c1c3
checker: improve error message for invalid property ( #9263 )
2021-03-12 14:18:52 +02:00
yuyi
9fbb139e29
checker: check map copy error in fn_mut_arg ( #9242 )
2021-03-11 15:19:36 +01:00
Miccah
f26d2f02b7
ast, cgen, checker, parser: support method arguments in comptime $for ( #9208 )
2021-03-11 15:04:34 +02:00
yuyi
a547e889af
checker: check array literal modify error ( #9243 )
2021-03-11 14:57:04 +02:00
Delyan Angelov
5a231326d7
parser: improve syntax errors in module declarations
2021-03-11 10:42:36 +02:00
StunxFS
6a7ef4f5b2
v.scanner: fix position of hash statements ( #9222 )
2021-03-10 20:23:17 +02:00
yuyi
a187a4abb3
checker: check non-optional fn return or_block ( #9227 )
2021-03-10 12:53:23 +01:00
Delyan Angelov
0d2bb714bc
checker: disallow `x := [13]SumType{}` too
2021-03-10 11:07:36 +02:00
spaceface
f1469a8761
checker: allow accessing fields common to all sumtype members ( #9201 )
2021-03-09 19:16:18 +02:00
yuyi
10c9f61d61
checker: check empty map invalid syntax ( fix #9162 ) ( #9186 )
2021-03-08 19:48:17 +02:00
yuyi
1b47e2953d
checker: check undefined ident of struct ( #9164 )
2021-03-07 14:09:38 +01:00
Delyan Angelov
f1c4e962f4
tests: add tests for `-d debug`, `-cg`, `-g` in combination for `[if debug]fn` etc
2021-03-07 12:42:30 +02:00
Delyan Angelov
849cde245c
v: support dump(expr) ( #9160 )
2021-03-06 18:09:28 +01:00
joe-conigliaro
2d73411396
checker: define missing C fn args & check C & JS args ( #8770 )
2021-03-05 17:41:11 +03:00
Delyan Angelov
0f042124cb
tests: support `fn test_fn() ? { opt()? }`
2021-03-05 14:18:21 +02:00
zakuro
4f02da00ba
checker: check arguments count of sort ( #9105 )
2021-03-04 15:22:47 +02:00
zakuro
9bb073580e
checker: replace checking type exists with c.ensure_type_exists ( #9100 )
2021-03-04 12:28:48 +02:00
Nick Treleaven
412c17ccda
checker: check private built-in methods are not accessible ( #9062 )
2021-03-03 11:12:50 +02:00
zakuro
c74fa9e471
checker: correct pos for type error of `if v is interface` ( #9080 )
2021-03-03 09:23:39 +02:00
Joe Conigliaro
a50f2ca5e8
interfaces: error on implemention of own interface method & on duplicate normal methods
2021-03-03 15:02:10 +11:00
Delyan Angelov
d0e8e8f178
checker: add error for `print( voidfn() )`
2021-03-02 17:54:38 +02:00
Nick Treleaven
dc04c3196b
builder: fix detecting duplicate functions ( #9033 )
2021-03-01 21:38:31 +01:00
zakuro
ce115dcbe0
builtin: correct error underline for unicode wide chars ( #9010 )
2021-03-01 00:18:02 +01:00
Uwe Krüger
e937d6249c
cgen: fix various issues concerning optionals ( #9021 )
2021-02-28 23:21:03 +01:00
spaceface
d63b7bc35a
all: update repo to use the new error handling syntax ( #8950 )
2021-02-28 23:20:21 +03:00
Delyan Angelov
e354dcefc2
fmt: fix support for `mut static x := 42`
2021-02-28 19:40:21 +02:00
Delyan Angelov
4076e8eaa0
tmpl: add a tmpl_all_in_one_folder.vv test; fix for static_vars_in_translated_mode.vv
2021-02-28 19:14:19 +02:00
Delyan Angelov
e564269477
ci: fix static_vars_in_translated_mode.vv
2021-02-28 18:55:25 +02:00
Nick Treleaven
a1244a9f5f
checker: check that the module `init` fn, should have no params, and no return type ( #8988 )
2021-02-27 11:11:20 +02:00
Uwe Krüger
f67bff1696
all: support `thread` handles and `wait()` for functions returning optionals ( #8990 )
2021-02-27 10:16:55 +02:00
Nick Treleaven
8874379c48
checker: check left selector expression in `$if left is right` ( #8987 )
2021-02-26 21:51:35 +01:00
Nick Treleaven
4ad95cfeaf
checker: check types with $for/$if introspection ( #8984 )
2021-02-26 15:26:50 +01:00
Nick Treleaven
59d4d0ef1d
checker: detect unknown type to iterate with $for ( #8971 )
2021-02-26 08:28:19 +02:00
Nick Treleaven
3a082621c9
checker: add a check for casting to an unknown type ( #8968 )
2021-02-26 08:26:36 +02:00
Nick Treleaven
c03798e390
checker: disallow implicit conversion from fixed array to fooptr ( #8823 )
2021-02-26 00:28:47 +01:00
Nick Treleaven
57d1b5b74d
checker: show position for variadic/shared/method argument errors ( #8939 )
2021-02-24 19:35:32 +01:00
yuyi
7a6fd359d0
checker: check fn_variadic with array_decompose ( #8894 )
2021-02-22 14:26:54 +01:00
Nicolas Sauzede
f67a4c3ee0
checker, cgen: allow | between bitfield enum values, autogenerate a more specific .str method for them too ( #8856 )
2021-02-20 21:51:54 +02:00
Nick Treleaven
28088cc494
checker: check fixed array index when it's a literal ( #8831 )
2021-02-20 20:18:47 +02:00
Nick Treleaven
1e71c0eaca
checker: warn for deprecated methods too ( #8861 )
2021-02-20 19:25:54 +02:00
Delyan Angelov
8327c9afc1
checker: support a custom `[deprecated: 'message']`
2021-02-20 17:35:44 +02:00
yuyi
5e1159e4c3
checker: change non-const size of fixed array error message ( #8850 )
2021-02-20 12:14:44 +01:00
Nick Treleaven
bcb35e15f9
checker: only allow passing integer *literal* to non-integer pointer method parameter ( #8825 )
2021-02-19 14:14:40 +02:00
zakuro
6e262b5d84
checker: improve error position of infix expr ( #8828 )
2021-02-19 12:38:41 +02:00
Swastik Baranwal
ad162cd6fc
checker: stricter `unknown type` checks, show better suggestions ( #8816 )
2021-02-19 11:23:13 +02:00
zakuro
1891ebf22d
scanner: print multibyte char for invalid char error ( #8804 )
2021-02-18 15:43:39 +02:00
yuyi
a119affeba
cgen: check unknown sizeof type ( #8815 )
2021-02-18 09:38:57 +02:00
Nick Treleaven
0f8edd918a
checker: disallow `unsafe` map copy ( #8720 )
2021-02-17 05:19:25 +01:00
Uwe Krüger
0520b755f4
checker/cgen: support `print*()`, `.str()` and '$x' for `shared` ( #8771 )
2021-02-16 12:40:13 +01:00
Nick Treleaven
c057b45bb1
checker: check argument count for C fn with attribute ( #8728 )
2021-02-15 18:56:26 +02:00
zakuro
2911f03627
checker: reject method that have multi-value type receiver ( #8696 )
2021-02-15 17:55:54 +02:00
Nick Treleaven
629d43caf5
checker: warn when using `goto` outside of `unsafe` ( #8741 )
2021-02-15 15:48:24 +02:00
zakuro
e534b4397d
checker: report correct position for non-bool cond error ( #8735 )
2021-02-14 19:19:41 +01:00
zakuro
e4f15605c0
checker: reject void type condition ( #8737 )
2021-02-14 07:33:24 +01:00
Uwe Krüger
374739b804
all: rename `[ref_only]` -> `[heap]` ( #8718 )
2021-02-13 16:52:01 +02:00
Uwe Krüger
40066a5daa
checker: obey [ref_only] tag, allow embedding in other ref struct ( #8707 )
2021-02-13 00:47:37 +01:00
glebbash
aa548f45ea
docs: fix functions in array/map example ( #8695 )
2021-02-12 21:10:54 +02:00
Joe Conigliaro
c904c9178d
checker: support ParExpr for trying to take address errors & simplify messages
2021-02-13 02:49:22 +11:00
Nick Treleaven
84a16d8684
map: add `move` method ( #8660 )
2021-02-12 02:02:33 +02:00
Nick Treleaven
375efb0953
checker: improve errors for `return` count mismatch ( #8686 )
2021-02-12 01:47:11 +02:00
Nick Treleaven
d37fb5641f
parser: improve printing of unexpected tokens ( #8654 )
2021-02-09 17:07:30 +02:00
zakuro
8ae23cd89e
parser: make `v := f(v)' an undefined variable error ( #8634 )
2021-02-08 16:55:01 +02:00
Uwe Krüger
cf230644b6
fmt: enable shared return types ( #8614 )
2021-02-06 21:25:06 +01:00
yuyi
1b6efebac7
all: fix map = map2 assignment ( #8581 )
2021-02-06 03:06:34 +01:00
zakuro
6b776e686e
parser: display correct position on boolean expression error ( #8563 )
2021-02-05 16:52:35 +01:00
zakuro
a94228bb16
checker: make `[] == ArrayAlias([])` an error ( #8562 )
2021-02-05 16:49:40 +01:00
pancake
27239db427
builder: show file:line when import fails ( #8537 )
2021-02-04 09:09:54 +02:00
Nick Treleaven
de37b52d4b
checker: check goto label exists ( #8523 )
2021-02-03 15:20:10 +01:00
Swastik Baranwal
7ec116d588
all: only allow defining `==` and `<` and auto generate `!=`, `>`, `>=` and `<=` ( #8520 )
2021-02-03 15:18:38 +01:00
Uwe Krüger
9dcf673216
all: make `lock` and `rlock` dead lock free :-) ( #8534 )
2021-02-03 15:16:52 +01:00
yuyi
b40252bd97
checker: merge array_filter_fn_err tests ( #8506 )
2021-02-03 11:27:11 +02:00
yuyi
9bcb57eb1f
checker: merge array_map_fn_err tests ( #8507 )
2021-02-03 11:26:26 +02:00
zakuro
e30e794884
checker: add check for using a private const in another module ( #8501 )
2021-02-03 10:17:13 +02:00
Uwe Krüger
df0520b43a
checker,cgen: make `shared` behave like `mut` inside `lock` - and like non-mut inside `rlock` ( #8526 )
2021-02-03 01:20:19 +02:00
Daniel Däschle
d477e525bb
checker/gen: fix generic struct init ( #8322 )
2021-02-03 00:42:00 +11:00
Nick Treleaven
79e9084f7b
checker: allow `Struct{...expr}` where `expr` is another struct type ( #8495 )
2021-02-01 20:08:25 +01:00
Nick Treleaven
c537578481
checker: ensure `expr` is an lvalue with `Struct{...expr` ( #8489 )
2021-02-01 15:18:03 +01: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
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
Nick Treleaven
c0685eeefc
parser: add warning for s.$field.name without brackets ( #8411 )
2021-01-30 12:56:10 +01: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
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
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
Alexander Medvednikov
d86cb67eda
checker: add a test for the single letter receiver
2021-01-28 11:13:51 +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
zakuro
8162396783
checker: deny multi-value in a singe-value context ( #8328 )
2021-01-27 23:10:51 +02: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
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
Delyan Angelov
a5b10b5539
parser: improve the error message for unexpected keywords
2021-01-25 15:29:07 +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
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
zakuro
9812230847
checker: make the no-body main function a checker error ( #8211 )
2021-01-23 10:30:26 +02:00
Louis Schmieder
e06e8b10cd
orm: fix empty struct and simplify ( #8246 )
2021-01-22 23:28:26 +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
zakuro
522d875489
checker: make it an error, to use ident outside of anon fn ( #8232 )
2021-01-22 09:24:49 +02:00
Louis Schmieder
6b1956fb60
checker: fix warning at comptime call ( #8248 )
2021-01-21 21:36:11 +02: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
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
Swastik Baranwal
6f1ae65811
parser: add a warning for only else branch in match ( #8185 )
2021-01-18 18:31:36 +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
Swastik Baranwal
ef627c9d21
checker: improve message and positioning for operator overloading ( #8133 )
2021-01-17 03:37:44 +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
Nick Treleaven
0f2a770b9c
checker: improve errors for interface method compatibility ( #8097 )
2021-01-13 23:44:29 +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
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
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
Daniel Däschle
1ce93536d0
checker: fix panic in generic methods ( #7944 )
2021-01-08 00:50:59 +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
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
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
Daniel Däschle
164d7bf5fb
parser: struct updating syntax with `Abc{...oldabc newfield: val}` ( #7865 )
2021-01-04 20:19:03 +02:00
Uwe Krüger
4a25c2bb6f
types: rename `any_*`, `untyped *` -> `* literal` ( #7845 )
2021-01-04 00:11:09 +02:00
Delyan Angelov
d86304b7d0
v.table: use the user readable names inside type_to_str_using_aliases for `any_int` and `any_float`
2021-01-03 22:15:18 +02:00
Delyan Angelov
ff1156cddd
ci: run `VAUTOFIX=1 ./v vlib/v/compiler_errors_test.v` to fix ci failures
2021-01-03 19:03:20 +02:00
Joe Conigliaro
70b921c49d
all: change any_int & any_flt display name
2021-01-04 03:20:52 +11:00
Enzo
9332f7cac2
checker: allow `map` method name ( #7834 )
2021-01-03 16:57:29 +01:00
StunxFS
b7f83e2f50
checker: more errors for illegal referencing ( #7755 )
2021-01-03 15:56:15 +01:00
Enzo
529f46d808
checker: don't panic on non-array decomposition ( #7836 )
2021-01-03 15:45:39 +01:00
Nick Treleaven
9243e06dba
parser: allow integer and rune keys for map literal ( #7756 )
2021-01-01 17:23:32 +01:00
Swastik Baranwal
24b18f05c4
cgen: implement > and < for structs ( #7774 )
2021-01-01 14:54:32 +01:00
Joe Conigliaro
e9f9f27e49
checker: fix formatting in tests/web_routing_checks.out
2021-01-01 08:01:00 +11:00
Alexander Medvednikov
2bc9ee4d88
vweb: more updates
2020-12-31 17:47:20 +01:00
Alexander Medvednikov
2533c706ae
vweb: migrate all tests and examples to the new syntax
2020-12-31 17:22:47 +01:00
Uwe Krüger
74ea5ac99f
checker: check reference return to be really reference ( #7739 )
2020-12-31 12:42:22 +01:00
Swastik Baranwal
a9ab79d301
checker: ban any_int/any_float outside buitlin ( #7675 )
2020-12-31 12:41:30 +01:00
Swastik Baranwal
a834f33661
checker: add checks for operator overloading ( #7737 )
2020-12-31 12:38:10 +01:00
StunxFS
13cd7e88ef
checker: error taking the address of a boolean literal ( #7716 )
2020-12-30 17:21:15 +01:00
joe-conigliaro
02965e753e
all: re-implement variadics using arrays & implement array decomposition to varg ( #7689 )
2020-12-29 16:14:08 +01:00
Delyan Angelov
6cf3b96a37
ci: fix .out files after 40ce18f
2020-12-29 16:10:55 +02:00
Alexander Medvednikov
40ce18fa3c
checker: handle unwrapped optionals in infix exprs
2020-12-29 13:49:43 +01:00
Delyan Angelov
df61cf246b
cgen: fix `x.interface_field = value_implementing_interface` ( closes #7620 )
2020-12-27 19:12:39 +02:00
Nick Treleaven
e813583bc1
checker: support integer and voidptr key types for maps ( #7503 )
2020-12-27 14:18:46 +01:00
Daniel Däschle
b27f5c378c
all: reimplement struct embedding with methods ( #7506 )
2020-12-23 19:12:49 +01:00
yuyi
8f4281b790
checker: merge minus_op_wrong_type_err tests to just one ( #7489 )
2020-12-23 10:16:04 +02:00
yuyi
b08fe73614
checker: merge mod_op_wrong_type_err tests to just one ( #7490 )
2020-12-23 10:15:25 +02:00
yuyi
0dd385d480
checker: merge mul_op_wrong_type_err tests to just one ( #7491 )
2020-12-23 10:14:32 +02:00
yuyi
36cc70983e
checker: merge div_op_wrong_type_err tests to just one ( #7493 )
2020-12-23 10:14:08 +02:00
yuyi
5283811055
checker: merge add_op_wrong_type_err tests to just one ( #7488 )
2020-12-23 10:13:46 +02:00
yuyi
1c64635d61
checker: fix multi_array type mismatch check ( #7486 )
2020-12-23 08:05:44 +02:00
Ned Palacios
06369a27c2
parser: return incomplete selector expr stmt ( #7465 )
2020-12-22 13:00:23 +01:00
Lukas Neubert
5cd2dffafb
checker: error, when same type is used multiple times in a sum type ( #7432 )
2020-12-21 22:05:50 +02:00
Lukas Neubert
304aafdc50
fmt: add a space after + operator/method overload ( #7453 )
2020-12-21 21:20:00 +02:00
Alexander Medvednikov
4fc5e83771
checker: never allow taking the address of map values
2020-12-20 07:55:23 +01:00
Swastik Baranwal
1a2c7cd336
checker: add more casts checks ( #7355 )
2020-12-16 17:50:39 +01:00
Swastik Baranwal
da9588c1a5
checker: fix struct cast ( #7308 )
2020-12-15 04:30:51 +01:00
LilEnvy
0aacc9a80a
array: [].map(fn...) return type can be different than original type ( #7300 )
2020-12-13 03:29:48 +01:00
Nick Treleaven
d785e22a6e
checker: disallow assigning number to pointer ( #7267 )
2020-12-12 10:42:07 +01:00
joe-conigliaro
90b5f6f4e0
checker: add tests for assign sum type to non sum type error
2020-12-11 21:52:25 +11:00
Enzo
04346e7ba5
checker: allow void,char,byteptr to be mut args ( #7239 )
2020-12-11 04:47:10 +01:00
spaceface777
ca2c082a5e
checker: initial support for evaluating expressions at compile time ( #7248 )
2020-12-11 04:46:06 +01:00
yuyi
c4e76e6a59
checker: check div/mod by zero ( #7256 )
2020-12-11 04:44:07 +01:00
Daniel Däschle
916a64935a
checker: fix sumtype matching test ( #7235 )
2020-12-10 17:22:54 +02:00
Daniel Däschle
f6a2dba7ff
parser: refactor args count error ( #7238 )
2020-12-10 16:42:30 +02:00
Daniel Däschle
1f952330c4
parser: fix fn args eol errors ( #7222 )
2020-12-10 11:56:08 +02:00
Daniel Däschle
a38fe4fca9
checker: fix smartcast inside smartcast ( #7215 )
2020-12-10 00:59:39 +01:00
Nick Treleaven
92a8db5b2b
checker: remove duplicated unsafe tests ( #7216 )
2020-12-09 19:57:15 +01:00
Nick Treleaven
63557d0d02
checker: disallow op= and infix on a voidptr ( #7175 )
2020-12-07 22:43:38 +02:00
Nick Treleaven
a100b05647
checker: improve 'operator not defined on right operand type' error ( #7185 )
2020-12-07 18:37:17 +01:00
Delyan Angelov
d38bca5958
checker: tweak the import private function message a little
2020-12-07 19:22:37 +02:00
joe-conigliaro
78a6795319
all: change the way import symbols work & support consts ( #7182 )
2020-12-07 19:13:03 +02:00
joe-conigliaro
a05408b49a
all: make type system use source name & cleanup storing name in fields
2020-12-06 14:55:08 +11:00
yuyi
29857cb9d6
checker: fix interpolation recursive str ( fix #1905 ) ( #7141 )
2020-12-05 21:41:54 +01:00
yuyi
595efbac5b
checker: fix or_block return &type mismatch ( #7138 )
2020-12-05 08:06:51 +02:00
yuyi
9b6a1552e9
checker: check match return mismatch type ( fix #6826 ) ( #7109 )
2020-12-03 21:14:23 +02:00
Daniel Däschle
558a756431
parser: fix position offset by 1 ( #7099 )
2020-12-03 11:25:06 +02:00
yuyi
30da85a4d5
checker: fix optional or_block {none} ( #7095 )
2020-12-03 01:03:17 +01:00
Lukas Neubert
8adc8ed103
parser: do not fail on comment direct after import ( #7071 )
2020-12-01 22:32:34 +02:00
Daniel Däschle
879d238887
cgen: initial option auto str support ( #7004 )
2020-12-01 04:00:23 +01:00
yuyi
0b96cd50e1
scanner: fix escape `\u` ( fix #6849 ) ( #7012 )
2020-11-29 17:01:40 +02:00
yuyi
f336c2c5cc
scanner: fix error of backslash escaping x in ident_string( fix #6850 ) ( #6994 )
2020-11-29 00:39:45 +02:00
Daniel Däschle
32c027a0bf
parser: disallow ptr type as sum type variant ( #6996 )
2020-11-28 23:40:40 +02:00
spaceface777
bbea7fb91f
docs: document the `[required]` struct attribute ( #6956 )
2020-11-27 15:37:12 +02:00
Daniel Däschle
52b627feb3
checker: check filter, map and sort left type ( #6952 )
2020-11-26 11:28:54 +01:00
Daniel Däschle
7d6f97259f
all: refactor UnionSumType to SumType ( #6944 )
2020-11-25 13:09:40 +02:00
Daniel Däschle
a042966082
all: remove old sumtype code ( #6937 )
2020-11-24 17:55:24 +01:00
Daniel Däschle
96539e43b5
all: nested sum types ( #6913 )
2020-11-23 16:16:13 +01:00
Nick Treleaven
51c737669d
checker: check labelled break/continue is inside a matching `for` loop ( #6910 )
2020-11-22 20:51:07 +01:00
Swastik Baranwal
650cdef8b4
checker: disallow array sum types without default field ( #6892 )
2020-11-21 00:07:25 +01:00
Delyan Angelov
3c4b87bfec
checker: add check against `fn test_opt() ?{}`
2020-11-20 15:12:53 +02:00
Daniel Däschle
ed874ffc5b
checker: fix sum type operator check ( #6815 )
2020-11-17 21:26:40 +01:00
Swastik Baranwal
4415feb2df
checker: disallow string(bool) ( #6863 )
2020-11-17 21:23:17 +01:00
Nick Treleaven
4882d338f0
checker: improve array literal element type mismatch error ( #6825 )
2020-11-16 00:41:24 +02:00
Daniel Däschle
20bec81678
checker: smartcast only if type is not mut ( #6841 )
2020-11-15 16:53:51 +02:00
Delyan Angelov
f995aa35ea
checker: add a check for `x := math.sin<f64>(0)`
2020-11-15 11:51:12 +02:00
Nick Treleaven
50163508f8
gen: implement type_name method for sum type instances ( #6802 )
2020-11-14 13:59:03 +02:00
Luke Edwards
a525397022
checker: improve wording on error messages ( #6799 )
2020-11-11 23:11:27 +02:00
Delyan Angelov
dd1717af34
checker: add a missing return regression test for if branches too
2020-11-11 18:06:13 +02:00
Delyan Angelov
8c241cb745
checker: check that fns with return values, and matches, do return
2020-11-11 17:23:57 +02:00
Daniel Däschle
6271798ce3
cgen: union sum types implementation ( #6745 )
2020-11-11 09:18:15 +01:00
Nick Treleaven
baf2ff1a91
checker: unify invalid argument errors, use argument position ( #6785 )
2020-11-10 10:40:50 +01:00
pancake
2994e7150f
vweb: check function and route parameter count ( #6761 )
2020-11-08 09:14:24 +01:00
Delyan Angelov
0ba5544446
checker: add a check for `ptr = Abc{}`
2020-11-07 21:19:46 +02:00
Swastik Baranwal
6354fa031c
checker: add more checks for index_expr ( #6737 )
2020-11-07 14:55:05 +01:00
Nick Treleaven
ca8d23acab
table: make Table.type_to_str generate proper function type, not fn name ( #6716 )
2020-11-05 06:34:56 +01:00
Daniel Däschle
a2fc19880a
parser: fixes or block position ( #6736 )
2020-11-04 16:02:01 +02:00
Delyan Angelov
9eb655e65c
all: add .pos fields to all AST nodes, to avoid wrong positions in error messages
2020-11-04 13:34:12 +02:00
Delyan Angelov
4e760c703e
checker: disallow `opt_returning_string() or { ... 123 }` ( closes #6711 )
2020-11-02 05:29:37 +02:00
Daniel Däschle
d5a421e3f5
checker: add alias cast type check ( closes #6705 ) ( #6709 )
2020-11-02 01:17:35 +01:00
Delyan Angelov
3c0f4c46fa
checker: add check preventing `if x:=non_optional() {}`
2020-11-02 01:58:07 +02:00
Alexander Medvednikov
2c75b1397c
all: struct embedding
2020-10-30 07:09:26 +01:00
Delyan Angelov
ac6fad6a63
checker: fix comptime custom defines usages, add tests
2020-10-24 15:06:51 +03:00
Swastik Baranwal
019e3b2f4a
checker: add error for ast.PrefixExpr on the left side of decl_assign ( #6660 )
2020-10-21 17:37:30 +02:00
Swastik Baranwal
acc85be5ae
checker: disallow type casting to `none` ( #6635 )
2020-10-17 20:02:30 +03:00
Delyan Angelov
3c2202572b
cgen: produce cleaner error on missing C headers (with optional explanation) ( #6637 )
...
Implements support for `#include <openssl/rand.h> # Please install OpenSSL`.
2020-10-17 18:27:06 +03:00
Enzo
b083f4014b
fmt: fix multiple things and format most of the compiler ( #6631 )
...
Format expressions inside string interpolation like the rest (it used to be a+b instead of a + b, not too sure why)
Fix formatting some match branches when there were only one statement inside (it was inlined)
Fix parsing and formatting some comments edge case on struct field init. You should check out this test because the result is a bit different from before. I personally find it more logical but I would understand if the former format was to stay
Fix formatting of void-returning function signature
2020-10-15 22:12:59 +02:00
Nick Treleaven
3c336b566d
checker: add check_expected() which returns an optional error ( #6623 )
2020-10-15 17:30:36 +02:00
Alexander Medvednikov
3d4ab7de1e
checker: update tests
2020-10-15 12:39:32 +02:00
Nick Treleaven
b677ad9ca5
checker: fix panic on match expression without results ( #6597 )
2020-10-10 15:42:40 +02:00
Delyan Angelov
e862fad917
parser: support `mut static x := y` in -translated mode
2020-10-09 22:24:21 +03:00
Nick Treleaven
36706126fd
checker - improve error for `as` casting on non-sum type ( #6587 )
2020-10-09 16:12:12 +02:00
Nick Treleaven
f734f8167b
checker: improve error message for match branch type mismatch ( #6588 )
2020-10-09 16:11:11 +02:00
Nick Treleaven
92630a2821
checker: error if assigning to a function ( #6581 )
2020-10-09 00:48:39 +02:00
Swastik Baranwal
aea52af9ae
checker: add is_mut check for disallowing taking address of map's key and array's element outside unsafe ( #6573 )
2020-10-08 09:37:18 +03:00
Swastik Baranwal
d77669da80
test: add tests for disallowing map/array get element/key address ( #6568 )
2020-10-05 18:40:51 +03:00
Swastik Baranwal
7e13518cc2
parser: disallow match expr at certain places ( #6490 )
2020-10-03 16:30:58 +03:00
Henrixounez
c9574ae7d7
syntax: new global variable declaration syntax ( #6540 )
2020-10-03 07:03:44 +02:00
Swastik Baranwal
c8a884f57f
checker: fix typos in chan ( #6539 )
2020-10-03 06:59:30 +02:00
Nick Treleaven
7c86b03505
checker: don't error if last statement in match branch produces a value ( #6523 )
2020-10-02 09:33:04 +02:00
Henrixounez
a57e01fee7
parser: dont allow single letter enums ( #6526 )
2020-10-01 23:29:49 +03:00
Henrixounez
0f1ed1ca09
scanner: add an error for unfinished string literals ( #6519 )
2020-10-01 16:40:59 +03:00
Delyan Angelov
11b16a63cf
checker: add a suggestion for misspelled struct field name errors
2020-10-01 15:36:47 +03:00
Enzo
324d547cdb
parser: allow multiple types in match branch ( #6505 )
2020-10-01 01:07:36 +02:00
Nick Treleaven
18be7b115a
checker: disallow most statements in if/match expression branches ( #6509 )
2020-09-30 16:06:22 +02:00
Daniel Däschle
abc98c273c
parser: require assign on type alias ( #6477 )
2020-09-25 12:02:32 +02:00
Daniel Däschle
e384dea8ac
checker: add error for amp on literals ( #6467 )
2020-09-24 21:13:46 +02:00
Nick Treleaven
2886b1c67d
checker: require binary operands for &&, || ( #6449 )
2020-09-23 20:48:25 +02:00
Swastik Baranwal
077b597bd8
scanner/parser: change error msgs for `\0` and `\x00` and add error for r`byte` and c`byte` ( #6436 )
2020-09-21 17:34:24 +03:00
Henrixounez
e429a77de2
gen: named imported structs operator overloading and str methods ( #6433 )
2020-09-20 19:51:14 +02:00
Henrixounez
5086fd537c
checker: prompt error on implicit int overflow by literal ( #6410 )
2020-09-20 16:29:01 +02:00
Enzo
3126ae305c
checker: verify use of blank identifier ( #6412 )
2020-09-18 23:47:50 +02:00
Henrixounez
c02a0f90df
checker: prompt error on script expression while inside a file with main ( #6400 )
2020-09-18 01:14:14 +02:00
Nick Treleaven
14743458e5
checker: tweak error messages for `or` block; use proper type names ( #6377 )
2020-09-18 01:09:00 +02:00
Nick Treleaven
69c592e0d6
checker: disallow infix op on an optional type ( #6406 )
2020-09-18 01:03:55 +02:00
Henrixounez
99574e465d
scanner: allow escape on null character ( #6404 )
2020-09-18 01:02:06 +02:00
Enzo
a1e127ae46
checker: check type in `is` InfixExpr ( #6407 )
2020-09-18 01:01:05 +02:00
spaceface777
ff92c3409d
ast: merge `IfExpr` and `CompIf` ( #6011 )
2020-09-18 00:58:54 +02:00
Delyan Angelov
37311883c1
tests: add optional_method_err.vv
2020-09-12 13:12:06 +03:00
Delyan Angelov
0801f88d0a
tests: cleanup vlib/v/checker/tests/run ; add unused_variable_warning.vv
2020-09-12 12:33:17 +03:00
Daniel Däschle
ce62f997f3
all: better type error positions ( #6345 )
2020-09-11 14:37:14 +02:00
Alexander Medvednikov
bc8aab4775
checker: fix := test
2020-09-09 17:59:51 +02:00
Alexander Medvednikov
3956ea4665
Revert "checker: fix := test"
...
This reverts commit 818220de45
.
2020-09-09 17:55:48 +02:00
Alexander Medvednikov
818220de45
checker: fix := test
2020-09-09 17:50:14 +02:00
Daniel Däschle
3a146a6dbe
checker: fix error pos on default value ( #6338 )
2020-09-09 15:34:41 +02:00
Alexander Medvednikov
925f1781b3
checker: default field fixes
2020-09-09 14:05:56 +02:00
Alexander Medvednikov
e018509ba6
checker: test for unnecessary default struct field values
2020-09-09 13:59:52 +02:00
Swastik Baranwal
ea2b2ebc07
checker: modify error messages for ptrs ( #6325 )
2020-09-09 10:07:58 +02:00
Nick Treleaven
49c322f120
checker: simplify argument qualifier errors ( #6321 )
2020-09-08 19:34:17 +02:00
Uwe Krüger
2cb711ee15
checker/channels: check `mut`/`&` state of transmitted objects ( #6315 )
2020-09-06 21:24:41 +02:00
Xavier B
8ef55bd8c9
checker: add checks for map key/value types ( #6283 )
2020-09-04 23:59:54 +02:00
spaceface777
35cbca96e1
checker: implement `[required]` struct field attribute ( #6276 )
2020-08-31 23:15:40 +02:00
spaceface777
bd304f1141
checker: check number of fields in short struct inits ( #6280 )
2020-08-31 22:17:59 +02:00
Nick Treleaven
7dbae14e19
checker: error on `mut name =` ( #6247 )
2020-08-28 20:07:32 +03:00
Swastik Baranwal
39bf02ea68
checker: add error for arr1 <,>,>=,<= arr2 ( #6243 )
2020-08-28 11:08:07 +03:00
Delyan Angelov
f73506be49
tests: fix some byte->rune errors
2020-08-27 12:08:05 +03:00
Delyan Angelov
99dd72efea
tests: add another test for 47f59d3
2020-08-26 11:46:29 +03:00
Delyan Angelov
47f59d3fb6
v.scanner: fix error line numbers when comments end with CRLF
2020-08-26 11:39:32 +03:00
Delyan Angelov
86dfd3902f
tests: use .vv files directly in compiler_errors_test.v
2020-08-25 18:14:06 +03:00
Nick Treleaven
acc5c95f0d
checker: error with `*expr` if not a pointer ( #6211 )
2020-08-24 17:19:17 +02:00
Swastik Baranwal
b2e79dbebd
parser: add an error for `import mod.sub as mod` and `import mod as mod` ( #6194 )
2020-08-23 02:12:25 +02:00
Daniel Däschle
fcc61a981d
all: TypeSymbol.source_name ( #6187 )
2020-08-22 12:29:15 +02:00
Delyan Angelov
06967d9297
sort: require a mutable receiver
2020-08-21 21:19:37 +03:00
Nick Treleaven
217f04e311
checker: disallow casting to bool, use `some_int != 0` instead ( #6138 )
2020-08-19 14:37:55 +02:00
Swastik Baranwal
46b4e2a0cd
checker: check`match` types ( #6149 )
2020-08-17 20:19:21 +02:00
Uwe Krüger
9a5f040f72
all: handle `<-` arrow token for channel operations ( #6152 )
2020-08-17 20:12:00 +02:00
Nick Treleaven
6ba6a22a77
checker: prevent from casting non-struct to struct ( #6143 )
2020-08-17 11:19:44 +02:00
Alexander Medvednikov
b2059c481a
checker: fix an incorrect name test
2020-08-16 19:24:00 +02:00
Alexander Medvednikov
f965ddae49
parser: handle several errors in types; cgen: objC includes
2020-08-16 19:16:59 +02:00
Enzo
a02593204f
checker: forbid aliasing an alias ( #6118 )
2020-08-16 04:53:16 +02:00
Daniel Däschle
b2fee21ef3
checker: check struct casting ( #5864 )
2020-08-14 14:57:08 +02:00
Alexander Medvednikov
fc1f41fc84
checker: fix a string error test
2020-08-13 23:33:18 +02:00
Delyan Angelov
da7adb5b1b
ci: fix failing tests for compiler_errors_test.v
2020-08-13 13:16:41 +03:00
Swastik Baranwal
9fdb1701e0
checker: add a check for str[i] = `a` ( #6107 )
2020-08-11 17:41:54 +02:00
Alexander Medvednikov
c5aa2bfa51
tests: fix a match test
2020-08-11 16:26:52 +02:00
Alexander Medvednikov
2dd82748e0
checker: simplify << error message
2020-08-11 01:01:33 +02:00
Delyan Angelov
36eae1c175
builtin: x.vstring() instead of string(x) ( #6102 )
2020-08-10 18:05:26 +02:00
Nick Treleaven
6cc8815931
parser: support [unsafe] instead of [unsafe_fn] ( #6066 )
2020-08-08 16:24:05 +02:00
Delyan Angelov
91c9c0c917
checker: fix unknown_method_suggest_name.out test result too
2020-07-30 19:37:36 +03:00
Delyan Angelov
f300f787f3
checker: add suggestions for method mispellings and unknown types
2020-07-30 18:48:16 +03:00
Delyan Angelov
9c9533dad9
checker: add error for `fn f() Struct { return &Struct{} }` ( #6019 )
2020-07-29 21:40:43 +02:00
Swastik Baranwal
4500e7131e
checker: add a checker error for fn calls on left side of an assignment ( #5993 )
2020-07-29 18:33:00 +03:00
Delyan Angelov
9c028bb299
checker: fix passing enum to a method expecting string
2020-07-28 13:50:40 +03:00
Delyan Angelov
9d056168ae
ci: fix failing tests
2020-07-26 10:48:24 +03:00
Alexander Medvednikov
6796b93abd
tests: fix compiler_errors_test.v
2020-07-25 22:20:10 +02:00
Alexander Medvednikov
7c86156be5
checker: fix unsafe tests
2020-07-25 18:58:23 +02:00
Nick Treleaven
ee349691f9
v/checker: Warn about pointer indexing outside unsafe {} ( #5918 )
2020-07-22 20:28:53 +03:00
spaceface777
f4251dded0
checker: suggest using `:=` when assigning to undefined variable ( #5911 )
2020-07-21 19:49:53 +03:00
Nick Treleaven
15ca64d81d
tests: rename pointer_arithmetic_should_be_checked.vv -> unsafe_required.vv ( #5897 )
2020-07-20 23:04:22 +03:00
Nick Treleaven
a74cbf55c7
checker: warn if C.m* or C.s* functions are called outside unsafe blocks ( #5869 )
2020-07-20 20:06:41 +03:00
Nick Treleaven
e6fc8eb015
checker: check that array slicing indexes are valid ( #5892 )
2020-07-20 19:52:03 +03:00