Commit Graph

384 Commits (c64c4907a2b8785115c2f7be2fd1ef3b946a4f9d)

Author SHA1 Message Date
Delyan Angelov 64bc2fb40a
v: fix `[if debug] fn abc(){} ... abc()` 2021-03-07 12:05:07 +02:00
Delyan Angelov 0f042124cb
tests: support `fn test_fn() ? { opt()? }` 2021-03-05 14:18:21 +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
Nick Treleaven dc04c3196b
builder: fix detecting duplicate functions (#9033) 2021-03-01 21:38:31 +01:00
spaceface b9a381f101
all: migrate to the new Option (p. 1) (#8924) 2021-02-28 22:24:29 +03:00
Delyan Angelov bdce35fd9c
parser: support `static x := 42` in [unsafe] functions too 2021-02-28 14:32:46 +02:00
Delyan Angelov 1c0eefae38
parser/scanner: replace p.peek_tok2/3 with p.peek_token(2/3) (#8946) 2021-02-24 21:03:53 +03:00
yuyi c704a49283
parser: fix error of $tmpl in anon_fn (fix #8847) (#8849) 2021-02-20 18:51:08 +02:00
yuyi 783cee98d9
table/parser: minor optimization of anon_fn names (#8851) 2021-02-20 15:54:47 +02:00
Delyan Angelov bf6e9ff95a
Revert "parser: make duplicated functions an error (#8792)"
This reverts commit 21bf8fe14e.
2021-02-18 09:02:56 +02:00
zakuro 21bf8fe14e
parser: make duplicated functions an error (#8792) 2021-02-17 20:50:10 +01:00
zakuro 70a30374b9
parser: cleanup fn_decl (#8700) 2021-02-15 17:55:08 +02:00
Nick Treleaven 82650ee813
parser: fix parsing attribute after fn prototype with no return type (#8727) 2021-02-14 08:05:20 +01:00
yuyi 3164e29651
all: fix fn_or_for_in mut value (part 1) (#8671) 2021-02-12 02:03:11 +02:00
Nick Treleaven d37fb5641f
parser: improve printing of unexpected tokens (#8654) 2021-02-09 17:07:30 +02:00
Lukas Neubert cb1f63f765
parser: replace eat_line_end_comments() with configurable eat_comments() (#8636) 2021-02-08 18:16:02 +02:00
Swastik Baranwal e2ff26a066
cgen: fix gen of .sort method for `>` operator and improve grammar of error (#8615) 2021-02-08 17:19:54 +02:00
Lukas Neubert 7f4c582f1a
fmt: unwrap long infix exprs inside parenthesis if necessary (#8609) 2021-02-07 23:10:39 +01:00
Nick Treleaven f5f65f929f
parser: parse `map{key_expr: val_expr}` (#8608) 2021-02-06 22:13:24 +01:00
Uwe Krüger 5343f1374b
all: allow functions to return `shared` object (#8606) 2021-02-06 19:41:52 +01:00
Alexander Medvednikov fdd8c86fdb parser: make sure methods have names 2021-02-04 22:15:16 +01: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
Lukas Neubert ea06966fd4
fmt: hide ´[]Type{} instead of []Type´ and ´(f mut Foo)´ warnings (#8528) 2021-02-03 11:25:08 +02: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
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
zakuro 3959ba5751
checker: make a calling no-body function a checker error (#8265) 2021-01-26 11:19:48 +01:00
Lukas Neubert 8b61891348
fmt: smarter if condition wrapping (#8201) 2021-01-23 10:33:22 +02:00
Daniel Däschle 500ebf77e4
all: implement multiple generics (#8231) 2021-01-22 13:49:56 +01: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
zakuro 0c249fa040
parser: improve anon fn pos (#8210) 2021-01-21 11:01:40 +01:00
joe-conigliaro 97ebecc5f4
usecache: get all tests running with -usecache enabled by default (p.1) (#7699) 2021-01-20 06:04:59 +01:00
Tim Basel 129eee346b
fmt: keep single empty lines (#8189) 2021-01-19 14:49:40 +01:00
Lukas Neubert ac2c3847af
all: update copyright to 2019-2021 (#8029) 2021-01-18 13:20:06 +01:00
Nick Treleaven 5185a59ac7
parser: use Parser.builtin_mod instead of checking p.mod (#8137) 2021-01-17 05:31:41 +01:00
Nick Treleaven 8ee67d1c1c
parser: disallow indexing on next line at top-level (#8128) 2021-01-17 05:30:41 +01:00
Swastik Baranwal ef627c9d21
checker: improve message and positioning for operator overloading (#8133) 2021-01-17 03:37:44 +01:00
Daniel Däschle 53941c4a0a
fmt: fix if cond break readability (#8132) 2021-01-16 02:12:17 +01:00
zakuro 47536df2d0
table: remove nr_dims from Array (#8053) 2021-01-13 23:43:19 +01:00
Ruofan XU 245ed9160a
gen: fix `mut arr [3]int` as a fn argument (#8085) 2021-01-13 15:52:46 +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
Lukas Neubert e79695e8fc
fmt: keep comments after call_expr in vscript (#7990) 2021-01-09 22:47:33 +01:00
Delyan Angelov 46a5c487c1
parser,fmt: implement `[manualfree] module abc` for opting out *all* fns in a given .v from autofree 2021-01-08 17:24:42 +02:00
Delyan Angelov 083dc23db8
gen: implement a `[manualfree]` tag, for functions, that want to do their own memory management 2021-01-08 16:22:27 +02:00
Nick Treleaven c0e56d10c3
parser: add errors for invalid anonymous function (#7786) 2021-01-05 01:32:24 +01:00
Swastik Baranwal 9033099676
cgen: implement overriding of `!=` and `==` (#7837) 2021-01-03 16:19:02 +01:00
zakuro 6bd35505a2
parser: fix error when using imported types in short fn signature (#7795) 2021-01-02 15:09:54 +02:00
Swastik Baranwal 24b18f05c4
cgen: implement > and < for structs (#7774) 2021-01-01 14:54:32 +01:00
yuyi c3dafad7ef
generics: implement method generics (fix #7638) (#7732) 2020-12-31 18:00:22 +01:00
Daniel Däschle 3ee3c8b3ed
parser: proper error on fn decl in script mode (#7680) 2020-12-30 21:18:36 +02:00
joe-conigliaro 02965e753e
all: re-implement variadics using arrays & implement array decomposition to varg (#7689) 2020-12-29 16:14:08 +01:00
Lukas Neubert 2360762a42
fmt: fix unexpected `comment`, expecting struct key for trailing arg syntax (#7658) 2020-12-28 20:26:24 +02:00
Lukas Neubert 06fdf34214
fmt: unwrap long single line ifs (#7608) 2020-12-27 14:20:30 +01:00
Lukas Neubert 0caf668e73
parser: error if operators are used as function names (#7532) 2020-12-24 13:38:11 +02:00
yuyi 7b9756be72
parser: check for builtin function redefinitions (fix #7499) (#7507) 2020-12-23 18:17:09 +02:00
Delyan Angelov 2c4a51a596 parser: use `v fmt -w "$p.scanner.file_path"` in warns, easing fixing 2020-12-23 14:17:20 +02:00
Lukas Neubert d1fc65c260
parser: add information about the ending line for a few elements (#7414) 2020-12-22 14:45:12 +01:00
Alexander Medvednikov 1f74f83bc6 parser: map or block; checker: require ref field init 2020-12-19 10:28:17 +01:00
joe-conigliaro 0aa9f5a007
all: optimize scope usage in checker & parser. store scope in ast nodes (#7281) 2020-12-12 19:01:12 +11:00
joe-conigliaro d1224ffb5a
parser: error on non local array/map methods & add tests 2020-12-11 20:50:26 +11:00
Daniel Däschle 8823430c71
parser: small fixes to make silent mod work with example/json (#7246) 2020-12-11 06:55:39 +01:00
Enzo 04346e7ba5
checker: allow void,char,byteptr to be mut args (#7239) 2020-12-11 04:47:10 +01: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 0bf679a7aa
checker: correct underline for unknown type in method type (#7223) 2020-12-10 11:51:22 +02:00
Delyan Angelov d5915bde7c
parser: implement support for -Wimpure-v (#7195) 2020-12-08 17:52:24 +01:00
Leah Lundqvist 90c1c639fe
js: types (#7108) 2020-12-08 17:49:20 +01: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
Daniel Däschle 47d0ed308d
parser: prepare for better VLS integration, more accurate parser errors (#7119) 2020-12-04 20:34:05 +02:00
Daniel Däschle 558a756431
parser: fix position offset by 1 (#7099) 2020-12-03 11:25:06 +02:00
Lukas Neubert 2691163a7e
scope: remove redundant name arg from register() (#7077) 2020-12-02 14:40:25 +01:00
joe-conigliaro ff63fb74d9
dont allow method on non-local types & no mod for arrays. closes #6971 2020-11-30 11:43:22 +11:00
Delyan Angelov e6116c47be scanner: guarantee an early exit when the parser/scanner is stuck 2020-11-27 12:44:39 +02: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
Delyan Angelov f995aa35ea checker: add a check for `x := math.sin<f64>(0)` 2020-11-15 11:51:12 +02:00
pancake 2994e7150f
vweb: check function and route parameter count (#6761) 2020-11-08 09:14:24 +01:00
Daniel Däschle a2fc19880a
parser: fixes or block position (#6736) 2020-11-04 16:02:01 +02:00
Delyan Angelov e72d9c0f88 parser: protect against infinite loops in -silent mode over invalid .v files 2020-11-01 14:02:32 +02:00
Delyan Angelov 70cbf56655 cgen: show more informative errors, instead of a `invalid type (typ=0 idx=0)` verror panic 2020-10-30 20:26:08 +02:00
Alexander Medvednikov 7da1afa140 all: switch to the new fn arg syntax everywhere; add lots of vfmt -verify tests 2020-10-15 12:32:28 +02:00
Enzo fd88bfbac8
fmt: fix formatting of anon args (#6545) 2020-10-04 06:32:47 +02:00
Enzo 677b0ba2d2
gen: access fields in multi-type sumtype match (#6541) 2020-10-03 11:19:43 +02:00
Alexander Medvednikov fca344d1fb all: fn args => params 2020-09-27 03:32:56 +02:00
Alexander Medvednikov 624f22e27e all: mutability check (part 1); enable mutable sumtype args 2020-09-22 05:28:29 +02:00
Alexander Medvednikov b74c1805d7 cgen/autofree: fix and simplify optionals 2020-09-12 16:40:52 +02:00
Nick Treleaven eb95a4333a
table: rename Arg to Param (#6337) 2020-09-09 13:21:11 +02:00
Alexander Medvednikov 3410705974 autofree: lots of fixes 2020-09-05 12:00:35 +02:00
Nick Treleaven 7dbae14e19
checker: error on `mut name =` (#6247) 2020-08-28 20:07:32 +03:00
Maciej Obarski e8e0d9fa42
all: [direct_array_access] tag (#6203) 2020-08-24 09:04:50 +02:00
Daniel Däschle fcc61a981d
all: TypeSymbol.source_name (#6187) 2020-08-22 12:29:15 +02:00
Alexander Medvednikov c5aa2bfa51 tests: fix a match test 2020-08-11 16:26:52 +02:00
Delyan Angelov bd32f0969f parser: enable CamelCase named method names for JS. objects 2020-08-10 10:39:14 +03:00
Nick Treleaven 2dd90de993
parser: error on `[unsafe_fn]` (#6090) 2020-08-09 12:22:11 +03:00
Nick Treleaven 6cc8815931
parser: support [unsafe] instead of [unsafe_fn] (#6066) 2020-08-08 16:24:05 +02:00
Enzo f238890fe9
compiler: move attributes to declarations (#6026) 2020-08-04 20:10:22 +02:00
Delyan Angelov 8c4429c875 parser: fix passing the is_mut flag of anon fn arguments 2020-07-24 11:27:56 +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
Enzo 8653605b0a
fmt: allow for comments in call args and if expressions branches (#5871) 2020-07-20 17:48:33 +03:00
Ryan Willis 1114fd28d0
all: import individual symbols feature (#5872) 2020-07-18 21:34:38 +02:00
Nick Treleaven 105a0e015e
checker: warn if unsafe method called outside unsafe block (#5863) 2020-07-17 19:14:12 +02:00
Enzo 2ee8f93d60
parser: duplicate method declaration on interface (#5825) 2020-07-15 10:23:21 +02:00
Daniel Däschle c5dc1a33b6
all: remove `it` smartcast and replace with original variable name (#5764) 2020-07-09 17:14:14 +02:00
yuyi 64e9bdc213
parser: fix non-void optional fn missing return value (fix #5736) (#5741) 2020-07-08 16:01:17 +02:00
Daniel Däschle 5ea17ad2d4
all: if smartcast part 2 (#5754) 2020-07-08 15:46:58 +02:00
joe-conigliaro 5fd5e558ae
parser/checker/gen: anon fn direct call with args 2020-07-08 01:10:39 +10:00
Uwe Krüger ef02373061
all: remove `rwshared` keyword, make its semantics default for `shared` (#5710) 2020-07-07 01:57:31 +02:00
Uwe Krüger 3b067f5f85
all: experimental locked concurrency support, part 1 (#5637) 2020-07-04 12:44:25 +02:00
Alexander Medvednikov b7175b54eb vweb: ['/:arg1/:arg2/action'] attribute 2020-07-03 15:10:39 +02:00
Alexander Medvednikov da99868a28 ci: run v vet vlib/v/parser 2020-07-01 18:57:14 +02:00
Delyan Angelov 78e1127d99
cgen: treat the main module like any other v module 2020-07-01 00:53:53 +02:00
joe-conigliaro ab37dcaa9c
generic structs: initial implementation 2020-06-29 20:09:09 +02:00
yuyi c588bdee5a
cgen: fix fn()? return 2020-06-29 11:02:40 +02:00
Delyan Angelov 1ba5996404 parser: fix interface functions with no params (ui examples) 2020-06-29 10:53:12 +03:00
Delyan Angelov b6e6cde3e8 parser: disallow fns with type only args and a body 2020-06-29 10:21:01 +03:00
Daniel Däschle 852fca2151
all: call anon fns right away 2020-06-24 12:54:39 +02:00
yuyi 7efb3ecb34
checker: check deprecated functions 2020-06-23 16:25:24 +02:00
yuyi 73296e486a
parser: fix function return anon_fn without parentheses 2020-06-22 16:03:31 +02:00
spaceface777 a02aff9126
jsgen: fixes and improvements 2020-06-20 13:22:49 +02:00
Alexander Medvednikov 78b32892ac cgen: use the new match syntax 2020-06-18 20:21:08 +02:00
joe-conigliaro 0cd9066f44
parser/cgen: multiple attributes & better errors (closes #5334) 2020-06-15 22:59:09 +10:00
Adam Stankiewicz b3fc462a78
scanner: fix parsing multiple .amp 2020-06-13 00:01:44 +02:00
Delyan Angelov 5ef9569098 cmd/tools: add check_os_api_parity.v - keep module APIs even 2020-06-11 21:13:36 +03:00
spaceface777 30f1c6bad5
parser: fix type_only fns starting with varargs 2020-06-08 19:02:36 +02:00
Alexander Medvednikov 4d5ac1e16d vweb: $html 2020-06-06 21:36:34 +02:00
Delyan Angelov 8d3f680d07 vdoc: implement .toplevel_comments parsing mode 2020-06-06 19:05:26 +03:00
Alexander Medvednikov 100b3986b8 parser: handle ! after CallExpr 2020-06-06 12:28:03 +02:00
yuyi dd7ebf7fac
parser: check function argument mutable syntax 2020-06-04 15:20:43 +02:00
joe-conigliaro 41dca3ef58
checker/cgen: fix mutable generic fn args 2020-06-04 19:32:31 +10:00
Swastik Baranwal d286f67220
parser: update check for non mut types in fn 2020-06-03 18:47:18 +03:00
yuyi 1060de88af
parser: fix function mutable argument error 2020-06-03 12:28:16 +02:00
Alexander Medvednikov 199f4f006b checker: fix mut int check 2020-06-03 10:36:56 +02:00
yuyi d0ff9a7c4a
parser: correct fn arg position in error message 2020-06-03 08:42:02 +03:00
Alexander Medvednikov 3d83934caf checker: check mutating methods; generics fixes 2020-06-01 15:44:10 +02:00
Alexander Medvednikov 96fb7901b3 live: fix reloader.v 2020-05-29 04:36:08 +02:00
Alexander Medvednikov 81b44dc2c9 generics: generic call inside generic call; checker: check mut args at call 2020-05-29 04:30:00 +02:00
Alexander Medvednikov 9609b3a9c8 checker: make the method warning an error 2020-05-28 15:30:54 +02:00
Alexander Medvednikov 01dbb25a37 checker: do not allow defining methods on types from other modules 2020-05-28 15:23:20 +02:00
Alexander Medvednikov 5423a15f46 generics: more fixes 2020-05-27 15:56:30 +02:00
Delyan Angelov 70f0115e27 options: use panic_debug() for opt()? calls in main with -cg 2020-05-23 11:43:20 +03:00
Enzo Baldisserri 801bca1ef2
compiler: propagate optional 2020-05-23 08:51:15 +02:00
Enzo Baldisserri 1633675c11
gen: fix nested `or` 2020-05-21 22:35:43 +02:00
Alexander Medvednikov ce1a181699 all: generic functions 2020-05-21 03:58:53 +02:00
Alexander Medvednikov 82cedbaf62 fmt: fix `map[string][]string`; parser: allow `foo<int>(10)` 2020-05-20 21:40:24 +02:00
Alexander Medvednikov 0d3f133436 parser: show location of a previously defined function 2020-05-20 17:27:37 +02:00