all: fix typos (#19693)

This commit is contained in:
Turiiya 2023-10-30 02:28:34 +01:00 committed by GitHub
parent ac40981bcc
commit 690ec7d3a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 159 additions and 150 deletions

View file

@ -28,11 +28,11 @@ The main files are:
1. `cmd/v/v.v` The entry point.
- V figures out the build mode.
- Constructs the compiler object (`struct V`).
- Creates a list of .v files that need to be parsed.
- Creates a parser object for each file and runs `parse()` on them.
- The correct backend is called (C, JS, native), and a binary is compiled.
- V figures out the build mode.
- Constructs the compiler object (`struct V`).
- Creates a list of .v files that need to be parsed.
- Creates a parser object for each file and runs `parse()` on them.
- The correct backend is called (C, JS, native), and a binary is compiled.
2. `vlib/v/scanner` The scanner's job is to parse a list of characters and convert
them to tokens.
@ -85,8 +85,8 @@ accordingly in the steps below.)
2. Clone the main v repository https://github.com/vlang/v to a local folder on
your computer, say named nv/ (`git clone https://github.com/vlang/v nv`)
3. `cd nv`
3.1 (optional) Run these commands, which ensure that all your code will be
automatically formatted, before commiting:
3.1 (optional) Run these commands, which ensure that all your code will be
automatically formatted, before committing:
```
cp cmd/tools/git_pre_commit_hook.vsh .git/hooks/pre-commit
chmod 755 .git/hooks/pre-commit
@ -99,10 +99,9 @@ accordingly in the steps below.)
`git pull` `git status` and so on.
5. When finished with a feature/bugfix/change, you can:
`git checkout -b fix_alabala`
`git checkout -b fix_alabala`
- Don't forget to keep formatting standards, run `v fmt -w YOUR_MODIFIED_FILES`
before committing (if you have not run the commands from 3.1)
before committing (if you have not run the commands from 3.1)
6. `git push pullrequest` Note: The `pullrequest` remote was setup on step 4
7. On GitHub's web interface, go to: https://github.com/vlang/v/pulls
@ -118,10 +117,10 @@ accordingly in the steps below.)
9. If there are merge conflicts, or a branch lags too much behind V's master,
you can do the following:
1. `git pull --rebase origin master` # solve conflicts and do
`git rebase --continue`
2. `git push pullrequest -f` # this will overwrite your current remote branch
with the updated version of your changes.
1. `git pull --rebase origin master` # solve conflicts and do
`git rebase --continue`
2. `git push pullrequest -f` # this will overwrite your current remote branch
with the updated version of your changes.
The point of doing the above steps, is to never directly push to the main V
repository, *only to your own fork*. Since your local `master` branch tracks the
@ -136,9 +135,10 @@ information.
## Finding issues to contribute to
If you're willing to contribute to V but don't know which issue to resolve
- you can go to [Issues](https://github.com/vlang/v/issues) tab
in this repository. There you can see things logged by both users and developers
that need to be discussed and/or resolved.
in this repository. There you can see things logged by both users and developers
that need to be discussed and/or resolved.
It's recommended to filter issues by likes and labels to find an issue
you are interested in.
@ -168,15 +168,18 @@ You can examine the list of labels [here](https://github.com/vlang/v/labels).
The most common labels are:
By issue type:
- `Bug`
- `Feature Request`
By OS:
- `OS: Linux`
- `OS: Windows`
- `OS: Mac`
By status:
- `Status: Confirmed`
To apply this filter, navigate to [Issues](https://github.com/vlang/v/issues)
@ -205,8 +208,8 @@ command.
1. `hub clone vlang/v my_v`
2. `cd my_v`
2.1 (optional) Run these commands, which ensure that all your code will be
automatically formatted, before commiting:
2.1 (optional) Run these commands, which ensure that all your code will be
automatically formatted, before committing:
```
cp cmd/tools/git_pre_commit_hook.vsh .git/hooks/pre-commit
chmod 755 .git/hooks/pre-commit

View file

@ -1,4 +1,5 @@
## [Version 0.3]
- [x] gc option
- [x] channels
- [x] lock{}
@ -50,7 +51,7 @@
- [ ] Cross compilation of C
- [ ] Big remaining bugs fixed
- [ ] More powerful comptime
- [ ] Constraits for generics
- [ ] Constrains for generics
- [ ] Coroutines on Windows
- [ ] Autofree memory management option ready for production
- [ ] C2V supporting entire C99 standard

View file

@ -1,10 +1,12 @@
Running the C# program:
====================================
```
dotnet run
```
Creating a release version of the C# program:
```
dotnet publish -c Release -r ubuntu.20.04-x64
```
@ -16,30 +18,33 @@ but unfortunately it also stops running after stripping :-| .
Compiling and running the V program:
====================================
```
v crun vectors.v
```
... produces and runs an executable `vectors` which is ~1.3MB in size.
... produces and runs a `vectors` executable which is ~1.3MB in size.
Compiling and running the V program, compiled with -prod:
```
v -prod crun vectors.v
```
... produces and runs an executable `vectors` which is ~176KB in size.
... produces and runs a `vectors` executable which is ~176KB in size.
After stripping, the executable shrinks to 157KB. It can still run after
stripping.
Note: using `crun` will make sure that the compilation will happen just
once at the start, and then the executable will be just reused by the
subsequent commands with identical options. It will also ensure that
the compiled executable will not be removed, unlike `run` .
Some measurements and comparisons
====================================
Note: the folowing was done on Intel(R) Core(TM) i3-3225, 16GB RAM:
Note: the following was done on Intel(R) Core(TM) i3-3225, 16GB RAM:
```
#0 13:41:35 ᛋ master /v/vnew/bench/vectors❱rm -rf vectors
#0 13:41:49 ᛋ master /v/vnew/bench/vectors❱

View file

@ -260,7 +260,7 @@ fn test_bf_pos() {
* set haystack size to 80
* test different sizes of needle, from 1 to 80
* test different positions of needle, from 0 to where it fits
* all haystacks here contain exactly one instanse of needle,
* all haystacks here contain exactly one instance of needle,
* so search should return non-negative-values
*
*/

View file

@ -38,7 +38,7 @@ fn (b &BloomFilter[T]) free() {
}
}
// new_bloom_filter_fast create a new bloom_filter. `table_size` is 16384 , and `num_functions` is 4
// new_bloom_filter_fast creates a new bloom_filter. `table_size` is 16384, and `num_functions` is 4.
pub fn new_bloom_filter_fast[T](hash_func fn (T) u32) &BloomFilter[T] {
return &BloomFilter[T]{
hash_func: hash_func
@ -48,7 +48,7 @@ pub fn new_bloom_filter_fast[T](hash_func fn (T) u32) &BloomFilter[T] {
}
}
// new_bloom_filter create a new bloom_filter. `table_size` should greate than 0 , and `num_functions` should be 1~16
// new_bloom_filter creates a new bloom_filter. `table_size` should be greater than 0, and `num_functions` should be 1~16.
pub fn new_bloom_filter[T](hash_func fn (T) u32, table_size int, num_functions int) !&BloomFilter[T] {
if table_size <= 0 {
return error('table_size should great that 0')

View file

@ -10,10 +10,10 @@ fn hash_func(s string) u32 {
fn test_bloom_filter_fast() {
mut b := new_bloom_filter_fast[string](hash_func)
b.add('hello world')
b.add('v is awsome')
b.add('v is awesome')
b.add('power by v')
assert b.exists('hello world') == true
assert b.exists('v is awsome') == true
assert b.exists('v is awesome') == true
assert b.exists('power by v') == true
assert b.exists('my world') == false
}
@ -21,10 +21,10 @@ fn test_bloom_filter_fast() {
fn test_bloom_filter_fast_normal() {
mut b := new_bloom_filter[string](hash_func, 65536, 16) or { panic(err) }
b.add('hello world')
b.add('v is awsome')
b.add('v is awesome')
b.add('power by v')
assert b.exists('hello world') == true
assert b.exists('v is awsome') == true
assert b.exists('v is awesome') == true
assert b.exists('power by v') == true
assert b.exists('my world') == false
}
@ -33,10 +33,10 @@ fn test_bloom_filter_false_positive() {
// every `add` will set 8 bits in the table(total length = 16), so overflow very quickly
mut b := new_bloom_filter[string](hash_func, 16, 8) or { panic(err) }
b.add('hello world')
b.add('v is awsome')
b.add('v is awesome')
b.add('power by v')
assert b.exists('hello world') == true
assert b.exists('v is awsome') == true
assert b.exists('v is awesome') == true
assert b.exists('power by v') == true
assert b.exists('my world') == true // false positive
}
@ -50,7 +50,7 @@ fn test_bloom_filter_fast_union_intersection() {
a.add('super rust')
b.add('hello world')
b.add('v is awsome')
b.add('v is awesome')
b.add('power by v')
assert a.exists('power by v') == true
@ -59,7 +59,7 @@ fn test_bloom_filter_fast_union_intersection() {
assert a.exists('power c++') == false
assert b.exists('hello world') == true
assert b.exists('v is awsome') == true
assert b.exists('v is awesome') == true
assert b.exists('power by v') == true
assert b.exists('my world') == false
@ -69,7 +69,7 @@ fn test_bloom_filter_fast_union_intersection() {
assert c.exists('super rust') == true
assert c.exists('power c++') == false
assert c.exists('hello world') == true
assert c.exists('v is awsome') == true
assert c.exists('v is awesome') == true
assert c.exists('power by v') == true
assert c.exists('my world') == false
@ -79,7 +79,7 @@ fn test_bloom_filter_fast_union_intersection() {
assert d.exists('super rust') == false
assert d.exists('power c++') == false
assert d.exists('hello world') == false
assert d.exists('v is awsome') == false
assert d.exists('v is awesome') == false
assert d.exists('power by v') == true
assert d.exists('my world') == false
}

View file

@ -1,6 +1,6 @@
module datatypes
/// Internal rapresentation of the tree node
/// Internal representation of the tree node
[heap]
struct BSTreeNode[T] {
mut:
@ -234,7 +234,7 @@ fn (bst &BSTree[T]) pre_order_traversal_helper(node &BSTreeNode[T], mut result [
bst.pre_order_traversal_helper(node.right, mut result)
}
// get_node is a helper method to ge the internal rapresentation of the node with the `value`.
// get_node is a helper method to ge the internal representation of the node with the `value`.
fn (bst &BSTree[T]) get_node(node &BSTreeNode[T], value T) &BSTreeNode[T] {
if unsafe { node == 0 } || !node.is_init {
return new_none_node[T](false)

View file

@ -86,7 +86,7 @@ fn test_get_left_on_empty_bst() {
}
// Check the remove operation if it is able to remove
// all elements required, and mantains the BST propriety.
// all elements required, and maintains the BST propriety.
fn test_remove_from_bst_one() {
mut bst := BSTree[int]{}
assert bst.insert(10)

View file

@ -29,7 +29,7 @@ mut:
deleted_at time.Time
}
struct TestDefaultAtribute {
struct TestDefaultAttribute {
id string [primary; sql: serial]
name string
created_at string [default: 'CURRENT_TIMESTAMP'; sql_type: 'TIMESTAMP']
@ -205,13 +205,13 @@ fn test_mysql_orm() {
/** test default attribute
*/
sql db {
create table TestDefaultAtribute
create table TestDefaultAttribute
}!
mut result_defaults := db.query("
SELECT COLUMN_DEFAULT
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'TestDefaultAtribute'
WHERE TABLE_NAME = 'TestDefaultAttribute'
ORDER BY ORDINAL_POSITION
") or {
println(err)
@ -220,7 +220,7 @@ fn test_mysql_orm() {
mut information_schema_defaults_results := []string{}
sql db {
drop table TestDefaultAtribute
drop table TestDefaultAttribute
}!
information_schema_column_default_sql := [{

View file

@ -29,7 +29,7 @@ mut:
deleted_at time.Time
}
struct TestDefaultAtribute {
struct TestDefaultAttribute {
id string [default: 'gen_random_uuid()'; primary; sql_type: 'uuid']
name string
created_at string [default: 'CURRENT_TIMESTAMP'; sql_type: 'TIMESTAMP']
@ -202,13 +202,13 @@ fn test_pg_orm() {
/** test default attribute
*/
sql db {
create table TestDefaultAtribute
create table TestDefaultAttribute
}!
mut result_defaults := db.exec("
SELECT column_default
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'TestDefaultAtribute'
WHERE TABLE_NAME = 'TestDefaultAttribute'
ORDER BY ORDINAL_POSITION
") or {
println(err)
@ -220,7 +220,7 @@ fn test_pg_orm() {
information_schema_defaults_results << defaults.vals[0]
}
sql db {
drop table TestDefaultAtribute
drop table TestDefaultAttribute
}!
assert ['gen_random_uuid()', '', 'CURRENT_TIMESTAMP'] == information_schema_defaults_results
}

View file

@ -13,7 +13,7 @@ struct TestCustomSqlType {
custom6 time.Time
}
struct TestDefaultAtribute {
struct TestDefaultAttribute {
id string [primary; sql: serial]
name string
created_at ?string [default: 'CURRENT_TIME']
@ -124,11 +124,11 @@ fn test_sqlite_orm() {
*/
sql db {
create table TestDefaultAtribute
create table TestDefaultAttribute
}!
mut result_default_sql := db.exec('
pragma table_info(TestDefaultAtribute);
pragma table_info(TestDefaultAttribute);
')!
mut information_schema_data_types_results := []string{}
@ -139,29 +139,29 @@ fn test_sqlite_orm() {
}
assert information_schema_data_types_results == information_schema_default_sql
test_default_atribute := TestDefaultAtribute{
test_default_attribute := TestDefaultAttribute{
name: 'Hitalo'
}
sql db {
insert test_default_atribute into TestDefaultAtribute
insert test_default_attribute into TestDefaultAttribute
}!
test_default_atributes := sql db {
select from TestDefaultAtribute limit 1
test_default_attributes := sql db {
select from TestDefaultAttribute limit 1
}!
result_test_default_atribute := test_default_atributes.first()
assert result_test_default_atribute.name == 'Hitalo'
assert test_default_atribute.created_at or { '' } == ''
assert test_default_atribute.created_at1 or { '' } == ''
assert test_default_atribute.created_at2 or { '' } == ''
assert result_test_default_atribute.created_at or { '' }.len == 8 // HH:MM:SS
assert result_test_default_atribute.created_at1 or { '' }.len == 10 // YYYY-MM-DD
assert result_test_default_atribute.created_at2 or { '' }.len == 19 // YYYY-MM-DD HH:MM:SS
result_test_default_attribute := test_default_attributes.first()
assert result_test_default_attribute.name == 'Hitalo'
assert test_default_attribute.created_at or { '' } == ''
assert test_default_attribute.created_at1 or { '' } == ''
assert test_default_attribute.created_at2 or { '' } == ''
assert result_test_default_attribute.created_at or { '' }.len == 8 // HH:MM:SS
assert result_test_default_attribute.created_at1 or { '' }.len == 10 // YYYY-MM-DD
assert result_test_default_attribute.created_at2 or { '' }.len == 19 // YYYY-MM-DD HH:MM:SS
sql db {
drop table TestDefaultAtribute
drop table TestDefaultAttribute
}!
}

View file

@ -80,7 +80,7 @@ fn test_over() {
semi_r := gx.Color{255, 0, 0, 128}
semi_g := gx.Color{0, 255, 0, 128}
semi_b := gx.Color{0, 0, 255, 128}
// fully opaque colors, should be preserved when layed *over* any others:
// fully opaque colors, should be preserved when laid *over* any others:
assert b.over(g) == b
assert r.over(g) == r
assert y.over(r) == y

View file

@ -22,7 +22,7 @@ pub fn (l &Log) get_level() Level {
return l.level
}
// set_level sets the logging level to `level`. Messges for levels above it will skipped.
// set_level sets the logging level to `level`. Messages for levels above it will skipped.
// For example, after calling log.set_level(.info), log.debug('message') will produce nothing.
// Call log.set_level(.disabled) to turn off the logging of all messages.
pub fn (mut l Log) set_level(level Level) {

View file

@ -4,7 +4,7 @@ module picoev
#include <sys/types.h>
#include <sys/event.h>
fn C.kevent(int, changelist voidptr, nchanges int, eventlist voidptr, nevents int, timout &C.timespec) int
fn C.kevent(int, changelist voidptr, nchanges int, eventlist voidptr, nevents int, timeout &C.timespec) int
fn C.kqueue() int
fn C.EV_SET(kev voidptr, ident int, filter i16, flags u16, fflags u32, data voidptr, udata voidptr)

View file

@ -4,7 +4,7 @@ module picoev
#include <sys/types.h>
#include <sys/event.h>
fn C.kevent(int, changelist voidptr, nchanges int, eventlist voidptr, nevents int, timout &C.timespec) int
fn C.kevent(int, changelist voidptr, nchanges int, eventlist voidptr, nevents int, timeout &C.timespec) int
fn C.kqueue() int
fn C.EV_SET(kev voidptr, ident int, filter i16, flags u16, fflags u32, data voidptr, udata voidptr)

View file

@ -99,7 +99,7 @@ fn fatal_socket_error(fd int) bool {
return true
}
// listen creates a listening tcp socket and returns its file decriptor
// listen creates a listening tcp socket and returns its file descriptor
fn listen(config Config) int {
// not using the `net` modules sockets, because not all socket options are defined
fd := C.socket(net.AddrFamily.ip, net.SocketType.tcp, 0)

View file

@ -407,7 +407,7 @@ pub fn (mut rng PRNG) binomial(n int, p f64) !int {
return count
}
// exponential returns an exponentially distributed random number with the rate paremeter
// exponential returns an exponentially distributed random number with the rate parameter
// lambda. It is expected that lambda is positive.
pub fn (mut rng PRNG) exponential(lambda f64) f64 {
if lambda <= 0 {
@ -748,7 +748,7 @@ pub fn binomial(n int, p f64) !int {
return default_rng.binomial(n, p)
}
// exponential returns an exponentially distributed random number with the rate paremeter
// exponential returns an exponentially distributed random number with the rate parameter
// lambda. It is expected that lambda is positive.
pub fn exponential(lambda f64) f64 {
return default_rng.exponential(lambda)

View file

@ -334,7 +334,7 @@ fn converter(mut pn PrepNumber) u64 {
*/
// C.printf(c"mantissa before rounding: %08x%08x%08x binexp: %d \n", s2,s1,s0,binexp)
// s1 => 0xFFFFFFxx only F are rapresented
// s1 => 0xFFFFFFxx only F are represented
nbit := 7
check_round_bit := u32(1) << u32(nbit)
check_round_mask := u32(0xFFFFFFFF) << u32(nbit)

View file

@ -1,16 +1,16 @@
module term
#const $tty = require('tty');
// get_terminal_size returns a number of colums and rows of terminal window.
// get_terminal_size returns a number of columns and rows of terminal window.
pub fn get_terminal_size() (int, int) {
$if js_node {
colums := 0
cols := 0
rows := 0
#let sizes = $tty.WriteStream(1).getWindowSize();
#colums.val = sizes[0];
#cols.val = sizes[0];
#rows.val = sizes[1];
return colums, rows
return cols, rows
} $else {
return default_columns_size, default_rows_size
}

View file

@ -15,7 +15,7 @@ pub:
fn C.ioctl(fd int, request u64, arg voidptr) int
// get_terminal_size returns a number of colums and rows of terminal window.
// get_terminal_size returns a number of columns and rows of terminal window.
pub fn get_terminal_size() (int, int) {
if os.is_atty(1) <= 0 || os.getenv('TERM') == 'dumb' {
return default_columns_size, default_rows_size

View file

@ -180,7 +180,7 @@ fn supports_truecolor() bool {
if os.getenv('COLORTERM') in ['truecolor', '24bit'] {
return true
}
// set the bg color to some arbirtrary value (#010203), assumed not to be the default
// set the bg color to some arbitrary value (#010203), assumed not to be the default
print('\x1b[48:2:1:2:3m')
flush_stdout()
// andquery the current color

View file

@ -490,7 +490,7 @@ fn (mut c Checker) assign_stmt(mut node ast.AssignStmt) {
if r is ast.Ident {
obj := r.obj
if obj is ast.Var && !obj.is_mut {
c.warn('cannot add a referenece to an immutable object to a mutable array',
c.warn('cannot add a reference to an immutable object to a mutable array',
elem_expr.pos)
}
}
@ -553,7 +553,7 @@ or use an explicit `unsafe{ a[..] }`, if you do not want a copy of the slice.',
if left_sym.kind == .function && right_sym.info is ast.FnType {
return_sym := c.table.sym(right_sym.info.func.return_type)
if return_sym.kind == .placeholder {
c.error('unkown return type: cannot assign `${right}` as a function variable',
c.error('unknown return type: cannot assign `${right}` as a function variable',
right.pos())
} else if (!right_sym.info.is_anon && return_sym.kind == .any)
|| (return_sym.info is ast.Struct && return_sym.info.is_generic) {

View file

@ -1,11 +1,11 @@
vlib/v/checker/tests/array_of_refs_mutability.vv:11:14: warning: cannot add a referenece to an immutable object to a mutable array
vlib/v/checker/tests/array_of_refs_mutability.vv:11:14: warning: cannot add a reference to an immutable object to a mutable array
9 | }
10 |
11 | mut arr := [&x]
| ^
12 | arr[0].bar = 30
13 |
vlib/v/checker/tests/array_of_refs_mutability.vv:15:10: warning: cannot add a referenece to an immutable object to a mutable array
vlib/v/checker/tests/array_of_refs_mutability.vv:15:10: warning: cannot add a reference to an immutable object to a mutable array
13 |
14 | mut arr2 := [&Foo{}]
15 | arr2 = [&x]

View file

@ -1,4 +1,4 @@
vlib/v/checker/tests/invalid_insert_references_test.vv:4:12: warning: cannot add a referenece to an immutable object to a mutable array
vlib/v/checker/tests/invalid_insert_references_test.vv:4:12: warning: cannot add a reference to an immutable object to a mutable array
2 | fn test_invalid_insert_references() {
3 | b := 0
4 | mut a := [&b]

View file

@ -5,7 +5,7 @@ Did you mean `[2]fn (u32) UnknownThing`?
| ~~~~~~~~~~~~
3 | }
4 |
vlib/v/checker/tests/unknown_array_fn_type_in_struct_field.vv:6:18: error: unkown return type: cannot assign `virt.fns[0]` as a function variable
vlib/v/checker/tests/unknown_array_fn_type_in_struct_field.vv:6:18: error: unknown return type: cannot assign `virt.fns[0]` as a function variable
4 |
5 | fn (virt Virt) caller() {
6 | func := virt.fns[0]

View file

@ -327,13 +327,13 @@ pub fn (mut d Doc) file_ast(mut file_ast ast.File) map[string]DocNode {
last_import_stmt_idx = sidx
}
}
mut preceeding_comments := []DocComment{}
mut preceding_comments := []DocComment{}
// mut imports_section := true
for sidx, mut stmt in file_ast.stmts {
if mut stmt is ast.ExprStmt {
// Collect comments
if mut stmt.expr is ast.Comment {
preceeding_comments << ast_comment_to_doc_comment(stmt.expr)
preceding_comments << ast_comment_to_doc_comment(stmt.expr)
continue
}
}
@ -343,13 +343,13 @@ pub fn (mut d Doc) file_ast(mut file_ast ast.File) map[string]DocNode {
continue
}
// the previous comments were probably a copyright/license one
module_comment := merge_doc_comments(preceeding_comments)
preceeding_comments = []
module_comment := merge_doc_comments(preceding_comments)
preceding_comments = []
if !d.is_vlib && !module_comment.starts_with('Copyright (c)') {
if module_comment == '' {
continue
}
d.head.comments << preceeding_comments
d.head.comments << preceding_comments
}
continue
}
@ -357,16 +357,16 @@ pub fn (mut d Doc) file_ast(mut file_ast ast.File) map[string]DocNode {
// the accumulated comments were interspersed before/between the imports;
// just add them all to the module comments:
if d.with_head {
d.head.comments << preceeding_comments
d.head.comments << preceding_comments
}
preceeding_comments = []
preceding_comments = []
// imports_section = false
}
if stmt is ast.Import {
continue
}
mut node := d.stmt(mut stmt, os.base(file_ast.path)) or {
preceeding_comments = []
preceding_comments = []
continue
}
if node.parent_name !in contents {
@ -380,10 +380,10 @@ pub fn (mut d Doc) file_ast(mut file_ast ast.File) map[string]DocNode {
kind: parent_node_kind
}
}
if d.with_comments && preceeding_comments.len > 0 {
node.comments << preceeding_comments
if d.with_comments && preceding_comments.len > 0 {
node.comments << preceding_comments
}
preceeding_comments = []
preceding_comments = []
if node.parent_name.len > 0 {
parent_name := node.parent_name
if node.parent_name == 'Constants' {

View file

@ -276,7 +276,7 @@ pub fn (mut e Eval) register_symbol(stmt ast.Stmt, mod string, file string) {
}
fn (e Eval) error(msg string) {
eprintln('> V interpeter backtrace:')
eprintln('> V interpreter backtrace:')
e.print_backtrace()
util.verror('interpreter', msg)
}

View file

@ -52,7 +52,7 @@ pub fn (mut e Eval) stmt(stmt ast.Stmt) {
}
}
else {
e.error('unknown assign statment: ${stmt.op}')
e.error('unknown assign statement: ${stmt.op}')
}
}
}

View file

@ -49,7 +49,7 @@ pub fn (mut e Eval) set(expr ast.Expr, val Object, init bool, typ ast.Type) {
// }
}
else {
panic('unknown left value to assign statment: ${expr.type_name()}')
panic('unknown left value to assign statement: ${expr.type_name()}')
}
}
}
@ -62,7 +62,7 @@ pub fn (mut e Eval) add(expr ast.Expr, val Object) {
.plus, e.local_vars[expr.name].typ)
}
else {
panic('unknown left value to add statment: ${expr.type_name()}')
panic('unknown left value to add statement: ${expr.type_name()}')
}
}
}

View file

@ -191,8 +191,8 @@ fn (mut g Gen) struct_init(node ast.StructInit) {
continue
}
}
if already_initalised_node_field_index := inited_fields[field.name] {
mut sfield := node.init_fields[already_initalised_node_field_index]
if already_inited_node_field_index := inited_fields[field.name] {
mut sfield := node.init_fields[already_inited_node_field_index]
if sfield.typ == 0 {
continue
}
@ -231,7 +231,7 @@ fn (mut g Gen) struct_init(node ast.StructInit) {
if node.no_keys && sym.kind == .struct_ {
sym_info := sym.info as ast.Struct
if sym_info.fields.len == node.init_fields.len {
sfield.name = sym_info.fields[already_initalised_node_field_index].name
sfield.name = sym_info.fields[already_inited_node_field_index].name
}
}
g.struct_init_field(sfield, sym.language)

View file

@ -1,5 +1,5 @@
================ V panic ================
module: main
function: buggy_function()
message: panicing...
message: panicking...
file: vlib/v/slow_tests/inout/panic_with_cg.vv:2

View file

@ -1,5 +1,5 @@
fn buggy_function() {
panic('panicing...')
panic('panicking...')
}
fn main() {

View file

@ -11,7 +11,7 @@ fn (b Bar) foo() int {
return b.f[0](22)
}
fn test_array_of_fns_index_call_with_direct_array_acess() {
fn test_array_of_fns_index_call_with_direct_array_access() {
bar := Bar{[func]}
ret := bar.foo()
println(ret)

View file

@ -11,10 +11,10 @@ fn init_b(n_rows int) []map[int]int {
return tally
}
pub fn tallys_in_array(indexs []int, values [][]int, init fn (int) []map[int]int) []map[int]int {
mut tally := init(indexs.len)
pub fn tallys_in_array(indices []int, values [][]int, init fn (int) []map[int]int) []map[int]int {
mut tally := init(indices.len)
for row in 0 .. values.len {
for i, index in indexs {
for i, index in indices {
tally[i][values[row][index]]++
}
}
@ -22,12 +22,12 @@ pub fn tallys_in_array(indexs []int, values [][]int, init fn (int) []map[int]int
}
fn test_array_of_map_with_default() {
indexs := [0, 1]
indices := [0, 1]
values := [[1, 201], [1, 3], [1, 201], [1, 3]]
out1 := tallys_in_array(indexs, values, init_a)
out1 := tallys_in_array(indices, values, init_a)
println(out1)
out2 := tallys_in_array(indexs, values, init_b)
out2 := tallys_in_array(indices, values, init_b)
println(out2)
mut maps := []map[int]int{}

View file

@ -1,10 +1,10 @@
pub type MenuItem = Action | Group | Separater
pub type MenuItem = Action | Group | Separator
pub struct Group {
children []MenuItem
}
pub struct Separater {}
pub struct Separator {}
pub struct Action {}
@ -12,7 +12,7 @@ fn test_array_of_sumtype_init() {
g := Group{
children: [
Action{},
Separater{},
Separator{},
Group{
children: [
Action{},

View file

@ -14,7 +14,7 @@ fn (x St) val() int {
return x.n
}
fn owerwrite_stack() f64 {
fn overwrite_stack() f64 {
a := 12.5
b := 3.5
c := a + b
@ -37,7 +37,7 @@ fn return_interface(x St) MyInterface {
fn test_gen_interface() {
i1 := gen_interface()
d := owerwrite_stack()
d := overwrite_stack()
assert i1.val() == -123
assert d == 16.0
}
@ -47,7 +47,7 @@ fn test_convert_to_interface() {
n: 5
}
i2 := return_interface(x)
d := owerwrite_stack()
d := overwrite_stack()
assert i2.val() == 5
assert d == 16.0
}

View file

@ -45,7 +45,7 @@ fn get_ref_structs() (&Abc, &St, &Qwe) {
return aa, bb, xx
}
fn owerwrite_stack() f64 {
fn overwrite_stack() f64 {
a := 12.5
b := 3.5
c := a + b
@ -54,7 +54,7 @@ fn owerwrite_stack() f64 {
fn test_ref_struct() {
u, v, w := get_ref_structs()
d := owerwrite_stack()
d := overwrite_stack()
assert u.n == 3
assert v.n == 7
assert w.a.n == 23
@ -74,7 +74,7 @@ fn test_value_ref_heap_struct() {
}
y := return_heap_obj_value_as_ref(x)
x.f = 22.0625
d := owerwrite_stack()
d := overwrite_stack()
assert typeof(y).name == '&Qwe'
assert x.f == 22.0625
assert x.a.n == -129
@ -98,7 +98,7 @@ fn test_value_ref_struct() {
}
y := return_struct_value_as_ref(x)
x.f = 91.0625
d := owerwrite_stack()
d := overwrite_stack()
assert typeof(y).name == '&NotHeap'
assert y.f == -17.125
assert x.f == 91.0625
@ -113,7 +113,7 @@ fn get_int_ref() &int {
fn test_int_ref() {
iptr := get_int_ref()
assert typeof(iptr).name == '&int'
d := owerwrite_stack()
d := overwrite_stack()
assert *iptr == 49154
assert d == 16.0
}
@ -127,7 +127,7 @@ fn test_value_as_ref() {
y := pass_f64_as_ref(x)
assert typeof(y).name == '&f64'
x = 23.0625
d := owerwrite_stack()
d := overwrite_stack()
assert x == 23.0625
assert *y == -31.75
assert d == 16.0

View file

@ -225,12 +225,12 @@ pub fn (mut app App) middleware_auth() vweb.Result {
// ======================================
pub fn (mut app App) shutdown() vweb.Result {
spawn app.gracefull_exit()
spawn app.exit_gracefully()
return app.ok('good bye')
}
fn (mut app App) gracefull_exit() {
eprintln('>> webserver: gracefull_exit')
fn (mut app App) exit_gracefully() {
eprintln('>> webserver: exit_gracefully')
time.sleep(100 * time.millisecond)
exit(0)
}

View file

@ -107,12 +107,12 @@ pub fn (mut app App) shutdown() vweb.Result {
if session_key != 'superman' {
return app.not_found()
}
spawn app.gracefull_exit()
spawn app.exit_gracefully()
return app.ok('good bye')
}
fn (mut app App) gracefull_exit() {
eprintln('>> webserver: gracefull_exit')
fn (mut app App) exit_gracefully() {
eprintln('>> webserver: exit_gracefully')
time.sleep(100 * time.millisecond)
exit(0)
}

View file

@ -289,7 +289,7 @@ fn simple_tcp_client(config SimpleTcpClientConfig) !string {
break
}
if client == unsafe { nil } {
eprintln('coult not create a tcp client connection to ${localserver} after ${config.retries} retries')
eprintln('could not create a tcp client connection to ${localserver} after ${config.retries} retries')
exit(1)
}
client.set_read_timeout(tcp_r_timeout)
@ -330,7 +330,7 @@ fn simple_tcp_client_post_json(config SimpleTcpClientConfig) !string {
break
}
if client == unsafe { nil } {
eprintln('coult not create a tcp client connection to ${localserver} after ${config.retries} retries')
eprintln('could not create a tcp client connection to ${localserver} after ${config.retries} retries')
exit(1)
}
client.set_read_timeout(tcp_r_timeout)

View file

@ -275,12 +275,12 @@ pub fn (mut app App) shutdown() vweb.Result {
if session_key != 'superman' {
return app.not_found()
}
spawn app.gracefull_exit()
spawn app.exit_gracefully()
return app.ok('good bye')
}
fn (mut app App) gracefull_exit() {
eprintln('>> webserver: gracefull_exit')
fn (mut app App) exit_gracefully() {
eprintln('>> webserver: exit_gracefully')
time.sleep(100 * time.millisecond)
exit(0)
}

View file

@ -316,7 +316,7 @@ fn simple_tcp_client(config SimpleTcpClientConfig) !string {
break
}
if client == unsafe { nil } {
eprintln('coult not create a tcp client connection to ${localserver} after ${config.retries} retries')
eprintln('could not create a tcp client connection to ${localserver} after ${config.retries} retries')
exit(1)
}
client.set_read_timeout(tcp_r_timeout)

View file

@ -135,12 +135,12 @@ pub fn (mut app App) shutdown() vweb.Result {
if session_key != 'superman' {
return app.not_found()
}
spawn app.gracefull_exit()
spawn app.exit_gracefully()
return app.ok('good bye')
}
fn (mut app App) gracefull_exit() {
eprintln('>> webserver: gracefull_exit')
fn (mut app App) exit_gracefully() {
eprintln('>> webserver: exit_gracefully')
time.sleep(100 * time.millisecond)
exit(0)
}