Commit Graph

412 Commits (985fe85de2974745e4a2c3205c3023889216f071)

Author SHA1 Message Date
Ryan Roden-Corrent b90bae79da
doc: document that test_ functions may propagate errors (#10162)
When testing a function that can return an error, writing a test like
this allows you to more easily test the non-error flow by just
propagating any errors and letting them fail the test.

I didn't realize this was a feature at first, so I was writing tests
like:

```
fn test_atoi() {
	assert strconv.atoi('1') or { panic("atoi failed") } == 1
	assert strconv.atoi('one') or { panic("atoi failed") } == 1
}
```
2021-05-21 14:18:13 +03:00
Enzo 906b207e58
checker: deprecate using V strings in C function calls (#10140) 2021-05-20 09:17:44 +03:00
Delyan Angelov c16d4911c2
v.checker: deprecate `$if linux_or_macos {` in favor of `$if linux || macos {` 2021-05-08 21:00:21 +03:00
Mark 928ced3df8
docs: small English improvement (#10020)
I also suggest globally replacing "is casted" with "is cast" throughout since this is better English.
2021-05-06 16:43:41 +03:00
ka-weihe 605019ec27
doc: fix misleading 'maps' section (#9946) 2021-05-01 12:51:50 +03:00
Alexander Medvednikov b3890e28f2
doc: document fixed size init syntax 2021-04-30 15:59:38 +03:00
Lukas Neubert dee733aae4
fmt: reset const field align after multi line exprs (#9916) 2021-04-29 02:17:37 +03:00
Enzo 4f246222b0
v: replace `--enable-globals` with `-enable-globals` (#9898) 2021-04-28 07:44:28 +03:00
pancake 9a3869c521 v.ast: rename aarch64 to arm64 and aarch32 to arm32 2021-04-27 12:24:58 +03:00
pancake 6750ed254f x64: rename to `native` to not conflict with the x64 comptime variable 2021-04-27 12:24:58 +03:00
Uwe Krüger 787a63dab6
cgen: execute `defer` block *after* return expression is evaluated (#9893) 2021-04-27 01:42:16 +03:00
Louis Schmieder 7184629969
orm: add initial pg support (#9827) 2021-04-25 18:57:55 +03:00
Miccah 515e83dcbc
docs: correct one of the channel examples (#9865) 2021-04-25 18:20:12 +03:00
Delyan Angelov d4f31412b7
v: deprecate `@VROOT` in favour of `@VMODROOT` (#9795) 2021-04-19 19:01:47 +03:00
Uwe Krüger 8ab0d42b5f
checker: check argument for `chan.try_push/pop()` (#9798) 2021-04-19 11:41:21 +03:00
Ahmed Muhammed 1a0bc5a952
docs: fix tenses (#9775) 2021-04-17 19:36:29 +03:00
Delyan Angelov 6b8585daea
docs: remove obsolete references to byteptr/charptr, use &byte/&char instead 2021-04-12 15:58:26 +03:00
Delyan Angelov 79284f0458
docs: fix some mixed indentation, found by `v check-md .` 2021-04-12 15:13:00 +03:00
Delyan Angelov a4fb851f3d
docs: document dump(expr) 2021-04-12 12:08:25 +03:00
Louis Schmieder 64391efa4d
orm: add mysql support (#9630)
* add mysql to orm

* fix got to big packet error

* format sql.v

* format example

* custom sql types

* add mysql table cration

* add documentation

* format sql.v

* fix markdown

* start implementing select_expr for mysql

* remove orm.c

* format sql.v

* finish mysql expr

* remove c

* remove unessecary files

* change to c implementation

* remove c

* added str interpolation for idents

* fix string insert

* fix compilation problems

* fix gitly compilation

* fix typing mistake

* add link to orm docs
2021-04-10 17:38:27 +03:00
crthpl 903dd49212
v: add support for `$if freestanding {`, without using it (part 1) (#9656) 2021-04-09 23:24:25 +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
koplenov 6b2f8196ac
doc: correct a typo (#9611) 2021-04-05 23:56:25 +03:00
koplenov 3617ce0539
docs: add a short description of available vpm commands (#9566) 2021-04-05 23:07:15 +03:00
Delyan Angelov 34aa67b1e8
ci: fix compilation and formatting of sqlite example in docs.md 2021-04-05 08:09:04 +03:00
Alberto González Palomo 762036963c
doc: Add a note on how to define type aliases. (#9466) 2021-03-26 19:50:29 +02:00
Larpon 35c60cf464
doc: reflect current `int` → `f32` behaviour (#9433) 2021-03-23 10:01:24 +01:00
Ben-Fields c4e6ef424e
doc: add clarification about C declarations (#9390) 2021-03-21 07:43:12 +01:00
Miccah a2eb686506
doc: document array .any() and .all() (#9386) 2021-03-20 17:27:27 +01:00
Delyan Angelov 8810af76df
all: support `-gc boehm` on systems with libgc-dev installed (#9382) 2021-03-20 14:16:36 +01:00
Delyan Angelov a6ddd24f5c
v.embed_file: add .to_string() and .to_bytes() utility methods 2021-03-20 09:30:38 +02:00
crthpl fafb035fb5
all: reimplement inline assembly (#8645) 2021-03-17 01:43:17 +01:00
Delyan Angelov 0469e1ce9b
docs: make the slice example less ambiguous 2021-03-14 18:43:08 +02:00
Ben-Fields 24630850a0
docs: document v `free()` (#8995) 2021-03-13 09:06:59 +02:00
Subhomoy Haldar 5ddb2d5b18
docs: add a mutable iteration example (#9244) 2021-03-11 14:53:58 +02:00
zakuro 791dec7b01
v: support `$if prod` (#9228) 2021-03-10 19:26:34 +02:00
Lukas Neubert 4aa0504ad6
docs: mention deprecated attribute with argument (#9218) 2021-03-09 18:24:21 +02:00
StunxFS 2ed73bf243
docs: remove obsolete information about generic types (#9200) 2021-03-08 21:16:18 +02:00
StunxFS 15927cbf56
docs: fix link to 'Structs with reference fields' section (#9199) 2021-03-08 20:52:32 +02:00
Delyan Angelov 4c7b6ce2fd
docs: expand the explanation for the `[unsafe]` fn tag 2021-03-07 10:03:06 +02:00
joe-conigliaro 2d73411396
checker: define missing C fn args & check C & JS args (#8770) 2021-03-05 17:41:11 +03:00
JalonSolov cce006b129
docs: fix errors in docs.md (#9119) 2021-03-04 22:00:07 +02:00
JalonSolov 814998ec10
docs: fix errors in docs.md (#9118) 2021-03-04 21:52:55 +02:00
Delyan Angelov cc7a1f47c9
docs: describe `v run .` in more detail 2021-03-04 21:37:56 +02:00
Delyan Angelov 746fe47e94
docs: add missing User and Post declarations in the Generics example 2021-03-04 15:07:17 +02:00
Ben-Fields 2be3a72df6
doc: add`[unsafe]` and `[manualfree]` (#9038) 2021-03-01 21:36:37 +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 4125bfe401
all: fix references to time.wait -> time.sleep 2021-02-28 18:01:31 +02:00
Patrick Hintermayer 970bb09eca
doc: add windows installation recommendation (#8996) 2021-02-27 13:25:30 +01:00
Ben-Fields 7bee3dc489
docs: document env var VFLAGS (#8959) 2021-02-26 08:28:37 +02:00
Nick Treleaven 8e9e9b2f89
doc: move variadics, tweak methods, add missing TOC item (#8949) 2021-02-24 20:27:48 +02:00
Miccah 66c85aa5cb
docs: update concurrency docs and examples to use []thread{} (#8933) 2021-02-24 10:41:12 +01:00
pierlucg-xs 864b5ee40b
docs: add the shebang line to the .vsh chmod-able example script (#8926) 2021-02-23 18:14:14 +02:00
Delyan Angelov c37daba41d
ci: fix the remaining obsolete reference to time.sleep and time.usleep 2021-02-22 09:12:23 +02:00
Ben-Fields b9edc4a414
docs: document the `[console]` attribute (#8870)
Document the [console] attribute in docs.md.

Co-authored-by: Ben-Fields <>
2021-02-21 11:56:34 +02:00
Ben-Fields 3907a1ab49
docs: document enum <-> int assignment and casting (#8872) 2021-02-21 11:54:13 +02:00
Ben-Fields cb7c5d58d9
docs: add a unions section (#8873) 2021-02-21 11:51:34 +02:00
Wink Saville 5243c5adce
doc: update the cross-platform shell scripts section (#8791) 2021-02-20 18:55:24 +02:00
Nick Treleaven 629d43caf5
checker: warn when using `goto` outside of `unsafe` (#8741) 2021-02-15 15:48:24 +02:00
Nick Treleaven 4ef3a21c8a
doc: fix Modules position in contents (#8722) 2021-02-13 16:57:51 +02:00
Nick Treleaven 99270c6935
doc: improve `const` docs (#8723) 2021-02-13 16:54:42 +02:00
Nick Treleaven f23ffb8322
doc: group `for`/`in` forms (#8721) 2021-02-13 16:53:02 +02:00
Uwe Krüger 374739b804
all: rename `[ref_only]` -> `[heap]` (#8718) 2021-02-13 16:52:01 +02:00
glebbash aa548f45ea
docs: fix functions in array/map example (#8695) 2021-02-12 21:10:54 +02:00
Larpon 4770036e23
docs: fix "plugin-in" beef (#8688) 2021-02-12 01:36:47 +02:00
Nick Treleaven 9e751f72c4
doc, fmt: use `map{key: value}` syntax for map literals (#8623) 2021-02-08 16:57:42 +02:00
Charles WANG 13350681dd
docs.md: use `make.bat -tcc` under Windows. (#8555) 2021-02-07 12:53:26 +02:00
zakuro 9f59b04e86
fmt: remove unused selective imports (#8595) 2021-02-07 03:58:43 +01:00
Nick Treleaven cd4f7101f7
parser: support short struct update syntax `{...ident,` (#8613) 2021-02-07 03:43:51 +01:00
Delyan Angelov 41cc72e8e8
docs: fix broken link to vlib/net/socket.v 2021-02-06 08:12:43 +02:00
Lukas Neubert 58b3a30b47
docs/readmes: format almost all remaining code blocks (#8590) 2021-02-05 19:50:28 +02:00
StunxFS 22e23eda5d
doc: use '?' in optional functions (#8583) 2021-02-05 16:51:17 +01:00
Lukas Neubert 76ea3e7b41
tools/check-md: allow directories as args and deprecate -all flag (#8582) 2021-02-05 16:46:20 +01:00
Ruofan XU 12e8e31bb2
doc: document `!in` (#8546) 2021-02-05 16:45:20 +01:00
Delyan Angelov 25a3873019
parser,checker: support @METHOD, replaced by 'ReceiverType.MethodName' 2021-02-05 16:32:43 +02:00
Delyan Angelov 231182c3ff
docs: vfmt the function example too (fix ci) 2021-02-05 09:30:18 +02:00
Alexander Medvednikov 1084b43ffb all: ast walker for marking unused fns 2021-02-05 08:05:35 +01:00
Swastik Baranwal 7ec116d588
all: only allow defining `==` and `<` and auto generate `!=`, `>`, `>=` and `<=` (#8520) 2021-02-03 15:18:38 +01:00
Nick Treleaven 9f662002da
doc: improve docs for goto, sizeof, __offsetof (#8522) 2021-02-02 18:51:40 +01:00
Uwe Krüger 8bf3fe5d48
docs: remove `&` from `shared` initializers (#8499) 2021-02-01 21:43:45 +01:00
William Gooch 49244d91ce
doc: goto (#8462) 2021-02-01 20:09:25 +01:00
BigBlack e3c2604338
cgen: fixed array slice in function, add docs (#8481) 2021-02-01 19:11:17 +02:00
Alexander Medvednikov 6804fdaa56 doc: document $tmpl 2021-02-01 15:45:52 +01:00
Lukas Neubert d660f2cc6f
fmt: insert newline after last HashStmt (#8482) 2021-02-01 14:50:41 +01:00
Larpon d25825df57
all: support compile time `$env('ENV_VAR')` (#8456) 2021-01-31 19:22:42 +02:00
Nick Treleaven 3be5795724
doc: simplify interface method definition example (#8468) 2021-01-31 15:28:02 +01:00
William Gooch 0081e77969
doc: document interface methods (#8360) 2021-01-31 03:39:46 +01:00
Delyan Angelov 8505d2ca82
docs: expand on the `_d_customflag.v` limitations 2021-01-30 18:03:31 +02:00
Delyan Angelov 19784ab89b
docs: document _d_customflag.v files (used by V only when `-d customflag` is passed) 2021-01-30 17:44:48 +02:00
div72 8c70920695
all: add offsetof (#8380) 2021-01-30 12:57:09 +01:00
William Gooch 10aa03b22f
docs: add an Array Slices section (#8429) 2021-01-30 12:49:06 +02:00
William Gooch b8d93df55e
docs: add axample of escaping a v keyword in enums (#8425) 2021-01-29 21:09:24 +02:00
Delyan Angelov dbaccd4272
vfmt: shorten `main.const_name` to just `const_name` 2021-01-25 20:57:33 +02:00
Delyan Angelov 965ae9cb91
ci: fix formatting in .md files too 2021-01-25 13:20:18 +02:00
Alexander Medvednikov 29d6e40f29 all: vfmt (new const rule) 2021-01-24 10:54:27 +01:00
Alexander Medvednikov 12ff1c2702 doc: document the new const rule 2021-01-24 10:23:52 +01:00
William Gooch ae1c7de604
docs: add an example of variable swapping (#8306) 2021-01-24 00:41:47 +02:00
Lukas Neubert 8b61891348
fmt: smarter if condition wrapping (#8201) 2021-01-23 10:33:22 +02:00
Adelar da Silva Queiróz 325731e3b6
docs: add description for `$` (#8283) 2021-01-23 10:28:12 +02:00
Delyan Angelov 362a83d0c6
docs: add an example of zero padding in string interpolation 2021-01-23 09:02:33 +02:00