Commit Graph

1364 Commits (535dcac8fad711546756e026423d1875312cfb3a)

Author SHA1 Message Date
zakuro 191a167f42
checker: allow omitting the enum name of map key (#9919) 2021-04-29 08:33:41 +03:00
Lukas Neubert a065d014a2
fmt: keep constant sizes in struct field fixed array types (#9910) 2021-04-28 22:11:15 +03:00
Uwe Krüger f4e92997f2
checker: support value array elements of `[heap]` type inside struct ref (#9899) 2021-04-28 07:47:00 +03:00
Louis Schmieder faf2656335
orm: support multiline statements (#9888) 2021-04-27 15:28:57 +03:00
yuyi 9f1ac39770
checker: fix generics with anon generics fn argument (fix #9859) (#9897)
* checker: fix generics with anon generics fn argument

* cgen: fix typedef of generics anon fn

* fix check generics argument types
2021-04-27 15:25:42 +03:00
pancake d8bb939072 native: fix tests, address comments and a little cleaner macho 2021-04-27 12:24:58 +03:00
pancake a31a1eb9cb native: define println and exit builtins or verror() 2021-04-27 12:24:58 +03:00
pancake 9a3869c521 v.ast: rename aarch64 to arm64 and aarch32 to arm32 2021-04-27 12:24:58 +03:00
Don Park aebb551e93
cgen: do full struct initialisation for V structs, fixes invalid data from `map[string]Struct{}['unknown']` (#9878) 2021-04-27 08:18:48 +03:00
yuyi 3877522ee3
table,checker,cgen: fix generics with recursive generics struct (#9862) 2021-04-26 20:05:10 +03:00
yuyi 21d1f86ead
checker: fix generics that return reference generics struct (fix #6218) (#9869) 2021-04-26 20:01:01 +03:00
Enzo de8c4866a4
v.checker: fix postfix expr on generic types (#9887) 2021-04-26 19:57:05 +03:00
yuyi 2b43d3193b
checker: fix generics with assign generics struct (fix #7784) (#9889) 2021-04-26 19:54:22 +03:00
spaceface 7acb48df83
parser: parse `JS.` interfaces properly (#9876) 2021-04-26 09:58:05 +03:00
Uwe Krüger 3c0a368af3
all: automatically move (some) referenced objects to heap (#9873) 2021-04-25 21:40:38 +03:00
zakuro a0835ac139
checker/cgen: implement in expression for alias of array/map (#9871) 2021-04-25 18:17:54 +03:00
Alexander Medvednikov 7f5c3cc1f8 checker: do not allow modifying consts via mutable refs 2021-04-24 14:08:50 +03:00
yuyi 8ccdae6188
all: cleanup generics call_expr (#9856) 2021-04-24 09:44:15 +03:00
Enzo af8ef12990
ast: use `AttrKind` (#9845) 2021-04-23 15:51:52 +03:00
Enzo b4e4d48bbd
checker: make sure negation is only used with numeric types (#9854) 2021-04-23 15:18:56 +03:00
yuyi dd2002cc57
cgen: fix generics with multi generics struct receiver (#9853) 2021-04-23 15:17:57 +03:00
Alexander Medvednikov c7a6d28e13 all: improve unused variable warning (fix `x = 1`, `x += 1` etc) 2021-04-23 13:33:48 +03:00
Lukas Neubert aa40dfc1de
checker: check __global type (#9804) 2021-04-23 12:28:08 +03:00
yuyi 8e455495b2
checker: fix generics that return multi generics struct (#9852) 2021-04-23 11:19:16 +03:00
yuyi 431d806dcf
ast, parser: cleanup of generic structs (#9839) 2021-04-22 18:21:01 +03:00
zakuro 7443179cc8
checker: make use of private enum from outside module an error. (#9821) 2021-04-22 07:07:56 +03:00
yuyi d02822f456
ast.table: simplify resolve_generic_by_names/types() (#9834) 2021-04-21 12:22:42 +03:00
yuyi 7abf59710b
checker: check generic fn called no arg without generic names (#9825) 2021-04-20 21:36:21 +03:00
Ned Palacios 254d247e80
checker: return none if type is 0 in ensure_type_exists (#9820) 2021-04-20 12:11:41 +03:00
Delyan Angelov 9d8bda9eaf
v.ast, v.checker: fix absent 'missing return' warning, when a function ended with a t.panic() call 2021-04-20 11:49:06 +03:00
Delyan Angelov d4f31412b7
v: deprecate `@VROOT` in favour of `@VMODROOT` (#9795) 2021-04-19 19:01:47 +03:00
spaceface 73352583e7
ci: fix all `-cstrict` warnings with gcc and clang (#9792) 2021-04-19 15:38:48 +03:00
Ned Palacios dde3189e66
checker: avoid get_type_symbol panic inside array_init (#9800) 2021-04-19 14:58:30 +03:00
Uwe Krüger 8ab0d42b5f
checker: check argument for `chan.try_push/pop()` (#9798) 2021-04-19 11:41:21 +03:00
Henrixounez 4a1e2f9dcc
checker: working is none type check + no crash when checking with non types (#9793) 2021-04-18 16:28:39 +03:00
Henrixounez ee7bcfd05c
checker: prevent double module name prepending on generics types regi… (#9791) 2021-04-18 16:26:40 +03:00
yuyi 731e942055
checker: fix generics with different order of generics fn (#9765) 2021-04-17 08:29:06 +03:00
yuyi 8cb44ed9db
checker: fix generics with nested generics fn (#9757) 2021-04-16 11:53:20 +03:00
yuyi 466dc4540b
all: minor cleanup of generics (#9744) 2021-04-15 11:00:23 +03:00
Jarred Sumner 9d6caa1d5d
checker: fix segfault in vls for struct field declarations, having custom initializers with fn calls (#9741) 2021-04-15 08:49:25 +03:00
Alexander Medvednikov 3a134acc5a checker: orm: verify table type 2021-04-15 03:11:24 +03:00
yuyi 1250ce4353
cgen: fix generics with embed generics (fix #8694) (#9724) 2021-04-15 01:44:11 +02:00
crthpl 0099458c0a
all: small asm fixes and number labels (#9730) 2021-04-15 01:30:23 +02:00
Delyan Angelov 345868853e
checker: change wording of the error message for complex boolean expressions 2021-04-14 19:55:52 +03:00
crthpl 14434cc86a
all: bare metal support (fix `-freestanding`) (#9624) 2021-04-14 07:50:50 +02:00
Enzo 66294e359a
checker: add immutable_builtin_modify.vv test (#9702) 2021-04-13 06:55:41 +03:00
yuyi c3ccb58450
checker: check generics variadic arg mismatch (#9700) 2021-04-13 02:06:24 +02:00
yuyi b0b3c51658
checker: minor cleanup in fn_call (#9681) 2021-04-11 23:57:00 +02:00
Enzo 5a1a1b7c12
all: merge GoExpr and GoStmt (#9685) 2021-04-11 23:56:25 +02:00
Enzo a851901620
checker: allow casting bool to byte (#9676) 2021-04-11 13:24:24 +03:00
Uwe Krüger 954c436d28
checker/cgen: auto initialize `shared` elements of structs (#9669) 2021-04-11 10:30:23 +03:00
yuyi a2a18ef92c
v: simplify handling of function generic parameters (#9673) 2021-04-11 09:02:57 +03:00
Uwe Krüger 78c6e35bde
checker/cgen: fix `v := rlock m { m[key] or { default_val } }` (#9666) 2021-04-10 16:57:18 +02:00
yuyi cf64001474
checker: fix generics return generic struct (#9663) 2021-04-10 14:00:01 +03:00
yuyi bf6a2f80ef
checker: fix generics with generic struct receiver (#9658) 2021-04-10 04:00:53 +02:00
crthpl 903dd49212
v: add support for `$if freestanding {`, without using it (part 1) (#9656) 2021-04-09 23:24:25 +03:00
Ned Palacios 50f59674ce
ast, checker: make SelectorExpr.root_ident return ?Ident (#9647) 2021-04-09 18:06:40 +02:00
Caian R. Ertl ddb2e72301
checker: do not allow module aliases started with '_' (underscore) (#9588) 2021-04-09 13:14:27 +03:00
Uwe Krüger 84fa1ae444
boehm-gc: support a `[keep_args_alive]` tag for C functions (#9641) 2021-04-09 13:13:49 +03:00
spaceface 4feb09fa5b
checker, cgen: add sumtype-like smartcasting capabilites to interfaces (#9256) 2021-04-09 11:00:05 +03:00
yuyi e654d61541
checker: minor cleanup in check_or_expr() (#9635) 2021-04-08 08:21:42 +03:00
Enzo 9541eb816b
checker: remove unecessary assert (#9617) 2021-04-07 19:18:18 +02:00
yuyi 66fafe7b7b
checker: remove redundant code for generic structs (#9628) 2021-04-07 17:26:22 +02:00
yuyi fef4e1e700
checker: fix generics method return generics struct (#9614) 2021-04-07 15:27:58 +02:00
Lukas Neubert 3a07fbc653
fmt: improve match branch wrapping (#9619) 2021-04-07 15:26:10 +02:00
ka-weihe bca9409192
map: wrap up delete fix (#9626) 2021-04-07 14:12:12 +02:00
Alexander Medvednikov ff9837386a Revert "map: wrap up delete fix (#9601)"
This reverts commit cbcc0d34b5.
2021-04-07 03:40:43 +03:00
ka-weihe cbcc0d34b5
map: wrap up delete fix (#9601) 2021-04-06 15:57:08 +02:00
Delyan Angelov 0e94612535
checker: only allow `ptr += int` in unsafe blocks 2021-04-05 22:01:18 +03:00
Delyan Angelov d11fb8497a
ci: fix some of `v test-cleancode` 3 2021-04-05 21:21:46 +03:00
Ned Palacios 98e1dd4b22
checker: wrap print_backtraces with if is_verbose (#9595) 2021-04-05 18:19:20 +03:00
Ned Palacios 07b1dc66dd
ast, parser: add additional pos info for FnDecl and InterfaceDecl nodes (#9603) 2021-04-05 18:14:21 +03:00
Delyan Angelov 4cde74f120
checker: make the compiler stricter when checking pointers 2021-04-05 10:02:47 +03:00
Alexander Medvednikov 7b7602a2f9 checker: bring back automatic c'foo' in c calls 2021-04-05 06:36:06 +03:00
Alexander Medvednikov f3484345c7 checker: remove debugging info 2021-04-04 18:40:10 +03:00
Alexander Medvednikov 57e6138a61 all: remove byteptr and charptr; replace them with &byte and &char 2021-04-04 17:43:32 +03:00
yuyi 8dd4a63913
checker: minor cleanup of checker.v (#9585) 2021-04-04 16:05:29 +02:00
ka-weihe 337e447cfb
map: fix delete (part 1) (#9579) 2021-04-04 01:11:47 +02:00
Daniel Däschle 6a5f49afb1
all: support `?Type(none)` (#9567) 2021-04-02 16:34:48 +02:00
Conner 9ba8d02a5a
generics: add more checks (#9539) 2021-04-02 16:27:54 +02:00
Alexander Medvednikov fb302c6253 checker: fix compilation 2021-04-02 03:29:24 +03:00
Daniel Däschle d8efe249ce
checker: add check for call expr in map/filter (#9559) 2021-04-02 01:56:51 +02:00
Alexander Medvednikov 7385f8e56b all: a massive merge of ast and table modules 2021-04-02 01:57:09 +03:00
zakuro 0d1714cb0d
checker: check opt call in more places (#9538) 2021-04-01 11:49:13 +02:00
crthpl 8d5e310189
asm: make fixed labels possible as displacement (#9549) 2021-04-01 09:58:33 +03:00
Delyan Angelov 6daefde5cb
checker,ci: use c.note for "direct sum type init..."; fixes `/v -prod cmd/vls` 2021-03-31 12:38:54 +03:00
Alexander Medvednikov e2e7e5fd65 walker: skip EmptyExpr for now 2021-03-31 12:15:11 +03:00
Alexander Medvednikov 6f318be96c checker: do not allow nil sum types init 2021-03-31 11:13:52 +03:00
yuyi 5c21c748c9
builder,checker,table: simpify generics unwrap and struct processing (#9531) 2021-03-30 15:23:17 +03:00
Swastik Baranwal b40d06ec1e
cgen: fix operator overloading for array/map aliases (#9529) 2021-03-30 11:39:54 +02:00
yuyi 6143bd6232
generics: check generic_fn called arg mismatch (#9510) 2021-03-30 09:36:45 +02:00
Ned Palacios b319068151
ast, parser: implement simple AST poisoning (#9525) 2021-03-30 09:33:29 +02:00
Ned Palacios 999c385b7f
checker: add type check in interface fields (#9527) 2021-03-30 09:32:37 +02:00
yuyi 736df955ff
checker: cleanup of generic's unwrap_generic (#9495) 2021-03-29 11:15:45 +02:00
yuyi 92f19f5767
generics: fix generics_struct with generic array string (#9494) 2021-03-28 10:46:13 +02:00
Alexander Medvednikov 1e9d527d3c checker: fix the deref mut check 2021-03-26 12:21:22 +03:00
Alexander Medvednikov bb5958991c checker: warn about automatic (de)referencing; freetype: compilation flag fixes 2021-03-26 11:42:51 +03:00
yuyi 478bb9ce8e
parser, checker: fix generic fn that returns a generic struct (#9469) 2021-03-26 08:32:11 +02:00
Alexander Medvednikov 0c055a1ce9 all: s.contains(s2) instead of `in` 2021-03-23 11:38:56 +03:00
Ned Palacios aa4e22c287
scanner, token: add column information to tokens (#9407) 2021-03-23 06:23:46 +01:00
Lukas Neubert 1b572f75e8
fmt: minor array wrap improvement (#9420) 2021-03-22 23:06:12 +01: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
Delyan Angelov a386be6505
v.table: correct `table.types` to `table.type_symbols` 2021-03-19 22:51:52 +02:00
zakuro 95a748e8b0
checker: cleanup call_method (#9365) 2021-03-19 14:19:38 +02:00
Miccah 7222ee476b
all: implement array .any and .all (#9347) 2021-03-18 15:24: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
Enzo 4b6244c9c1
gen: fix generic variadic (#9333) 2021-03-17 00:18:43 +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
Anton Zavodchikov 1ad4623fb8
tmpl: move to v/parser (#9052) 2021-03-15 13:35:55 +02:00
Delyan Angelov 25c07c2f43
v.ast: handle more expressions in Expr.str() 2021-03-15 06:27:56 +02:00
yuyi 945769a4f6
all: implement reference receiver optimization for big structs (#9268) 2021-03-14 18:11:21 +01:00
StunxFS 92e95f127a
checker: correct type check for generic function with ternary if return (#9296) 2021-03-14 19:01:32 +02:00
spaceface 9ed9e7aff0
builtin: cleanup option names (part 1) (#9293) 2021-03-14 01:54:46 +01:00
spaceface e9797c618a
all: implement error interfaces (#9291) 2021-03-13 18:13:50 +01:00
Alexander Medvednikov 2f1810634e checker: do not allow direct initialization of builtin types (s := string{}) 2021-03-13 18:20:46 +03:00
spaceface be409b52e9
builtin: prepare for error interfaces (#9043) 2021-03-12 20:05:05 +02:00
StunxFS 3cb1bb7c36
checker: check the amount of parameters passed to `json.decode()` (#9267) 2021-03-12 19:02:09 +02: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 504b87bcfd
checker: minor cleanup in if_expr() (#9258) 2021-03-12 13:40:05 +02:00
StunxFS 04c4f16f75
checker: minor changes to `Checker.hash_stmt()` (#9249) 2021-03-11 21:43:42 +01:00
StunxFS 8f08795689
checker: warn/error about empty const blocks (#9252) 2021-03-11 21:43:04 +01: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
spaceface 7d0cba5e96
v.ast: remove the `stmt.position()` method (#9233) 2021-03-11 14:50:02 +02:00
zakuro f280a5c230
checker: extract into call_array_builtin_method to cleanup (#9225) 2021-03-10 20:19:39 +02:00
zakuro ef73e07e62
checker: split fn_decl into functions to cleanup (#9226) 2021-03-10 20:18:48 +02:00
zakuro 791dec7b01
v: support `$if prod` (#9228) 2021-03-10 19:26:34 +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
Delyan Angelov 96a9e16e64
checker: allow `a := [5*kb]byte{}` where `kb` is a compile time known const too 2021-03-09 20:21:36 +02:00
Delyan Angelov 26cfd0eda9
checker: eval `const a = 1024 * 1024` and other simple integer expressions at compile time 2021-03-09 20:07:08 +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
Lukas Neubert fdcfe397d4
fmt: write empty or blocks the same as empty fn bodies, empty structs, etc (#9136) 2021-03-06 21:04:51 +02:00
zakuro 7333b1706c
checker: minor cleanup: clear_flag(.optional) in check_expr_opt_call (#9139) 2021-03-06 20:42:34 +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
Gal Pasternak 208cabc994
checker: fix generic type ignores implemented interface (#9124) 2021-03-05 06:59:18 +02:00
zakuro 4f02da00ba
checker: check arguments count of sort (#9105) 2021-03-04 15:22:47 +02:00