Commit Graph

2186 Commits (a3c0a9b7915343bdf69719164df518ed2686a3b5)

Author SHA1 Message Date
yuyi ce4c2afc9c
checker, cgen: use 'stmts.last()' instead of 'stmts[stmts.len - 1]' (#14105) 2022-04-20 14:23:32 +03:00
yuyi 44ba19716b
checker: fix error for fn with multi return (#14095) 2022-04-20 13:09:40 +03:00
yuyi 0c3b69eaef
checker: fix error for assign array of aliases (#14096) 2022-04-20 13:08:47 +03:00
yuyi 8cc79e4299
checker: check error for arguments of array.contains() (#14102) 2022-04-20 11:00:59 +03:00
playX f6a0c26a85
checker: c2v fixes (#14091) 2022-04-20 01:09:34 +03:00
Delyan Angelov 006df58451
checker, cgen: add support for #insert, to simplify bootstrapping V 2022-04-19 19:37:04 +03:00
JalonSolov daf5d32327
checker: fix error message when number of generic parameters is incorrect (#14090) 2022-04-19 18:34:23 +03:00
yuyi 6164654d11
checker: check fn return type mismatch (#14081) 2022-04-19 13:04:41 +03:00
Nick Treleaven 4400efeb9f
checker: Revert part of small_unsigned == signed (#13967) (#14075)
`gcc -W` doesn't error for e.g. u16 == i32, only for u32 == i16.
Any u16 value can fit in an i32.
2022-04-18 21:30:09 +03:00
yuyi 7ef64bde50
checker: check error for fn decl with optional arguments (#14076) 2022-04-18 21:22:31 +03:00
yuyi fe371845da
ast, checker, cgen: fix aggregations type check (#14066) 2022-04-18 12:38:08 +03:00
yuyi 17c34b09a6
checker, cgen: minor cleanup of last expr stmt expression (#14057) 2022-04-17 14:08:43 +03:00
yuyi cb44f5981e
checker, cgen: fix error for if expr with generic sumtype (#14056) 2022-04-17 08:19:44 +03:00
Vincenzo Palazzo 4f14f7714f
checker: ensure that the variant SubType exists (#14053)
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-04-16 19:29:10 +03:00
Delyan Angelov 173e6a943b
checker: fix tests (adjust byte to u8 in .out files too) 2022-04-15 20:15:03 +03:00
Alexander Medvednikov 78cb6e2b41 all: handle fixed []u8 2022-04-15 18:35:56 +03:00
Alexander Medvednikov 1c6f63ac0a tests: use u8 everywhere 2022-04-15 18:34:15 +03:00
Alexander Medvednikov fbb9e65c0f all: ~500 more byte=>u8 2022-04-15 18:25:45 +03:00
Alexander Medvednikov fb192d949b all: replace []byte with []u8 2022-04-15 15:35:35 +03:00
Alexander Medvednikov 0527ac633e ast: remove .byte 2022-04-15 15:30:37 +03:00
Alexander Medvednikov d4a0d6f73c all: byte => u8 2022-04-15 14:58:56 +03:00
Alexander Medvednikov 014c3c97f0 all: byte => u8 2022-04-15 14:45:52 +03:00
Alexander Medvednikov e6ff1508d2 all: make u8 the primary type, byte the alias 2022-04-15 13:43:03 +03:00
Alexander Medvednikov 0dff050735 builtin: u8/byte clean up 2022-04-14 16:43:34 +03:00
Nick Treleaven c780de6282
checker: disallow 'small_unsigned == signed' (#13967) 2022-04-12 19:37:30 +03:00
Delyan Angelov 8788512c4d
checker: make using err.msg and err.code produce an *actual* notice, even with the present compatibility hack (will be *removed* in 2022-06-01) 2022-04-12 14:56:02 +03:00
Delyan Angelov 4c7cdd2a2d
checker,cgen: use faster `sym.idx == ast.error_type_idx` integer comparisons, instead of `sym.name == "IError"` 2022-04-12 14:49:51 +03:00
yuyi fa66183f43
checker: check error for map of generic struct init (#13999) 2022-04-11 10:07:23 +03:00
yuyi 93a5d03182
parser: improve embedded struct parsing/better error for `Architecture []string` (#13995) 2022-04-10 10:24:36 +03:00
yuyi 473bc0254d
checker: check error for array of generic struct init (#13987) 2022-04-09 21:50:34 +03:00
Delyan Angelov df30b79971
checker: allow for `arr.any(opt_fn()?)`, add test 2022-04-09 19:50:10 +03:00
Vincenzo Palazzo 2d867a2766
ast: fix reported errors, when arrays of types defined in modules are involved (#13952) 2022-04-08 17:38:34 +03:00
Joe Conigliaro a0c07454b1
checker: remove debug code from previous commit 2022-04-08 18:27:14 +10:00
Joe Conigliaro 426e9d1734
checker: fix condition for checking if tmpl var is inherited 2022-04-08 18:25:08 +10:00
Joe Conigliaro e1c8b07fa5
checker/tests: format test added in prev commit & rename chekcer prop 2022-04-08 17:41:23 +10:00
Joe Conigliaro 8dc2601080
all: comptime_call - simplify tmpl scoping, solves many issues. 2022-04-08 17:33:24 +10:00
crthpl b232a3b0d1
cgen: fix `.filter()` and `.map()` on shared arrays (#13954) 2022-04-07 18:05:11 +03:00
playX 6a820c2845
checker: allow all binary operations when translating code produced by c2v (#13964) 2022-04-07 12:22:24 +03:00
StunxFS 725b472d37
checker: fix typos (#13929) 2022-04-04 10:07:53 +03:00
Alexander Medvednikov a55e930c00 checker: fix pointer checks in translated code 2022-04-04 05:35:15 +03:00
Alexander Medvednikov cc227d8520 checker: fix non-numeric type check for translated code 2022-04-04 04:59:14 +03:00
Delyan Angelov 44603f8e59
checker: add suggestions for misspelled `mod.func_name()` calls 2022-04-03 20:07:52 +03:00
Vincenzo Palazzo 51c1d666c2
checker: fix operator overloads (for large structs with > 8 fields, the method receiver is normally auto converted to a reference) (#13889) 2022-04-03 19:30:29 +03:00
yuyi 0497b885dc
checker: minor cleanup in find_unreachable_statements_after_noreturn_calls() (#13903) 2022-04-03 11:19:19 +03:00
yuyi 0bf0c73a49
checker: fix error for returning optional (#13902) 2022-04-02 17:25:01 +03:00
Vincenzo Palazzo d7817863c6
checker: type inference over a generic type should compile (#13824) 2022-04-01 19:31:27 +03:00
yuyi bc98c11d9d
parser, checker, cgen: minor cleanup of go_expr() (#13875) 2022-03-31 19:58:04 +03:00
yuyi d40a502981
checker: minor cleanup in fn_call() (#13873) 2022-03-30 21:05:17 +03:00
Delyan Angelov cc637e5ee8
checker: make the misssing shared/mut modifer in fn and method calls error clearer 2022-03-30 01:45:40 +03:00
yuyi 55d9464890
checker: fix error for marking as referenced (#13859) 2022-03-30 01:33:10 +03:00
yuyi c71770d9c5
checker: fix error for array of anon fn call (#13858) 2022-03-29 18:04:30 +03:00
yuyi fd34ebd84e
checker: check the count of generics in fn arguments (#13855) 2022-03-29 10:04:19 +03:00
Nick Treleaven a4ab3c1f14
checker: disallow `mut_ptr = &immutable_var` (#13814) 2022-03-24 20:43:25 +02:00
Delyan Angelov 9bbb52e9cc
checker: add a check for `dump(c)`, where `typeof(c) == "char"` 2022-03-24 12:11:59 +02:00
yuyi 1566f7f766
checker: minor cleanup in check_types.v (#13816) 2022-03-24 08:59:05 +02:00
yuyi 35cd8112a5
ast, checker, cgen: fix error for printing alias that has str method (#13809) 2022-03-23 11:52:48 +02:00
Vincenzo Palazzo 8b072aa962
checker: check if generic values have the same types (#13718) 2022-03-23 09:13:10 +02:00
yuyi 0337882240
checker: check redefine global 'main' function (#13803) 2022-03-22 17:39:12 +02:00
yuyi d9cca53bd0
checker: check error for index of optional (#13785) 2022-03-21 10:17:57 +02:00
yuyi 0a78847782
checker: check error for unknown type in anon fn field of struct (#13778) 2022-03-20 13:28:35 +02:00
yuyi 8c3687aa10
checker: check error for struct field init with nobody anon fn (#13777) 2022-03-20 13:04:31 +02:00
yuyi 3e40cd5baa
ast, checker, cgen: fix error for go anon fn variable call (#13776) 2022-03-20 07:45:23 +02:00
yuyi 3e41be1ff4
checker: minor cleanup in check_or_last_stmt() (#13763) 2022-03-18 22:27:53 +02:00
yuyi 5f79fa8a30
checker: handle invalid smartcast with if/match none ident or selector (fix #12317) (#13762) 2022-03-18 17:50:54 +03:00
Delyan Angelov 817bedec5d
checker: show available sumtype variants in match branches on typos 2022-03-18 11:50:28 +02:00
Delyan Angelov 7a4715288c
checker: make the errors for call expression shared/mut mismatches more detailed 2022-03-16 22:45:35 +02:00
yuyi 315e07abf6
checker: minor cleanup in match_expr() (#13753) 2022-03-16 15:39:57 +02:00
yuyi 33167960ed
checker: check the sumtype mismatch returned by match expr (#13751) 2022-03-16 09:31:38 +02:00
yuyi 49155ec312
parser: notice unnecessary parenthesis of reference (fix #11179) (#13739) 2022-03-15 16:11:53 +02:00
yuyi 92cafd8851
checker: check invalid 'mut' keyword in infix expr (#13742) 2022-03-15 14:50:17 +03:00
Nick Treleaven 34dd4f34ab
checker: fix cgen error on sliced references (#13736) 2022-03-14 19:52:37 +02:00
yuyi f7feb634d2
checker: fix error for if mut with immutable variable (#13728) 2022-03-13 16:33:50 +02:00
yuyi 27f9bc9ba0
checker: check error for match mut with immutable variable (fix #9704 #8976) (#13725) 2022-03-13 09:53:29 +02:00
yuyi dd06698ee3
ast: rename TypeSymbol.is_public to TypeSymbol.is_pub (#13710) 2022-03-10 22:18:57 +02:00
yuyi 4c33003f86
checker: check error for infix compare optional (#13701) 2022-03-09 20:20:21 +02:00
yuyi 6c7243f2f7
checker: remove redundant 'c.expected_type = ast.void_type' (#13687) 2022-03-09 12:33:23 +02:00
yuyi 3fe8204062
checker: fix if expr with enum value (#13685) 2022-03-08 11:55:17 +02:00
yuyi cea3149369
checker: fix match expr with enum type value (#13683) 2022-03-08 09:50:17 +02:00
yuyi e6270b05dc
checker: check unsigned integer compared with negative value (#13670) 2022-03-07 10:26:40 +02:00
Alexander Medvednikov 36ec47cd20 all: replace "NB:" with "Note:" (docs/comments) 2022-03-06 20:01:22 +03:00
yuyi 8136157f87
checker: fix error for 'or expr with nested match expr' (#13658) 2022-03-05 13:06:08 +02:00
yuyi f70e5bd69b
parser: check assign expr with undefined variable (#13653) 2022-03-04 10:33:14 +02:00
yuyi a98eebde7f
checker: add a notice for potentially incorrect smartcasts (#13644) 2022-03-03 16:36:40 +02:00
yuyi ac1b31dbba
checker: fix error for array of interface init in for_in (#13636) 2022-03-03 12:32:55 +02:00
yuyi 288b13b51d
all: cleanup smartcasts in the compiler (#13639) 2022-03-03 10:48:31 +02:00
ChAoS_UnItY 6a3d34ae11
checker: fix #13626, when unwrapped type is fixed array, and selector expr is 'len' (#13627) 2022-03-02 20:46:18 +02:00
yuyi 996bd41ce8
checker: simplify for smartcast in for_stmt() (#13619) 2022-03-01 12:31:48 +02:00
Joe Conigliaro 3b6e122d9d
all: comptime_call - update tmpl scope vars with caller scope vars after their properties got updated in checker 2022-03-01 02:13:29 +11:00
yuyi 0028e557f9
checker: cleanup smartcast in checker.v (#13618) 2022-02-28 17:06:37 +02:00
yuyi 013589e9fe
parser: minor cleanup in global_decl() (#13617) 2022-02-28 13:30:17 +02:00
yuyi efeb3e04da
ast: add table.is_sumtype_or_in_variant() (#13615) 2022-02-28 11:38:20 +03:00
yuyi 81c787ef91
checker: fix match expr with assign sumtype variable (#13614) 2022-02-28 11:37:59 +03:00
yuyi d30ad344e8
checker: check error for array of sumtype appendding (#13593) 2022-02-24 11:07:03 +02:00
yuyi b5e7cef1b1
ast: define 'const invalid_type_idx = -1' (#13573) 2022-02-23 11:54:43 +03:00
yuyi c3ec738126
checker: check struct field reference type mismatch (#13575) 2022-02-23 11:53:22 +03:00
yuyi 6486fffc5a
checker: cleanup `map = {}` processing (#13563) 2022-02-22 16:04:54 +02:00
Larpon 1032cf5c04
checker: only cast as ast.Var if not unresolved, fixes #13561 (#13562) 2022-02-22 15:23:15 +02:00
playX b842e89acc
all: initial implementation of compile-time types (#13549) 2022-02-21 17:42:54 +02:00
eyun 67e33bf9bc
checker: make public the valid_comptime_if_os list (#13518) 2022-02-19 15:22:33 +02:00
yuyi 0208e9672d
checker: check array sort_with_compare callback function parameters (#13511) 2022-02-19 10:06:36 +02:00
yuyi 14073ac0fe
checker: fix error for array of sumtype init (#13501) 2022-02-18 11:47:24 +02:00
Joe Conigliaro f4051e0252
checker: make sure generic struct instantiation uses a known type. closes #13506 2022-02-18 17:54:52 +11:00
Delyan Angelov 245b70cabc
checker: bump iface_level_cutoff_limit to 100 (fix ci) 2022-02-17 11:46:04 +02:00
Delyan Angelov 230dc26858
checker: bump iface_level_cutoff_limit to 99 (fix ci) 2022-02-17 11:42:34 +02:00
Delyan Angelov 901a4d8b84
checker: restrict too deep recursion, to prevent stackoverflows on windows
For v itself, the nesting levels do not exceed 15, so a limit of 40 seems reasonable.
2022-02-17 10:04:11 +02:00
yuyi 842fd7a27e
parser: check assign expr with undefined variables of struct_init (#13495) 2022-02-17 10:21:03 +03:00
Delyan Angelov 89b99ad4c3
scanner: remove the restriction for \x00 in strings (#13493) 2022-02-16 23:41:05 +02:00
yuyi f8b8950b96
checker: check mut interface arguments (#13479) 2022-02-16 11:53:41 +02:00
yuyi f9fc136c24
all: rename InterfaceDecl.ifaces to InterfaceDecl.embeds (#13475) 2022-02-15 11:17:39 +02:00
yuyi b2f984280b
checker: strengthen the judgment of generic type parameters replacement, merge generic type init tests (#13460) 2022-02-14 02:38:47 +02:00
yuyi b5379255da
checker, cgen: fix error for struct embed with fn type (#13450) 2022-02-12 20:55:40 +02:00
Delyan Angelov 799c95dc4e
tests: filter test_ fns with params from the list of automatically run test functions (fix #13443) 2022-02-12 17:30:20 +02:00
yuyi 7178367de0
all: fix error for comptime for in field with generic fn (fix #13409) (#13439) 2022-02-11 22:00:13 +02:00
Tim Basel 9d0a5942ac
builtin: change IError `msg` and `code` to methods + fix vlib, add a deprecation notice for the old usages (#13041) 2022-02-11 15:52:33 +02:00
yuyi a21f4563b3
checker: check the arity and the kinds of the type parameters in generic struct inits (#13429) 2022-02-11 11:21:07 +02:00
Delyan Angelov 9ed18efa53
checker: error on redefining any of the public builtin functions, not just ['print', 'println', 'eprint', 'eprintln', 'isnil', 'panic', 'exit'] (#13419) 2022-02-10 12:26:30 +02:00
yuyi f2eb50008d
parser, checker: cleanup struct short syntax processing (#13416) 2022-02-09 18:31:16 +02:00
yuyi 4be3c92640
checker: check generic struct init without type parameter (#13404) 2022-02-09 14:06:45 +02:00
Vincenzo Palazzo d46ac40758
checker: add error for assigning `none` values (#13383) 2022-02-06 16:08:23 +02:00
div72 cec7e91714
v.parser, v.checker, v.gen: add support for [translated] tag (#13373) 2022-02-06 00:16:02 +02:00
yuyi 173b4652fb
parser: check orm sql statements, using undefined variables in where expr (fix #13367) (#13368) 2022-02-05 11:32:41 +02:00
Vincenzo Palazzo b9fce4ef09
checker: make sure that the operator check is made on the concrete type (#13360) 2022-02-05 00:11:24 +02:00
yuyi a61b4809dc
ast, parser, checker: fix generic struct init with inconsistent generic types (#13359) 2022-02-04 14:24:38 +02:00
Delyan Angelov 85d36ed231
checker: stricter type casting error messages 2022-02-03 14:18:30 +02:00
yuyi b34860e39b
ast, checker: fix error for calling complex nested generic type function (fix #13025) (#13328) 2022-01-31 13:00:27 +02:00
Delyan Angelov 71d98717dc
checker: small cleanup of commit edc6c9e 2022-01-28 11:03:15 +02:00
Yamada Hayao edc6c9e24f
checker: show error instead of panic, when using a `somemodule.NonExistingEnum.enum_value` (#13295) 2022-01-28 11:02:51 +02:00
Delyan Angelov f8f7bc8ead
ci: fix deprecated_module.out file too 2022-01-27 13:16:25 +02:00
Delyan Angelov ebad7301f9
ci: fix failing deprecated_module test on windows 2022-01-27 13:15:34 +02:00
Delyan Angelov e1a2ab345d
parser,ast,checker: add support for `[deprecated: "use another module"] module obsolete` 2022-01-27 12:34:14 +02:00
yuyi 3bd528b218
ast, checker, cgen: fix error for map sumtype value init (#13290) 2022-01-27 09:44:34 +02:00
yuyi 291a1ffd8d
token: rename Position to Pos, rename position() to pos() (#13279) 2022-01-26 12:36:28 +02:00
yuyi d71fc0d13f
checker: fix error for cast to alias of reference struct (#13278) 2022-01-26 12:32:14 +02:00
Alexander Medvednikov 4715fb67c1 checker: c2v fixes for enums and pointer to numbers 2022-01-25 20:15:45 +03:00
yuyi ca1f675dba
ast, checker, cgen: implement if guard with multi return optional (#13273) 2022-01-25 14:36:33 +02:00
Delyan Angelov 0347dadf75
ci: vfmt checker.v 2022-01-24 14:01:35 +02:00
yuyi 3bfad1b943
checker: fix method call errors for generic struct instances (#13261) 2022-01-24 12:45:19 +02:00
skurgs 7fd08eca96
checker: fix c error on improper string to rune cast (#13197) (#13257) 2022-01-24 12:13:22 +02:00
yuyi edf0bc365c
checker: fix ui struct init error with default field value is const variable (#13215) 2022-01-23 18:37:52 +02:00
yuyi edbb39b81d
checker: correct error message of struct_decl() (#13240) 2022-01-21 12:10:09 +02:00
Delyan Angelov 295156e054
checker,cgen: implement v.profile.on/1, support `[if profile]` and `-d no_profile_startup` (#13232) 2022-01-21 03:26:05 +02:00
yuyi d553071e65
parser, checker: correct error message for a fixed array size using a non constant (fix #13219) (#13228) 2022-01-20 13:03:19 +02:00
yuyi 09797e493e
checker: check generics undefined operation of infix expression (#13223) 2022-01-20 08:57:25 +02:00
Tim Basel 14b33baa3b
transformer: refactor + apply transform to (hopefully) all nodes (#13216) 2022-01-20 08:40:16 +02:00
yuyi ba3308296b
ast: rename register_type_symbol to register_sym (#13217) 2022-01-19 20:16:23 +02:00
Alexander Medvednikov 38d3239b50 checker: c2v fixes 2022-01-19 15:26:24 +03:00
jeffmikels 7a2705d8ce
scanner: multibyte rune literals now support unicode, hex, and octal escape codes (#13140) 2022-01-19 03:23:25 +03:00
yuyi 39f80840d7
checker: check type mismatch in args of generics method calls (fix #13193) (#13196) 2022-01-17 16:48:59 +02:00
trueFireblade 727c9fb4a1
all: add string range OrExpr (#13189) 2022-01-17 13:03:10 +03:00
yuyi dfc23d939f
ast, checker, cgen: fix array of sumtype initialisation with a default `init:` (#13178) 2022-01-15 09:59:38 +02:00