diff options
author | Indrajith K L | 2022-12-03 17:00:20 +0530 |
---|---|---|
committer | Indrajith K L | 2022-12-03 17:00:20 +0530 |
commit | f5c4671bfbad96bf346bd7e9a21fc4317b4959df (patch) | |
tree | 2764fc62da58f2ba8da7ed341643fc359873142f /v_windows/v/old/vlib/v/parser/tests | |
download | cli-tools-windows-master.tar.gz cli-tools-windows-master.tar.bz2 cli-tools-windows-master.zip |
Diffstat (limited to 'v_windows/v/old/vlib/v/parser/tests')
211 files changed, 1352 insertions, 0 deletions
diff --git a/v_windows/v/old/vlib/v/parser/tests/README.md b/v_windows/v/old/vlib/v/parser/tests/README.md new file mode 100644 index 0000000..7547a55 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/README.md @@ -0,0 +1 @@ +Put here tests, ensuring that the v's parser errors for certain situations. diff --git a/v_windows/v/old/vlib/v/parser/tests/anon_fn_return_type.out b/v_windows/v/old/vlib/v/parser/tests/anon_fn_return_type.out new file mode 100644 index 0000000..fe42d51 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/anon_fn_return_type.out @@ -0,0 +1,6 @@ +vlib/v/parser/tests/anon_fn_return_type.vv:7:22: error: expected return type, not string `hi` for anonymous function + 5 | _ = fn (name string) flag.Flag + 6 | _ = fn (name string) flag.Flag {return flag.Flag{}} + 7 | _ = fn (name string) "hi" + name + | ~~~~ + 8 | diff --git a/v_windows/v/old/vlib/v/parser/tests/anon_fn_return_type.vv b/v_windows/v/old/vlib/v/parser/tests/anon_fn_return_type.vv new file mode 100644 index 0000000..fc50fa0 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/anon_fn_return_type.vv @@ -0,0 +1,8 @@ +import flag + +_ = fn (name string) +_ = fn (name string) {} +_ = fn (name string) flag.Flag +_ = fn (name string) flag.Flag {return flag.Flag{}} +_ = fn (name string) "hi" + name + diff --git a/v_windows/v/old/vlib/v/parser/tests/anon_unused_param.out b/v_windows/v/old/vlib/v/parser/tests/anon_unused_param.out new file mode 100644 index 0000000..a12769b --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/anon_unused_param.out @@ -0,0 +1,4 @@ +vlib/v/parser/tests/anon_unused_param.vv:1:9: error: use `_` to name an unused parameter + 1 | _ = fn (int){} + | ~~~ + 2 | diff --git a/v_windows/v/old/vlib/v/parser/tests/anon_unused_param.vv b/v_windows/v/old/vlib/v/parser/tests/anon_unused_param.vv new file mode 100644 index 0000000..c285cea --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/anon_unused_param.vv @@ -0,0 +1,2 @@ +_ = fn (int){} + diff --git a/v_windows/v/old/vlib/v/parser/tests/array_init.out b/v_windows/v/old/vlib/v/parser/tests/array_init.out new file mode 100644 index 0000000..75bdbe3 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/array_init.out @@ -0,0 +1,12 @@ +vlib/v/parser/tests/array_init.vv:2:7: warning: use `x := []Type{}` instead of `x := []Type` + 1 | fn main() { + 2 | _ := []int + | ~~~~~ + 3 | _ := [1]int + 4 | } +vlib/v/parser/tests/array_init.vv:3:7: warning: use e.g. `x := [1]Type{}` instead of `x := [1]Type` + 1 | fn main() { + 2 | _ := []int + 3 | _ := [1]int + | ~~~~~~ + 4 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/array_init.vv b/v_windows/v/old/vlib/v/parser/tests/array_init.vv new file mode 100644 index 0000000..4bbfb88 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/array_init.vv @@ -0,0 +1,4 @@ +fn main() { + _ := []int + _ := [1]int +} diff --git a/v_windows/v/old/vlib/v/parser/tests/array_pos_err.out b/v_windows/v/old/vlib/v/parser/tests/array_pos_err.out new file mode 100644 index 0000000..8593054 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/array_pos_err.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/array_pos_err.vv:2:2: error: expression evaluated but not used + 1 | fn main() { + 2 | '' in [] + | ~~~~~~~~ + 3 | }
\ No newline at end of file diff --git a/v_windows/v/old/vlib/v/parser/tests/array_pos_err.vv b/v_windows/v/old/vlib/v/parser/tests/array_pos_err.vv new file mode 100644 index 0000000..0988140 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/array_pos_err.vv @@ -0,0 +1,3 @@ +fn main() { + '' in [] +}
\ No newline at end of file diff --git a/v_windows/v/old/vlib/v/parser/tests/c_struct_no_embed.out b/v_windows/v/old/vlib/v/parser/tests/c_struct_no_embed.out new file mode 100644 index 0000000..89972cd --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/c_struct_no_embed.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/c_struct_no_embed.vv:7:1: error: expecting type declaration + 5 | struct C.Unknown { + 6 | Foo + 7 | } + | ^
\ No newline at end of file diff --git a/v_windows/v/old/vlib/v/parser/tests/c_struct_no_embed.vv b/v_windows/v/old/vlib/v/parser/tests/c_struct_no_embed.vv new file mode 100644 index 0000000..020dce7 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/c_struct_no_embed.vv @@ -0,0 +1,7 @@ +struct Foo { + x int +} + +struct C.Unknown { + Foo +}
\ No newline at end of file diff --git a/v_windows/v/old/vlib/v/parser/tests/const_index.out b/v_windows/v/old/vlib/v/parser/tests/const_index.out new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/const_index.out @@ -0,0 +1 @@ + diff --git a/v_windows/v/old/vlib/v/parser/tests/const_index.vv b/v_windows/v/old/vlib/v/parser/tests/const_index.vv new file mode 100644 index 0000000..c629502 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/const_index.vv @@ -0,0 +1,22 @@ +// must not parse 4[deprecated] as index expression +const x = 4 +[deprecated] +fn g() { + a := [3] + // indexing is currently allowed on next line + _ = a + [0] +} + +const y = 5 +[deprecated] +fn h() {} + +const z = 6 +[typedef] +struct C.Foo{} + +// test implicit main allows indexing on next line +a := [3] +_ := a +[0] diff --git a/v_windows/v/old/vlib/v/parser/tests/const_missing_rpar_a.out b/v_windows/v/old/vlib/v/parser/tests/const_missing_rpar_a.out new file mode 100644 index 0000000..e3d0186 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/const_missing_rpar_a.out @@ -0,0 +1,3 @@ +vlib/v/parser/tests/const_missing_rpar_a.vv:3:1: error: unexpected eof, expecting ´)´ + 1 | const ( + 2 | a = 5 diff --git a/v_windows/v/old/vlib/v/parser/tests/const_missing_rpar_a.vv b/v_windows/v/old/vlib/v/parser/tests/const_missing_rpar_a.vv new file mode 100644 index 0000000..38043f9 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/const_missing_rpar_a.vv @@ -0,0 +1,2 @@ +const ( + a = 5 diff --git a/v_windows/v/old/vlib/v/parser/tests/const_missing_rpar_b.out b/v_windows/v/old/vlib/v/parser/tests/const_missing_rpar_b.out new file mode 100644 index 0000000..4bef87e --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/const_missing_rpar_b.out @@ -0,0 +1,3 @@ +vlib/v/parser/tests/const_missing_rpar_b.vv:4:1: error: unexpected eof, expecting ´)´ + 2 | a = 5 + 3 | // foo diff --git a/v_windows/v/old/vlib/v/parser/tests/const_missing_rpar_b.vv b/v_windows/v/old/vlib/v/parser/tests/const_missing_rpar_b.vv new file mode 100644 index 0000000..dbb66af --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/const_missing_rpar_b.vv @@ -0,0 +1,3 @@ +const ( + a = 5 + // foo diff --git a/v_windows/v/old/vlib/v/parser/tests/const_only_keyword.out b/v_windows/v/old/vlib/v/parser/tests/const_only_keyword.out new file mode 100644 index 0000000..1e3de05 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/const_only_keyword.out @@ -0,0 +1,2 @@ +vlib/v/parser/tests/const_only_keyword.vv:2:1: error: unexpected eof, expecting name + 1 | const diff --git a/v_windows/v/old/vlib/v/parser/tests/const_only_keyword.vv b/v_windows/v/old/vlib/v/parser/tests/const_only_keyword.vv new file mode 100644 index 0000000..aaae4e1 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/const_only_keyword.vv @@ -0,0 +1 @@ +const diff --git a/v_windows/v/old/vlib/v/parser/tests/const_unexpected_eof.out b/v_windows/v/old/vlib/v/parser/tests/const_unexpected_eof.out new file mode 100644 index 0000000..8f90da6 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/const_unexpected_eof.out @@ -0,0 +1,2 @@ +vlib/v/parser/tests/const_unexpected_eof.vv:2:1: error: unexpected eof, expecting an expression + 1 | const a = diff --git a/v_windows/v/old/vlib/v/parser/tests/const_unexpected_eof.vv b/v_windows/v/old/vlib/v/parser/tests/const_unexpected_eof.vv new file mode 100644 index 0000000..6210a52 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/const_unexpected_eof.vv @@ -0,0 +1 @@ +const a = diff --git a/v_windows/v/old/vlib/v/parser/tests/dec_use_as_value.out b/v_windows/v/old/vlib/v/parser/tests/dec_use_as_value.out new file mode 100644 index 0000000..91587e1 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/dec_use_as_value.out @@ -0,0 +1,6 @@ +vlib/v/parser/tests/dec_use_as_value.vv:2:16: error: cannot use i-- as value + 1 | fn main() { + 2 | for i := 100; i--; i > 0 { + | ^ + 3 | } + 4 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/dec_use_as_value.vv b/v_windows/v/old/vlib/v/parser/tests/dec_use_as_value.vv new file mode 100644 index 0000000..4774070 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/dec_use_as_value.vv @@ -0,0 +1,4 @@ +fn main() { + for i := 100; i--; i > 0 { + } +} diff --git a/v_windows/v/old/vlib/v/parser/tests/defer_propagate.out b/v_windows/v/old/vlib/v/parser/tests/defer_propagate.out new file mode 100644 index 0000000..93dae37 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/defer_propagate.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/defer_propagate.vv:9:15: error: error propagation not allowed inside `defer` blocks + 7 | mut a := 0 + 8 | defer { + 9 | a = test1() ? + | ^ + 10 | } + 11 | return a diff --git a/v_windows/v/old/vlib/v/parser/tests/defer_propagate.vv b/v_windows/v/old/vlib/v/parser/tests/defer_propagate.vv new file mode 100644 index 0000000..ad92bb9 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/defer_propagate.vv @@ -0,0 +1,16 @@ +fn test1() ?int { + a := 3 + return a +} + +fn test2() ?int { + mut a := 0 + defer { + a = test1() ? + } + return a + +fn main() { + x := test2() or { -1 } + println(x) +} diff --git a/v_windows/v/old/vlib/v/parser/tests/defer_return.out b/v_windows/v/old/vlib/v/parser/tests/defer_return.out new file mode 100644 index 0000000..2debd10 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/defer_return.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/defer_return.vv:3:3: error: `return` not allowed inside `defer` block + 1 | fn main() { + 2 | defer { + 3 | return + | ~~~~~~ + 4 | } + 5 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/defer_return.vv b/v_windows/v/old/vlib/v/parser/tests/defer_return.vv new file mode 100644 index 0000000..0bcc740 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/defer_return.vv @@ -0,0 +1,5 @@ +fn main() { + defer { + return + } +} diff --git a/v_windows/v/old/vlib/v/parser/tests/defer_return2.out b/v_windows/v/old/vlib/v/parser/tests/defer_return2.out new file mode 100644 index 0000000..54628e4 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/defer_return2.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/defer_return2.vv:3:3: error: `return` not allowed inside `defer` block + 1 | fn test1() int { + 2 | defer { + 3 | return 12 + | ~~~~~~ + 4 | } + 5 | a := 3 diff --git a/v_windows/v/old/vlib/v/parser/tests/defer_return2.vv b/v_windows/v/old/vlib/v/parser/tests/defer_return2.vv new file mode 100644 index 0000000..82f62aa --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/defer_return2.vv @@ -0,0 +1,12 @@ +fn test1() int { + defer { + return 12 + } + a := 3 + return a +} + +fn main() { + x := test1() + println(x) +} diff --git a/v_windows/v/old/vlib/v/parser/tests/duplicate_field_embed_err.out b/v_windows/v/old/vlib/v/parser/tests/duplicate_field_embed_err.out new file mode 100644 index 0000000..7fc6311 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/duplicate_field_embed_err.out @@ -0,0 +1,6 @@ +vlib/v/parser/tests/duplicate_field_embed_err.vv:8:2: error: duplicate field `ModFileAndFolder` + 6 | struct Bar { + 7 | ModFileAndFolder + 8 | vmod.ModFileAndFolder + | ~~~~~~~~~~~~~~~~~~~~~ + 9 | }
\ No newline at end of file diff --git a/v_windows/v/old/vlib/v/parser/tests/duplicate_field_embed_err.vv b/v_windows/v/old/vlib/v/parser/tests/duplicate_field_embed_err.vv new file mode 100644 index 0000000..d71112f --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/duplicate_field_embed_err.vv @@ -0,0 +1,9 @@ +import v.vmod + +struct ModFileAndFolder { + name int = 5 +} +struct Bar { + ModFileAndFolder + vmod.ModFileAndFolder +} diff --git a/v_windows/v/old/vlib/v/parser/tests/duplicate_type_a.out b/v_windows/v/old/vlib/v/parser/tests/duplicate_type_a.out new file mode 100644 index 0000000..a2324a4 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/duplicate_type_a.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/duplicate_type_a.vv:3:11: error: cannot register interface `Foo`, another type with this name exists + 1 | struct Foo {} + 2 | + 3 | interface Foo {} + | ~~~ diff --git a/v_windows/v/old/vlib/v/parser/tests/duplicate_type_a.vv b/v_windows/v/old/vlib/v/parser/tests/duplicate_type_a.vv new file mode 100644 index 0000000..f47419b --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/duplicate_type_a.vv @@ -0,0 +1,3 @@ +struct Foo {} + +interface Foo {} diff --git a/v_windows/v/old/vlib/v/parser/tests/duplicate_type_b.out b/v_windows/v/old/vlib/v/parser/tests/duplicate_type_b.out new file mode 100644 index 0000000..6831fda --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/duplicate_type_b.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/duplicate_type_b.vv:3:8: error: cannot register struct `Foo`, another type with this name exists + 1 | interface Foo {} + 2 | + 3 | struct Foo {} + | ~~~ diff --git a/v_windows/v/old/vlib/v/parser/tests/duplicate_type_b.vv b/v_windows/v/old/vlib/v/parser/tests/duplicate_type_b.vv new file mode 100644 index 0000000..52aa104 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/duplicate_type_b.vv @@ -0,0 +1,3 @@ +interface Foo {} + +struct Foo {} diff --git a/v_windows/v/old/vlib/v/parser/tests/duplicated_generic_err.out b/v_windows/v/old/vlib/v/parser/tests/duplicated_generic_err.out new file mode 100644 index 0000000..e151407 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/duplicated_generic_err.out @@ -0,0 +1,3 @@ +vlib/v/parser/tests/duplicated_generic_err.vv:1:12: error: duplicated generic parameter `A` + 1 | fn test<A, A>() {} + | ^ diff --git a/v_windows/v/old/vlib/v/parser/tests/duplicated_generic_err.vv b/v_windows/v/old/vlib/v/parser/tests/duplicated_generic_err.vv new file mode 100644 index 0000000..4b8e345 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/duplicated_generic_err.vv @@ -0,0 +1 @@ +fn test<A, A>() {} diff --git a/v_windows/v/old/vlib/v/parser/tests/empty_name_expr_err.out b/v_windows/v/old/vlib/v/parser/tests/empty_name_expr_err.out new file mode 100644 index 0000000..07cfb9b --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/empty_name_expr_err.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/empty_name_expr_err.vv:2:9: error: unexpected name `n` + 1 | fn main() { + 2 | return n ?( + | ^ + 3 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/empty_name_expr_err.vv b/v_windows/v/old/vlib/v/parser/tests/empty_name_expr_err.vv new file mode 100644 index 0000000..61d2740 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/empty_name_expr_err.vv @@ -0,0 +1,3 @@ +fn main() { + return n ?( +} diff --git a/v_windows/v/old/vlib/v/parser/tests/expected_type_enum_err.out b/v_windows/v/old/vlib/v/parser/tests/expected_type_enum_err.out new file mode 100644 index 0000000..e378cf7 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/expected_type_enum_err.out @@ -0,0 +1,6 @@ +vlib/v/parser/tests/expected_type_enum_err.vv:6:12: error: expected type is not an enum (`rune`) + 4 | + 5 | fn main() { + 6 | if `c` == .bar {} + | ~~~~ + 7 | }
\ No newline at end of file diff --git a/v_windows/v/old/vlib/v/parser/tests/expected_type_enum_err.vv b/v_windows/v/old/vlib/v/parser/tests/expected_type_enum_err.vv new file mode 100644 index 0000000..7385f14 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/expected_type_enum_err.vv @@ -0,0 +1,7 @@ +module main + +enum Test { bar } + +fn main() { + if `c` == .bar {} +} diff --git a/v_windows/v/old/vlib/v/parser/tests/expecting_assign_type_alias.out b/v_windows/v/old/vlib/v/parser/tests/expecting_assign_type_alias.out new file mode 100644 index 0000000..d273ac5 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/expecting_assign_type_alias.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/expecting_assign_type_alias.vv:1:10: error: unexpected name `int`, expecting `=` + 1 | type Ttt int + | ~~~ + 2 | + 3 | fn main() {}
\ No newline at end of file diff --git a/v_windows/v/old/vlib/v/parser/tests/expecting_assign_type_alias.vv b/v_windows/v/old/vlib/v/parser/tests/expecting_assign_type_alias.vv new file mode 100644 index 0000000..441cc40 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/expecting_assign_type_alias.vv @@ -0,0 +1,3 @@ +type Ttt int + +fn main() {} diff --git a/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_a.out b/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_a.out new file mode 100644 index 0000000..e83390f --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_a.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/expr_evaluated_but_not_used_a.vv:2:2: error: expression evaluated but not used + 1 | fn main() { + 2 | 'hello' + | ~~~~~~~ + 3 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_a.vv b/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_a.vv new file mode 100644 index 0000000..c4b6515 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_a.vv @@ -0,0 +1,3 @@ +fn main() { + 'hello' +}
\ No newline at end of file diff --git a/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_b.out b/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_b.out new file mode 100644 index 0000000..437f89a --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_b.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/expr_evaluated_but_not_used_b.vv:2:2: error: expression evaluated but not used + 1 | fn main() { + 2 | 22 + | ~~ + 3 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_b.vv b/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_b.vv new file mode 100644 index 0000000..cac3734 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_b.vv @@ -0,0 +1,3 @@ +fn main() { + 22 +}
\ No newline at end of file diff --git a/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_c.out b/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_c.out new file mode 100644 index 0000000..f6dbc23 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_c.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/expr_evaluated_but_not_used_c.vv:3:5: error: expression evaluated but not used + 1 | fn main() { + 2 | a := 10 + 3 | `b` + | ~~~ + 4 | println(a) + 5 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_c.vv b/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_c.vv new file mode 100644 index 0000000..863ce2f --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_c.vv @@ -0,0 +1,5 @@ +fn main() { + a := 10 + `b` + println(a) +}
\ No newline at end of file diff --git a/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_d.out b/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_d.out new file mode 100644 index 0000000..03639ea --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_d.out @@ -0,0 +1,6 @@ +vlib/v/parser/tests/expr_evaluated_but_not_used_d.vv:4:19: error: expression evaluated but not used + 2 | a := 1 + 3 | b := 2 + 4 | println(a*b), a+b + | ~~~ + 5 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_d.vv b/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_d.vv new file mode 100644 index 0000000..6dbacb7 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_d.vv @@ -0,0 +1,5 @@ +fn main() { + a := 1 + b := 2 + println(a*b), a+b +} diff --git a/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_e.out b/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_e.out new file mode 100644 index 0000000..c312124 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_e.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/expr_evaluated_but_not_used_e.vv:3:14: error: expression evaluated but not used + 1 | fn main() { + 2 | mut array := [1, 2, 3] + 3 | array << 4, 5 + | ^ + 4 | println(array) + 5 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_e.vv b/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_e.vv new file mode 100644 index 0000000..763624a --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_e.vv @@ -0,0 +1,5 @@ +fn main() { + mut array := [1, 2, 3] + array << 4, 5 + println(array) +} diff --git a/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_if.out b/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_if.out new file mode 100644 index 0000000..f35579a --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_if.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/expr_evaluated_but_not_used_if.vv:3:5: error: expression evaluated but not used + 1 | fn main() { + 2 | if true { + 3 | 1 + 1 + | ~~~~~ + 4 | 1 + 1 + 5 | } else { diff --git a/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_if.vv b/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_if.vv new file mode 100644 index 0000000..8cd5a96 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_if.vv @@ -0,0 +1,8 @@ +fn main() { + if true { + 1 + 1 + 1 + 1 + } else { + 1 + 1 + } +} diff --git a/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_or.out b/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_or.out new file mode 100644 index 0000000..70b3e7e --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_or.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/expr_evaluated_but_not_used_or.vv:3:5: error: expression evaluated but not used + 1 | fn main() { + 2 | f() or { + 3 | 0 + | ^ + 4 | 1 + 5 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_or.vv b/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_or.vv new file mode 100644 index 0000000..4a3a82a --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/expr_evaluated_but_not_used_or.vv @@ -0,0 +1,10 @@ +fn main() { + f() or { + 0 + 1 + } +} + +fn f() ?int { + return none +} diff --git a/v_windows/v/old/vlib/v/parser/tests/fn_attributes_duplicate_multiple.out b/v_windows/v/old/vlib/v/parser/tests/fn_attributes_duplicate_multiple.out new file mode 100644 index 0000000..c8015ca --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/fn_attributes_duplicate_multiple.out @@ -0,0 +1,6 @@ +vlib/v/parser/tests/fn_attributes_duplicate_multiple.vv:2:2: error: duplicate attribute `inline` + 1 | [inline] + 2 | [inline] + | ~~~~~~ + 3 | fn foo() {} + 4 | diff --git a/v_windows/v/old/vlib/v/parser/tests/fn_attributes_duplicate_multiple.vv b/v_windows/v/old/vlib/v/parser/tests/fn_attributes_duplicate_multiple.vv new file mode 100644 index 0000000..2e1f223 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/fn_attributes_duplicate_multiple.vv @@ -0,0 +1,7 @@ +[inline] +[inline] +fn foo() {} + +fn main() { + foo() +}
\ No newline at end of file diff --git a/v_windows/v/old/vlib/v/parser/tests/fn_attributes_duplicate_single.out b/v_windows/v/old/vlib/v/parser/tests/fn_attributes_duplicate_single.out new file mode 100644 index 0000000..34a90cd --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/fn_attributes_duplicate_single.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/fn_attributes_duplicate_single.vv:1:10: error: duplicate attribute `inline` + 1 | [inline; inline] + | ~~~~~~ + 2 | fn foo() {} + 3 | diff --git a/v_windows/v/old/vlib/v/parser/tests/fn_attributes_duplicate_single.vv b/v_windows/v/old/vlib/v/parser/tests/fn_attributes_duplicate_single.vv new file mode 100644 index 0000000..27d6f55 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/fn_attributes_duplicate_single.vv @@ -0,0 +1,6 @@ +[inline; inline] +fn foo() {} + +fn main() { + foo() +}
\ No newline at end of file diff --git a/v_windows/v/old/vlib/v/parser/tests/fn_attributes_empty_err.out b/v_windows/v/old/vlib/v/parser/tests/fn_attributes_empty_err.out new file mode 100644 index 0000000..d021aee --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/fn_attributes_empty_err.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/fn_attributes_empty_err.vv:1:1: error: attributes cannot be empty + 1 | [] fn tt() { + | ~~ + 2 | println('text') + 3 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/fn_attributes_empty_err.vv b/v_windows/v/old/vlib/v/parser/tests/fn_attributes_empty_err.vv new file mode 100644 index 0000000..fd584c2 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/fn_attributes_empty_err.vv @@ -0,0 +1,6 @@ +[] fn tt() { + println('text') +} +fn main() { + tt() +}
\ No newline at end of file diff --git a/v_windows/v/old/vlib/v/parser/tests/fn_decl_unexpected_eof.out b/v_windows/v/old/vlib/v/parser/tests/fn_decl_unexpected_eof.out new file mode 100644 index 0000000..aef33f6 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/fn_decl_unexpected_eof.out @@ -0,0 +1,3 @@ +vlib/v/parser/tests/fn_decl_unexpected_eof.vv:1:12: error: unexpected eof, expecting `}` + 1 | fn main() { + | ^ diff --git a/v_windows/v/old/vlib/v/parser/tests/fn_decl_unexpected_eof.vv b/v_windows/v/old/vlib/v/parser/tests/fn_decl_unexpected_eof.vv new file mode 100644 index 0000000..fd74173 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/fn_decl_unexpected_eof.vv @@ -0,0 +1 @@ +fn main() {
\ No newline at end of file diff --git a/v_windows/v/old/vlib/v/parser/tests/fn_type_only_args_in_interfaces.out b/v_windows/v/old/vlib/v/parser/tests/fn_type_only_args_in_interfaces.out new file mode 100644 index 0000000..acc1399 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/fn_type_only_args_in_interfaces.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/fn_type_only_args_in_interfaces.vv:22:1: error: `syntax_error` evaluated but not used + 20 | } + 21 | + 22 | syntax_error + | ~~~~~~~~~~~~ diff --git a/v_windows/v/old/vlib/v/parser/tests/fn_type_only_args_in_interfaces.vv b/v_windows/v/old/vlib/v/parser/tests/fn_type_only_args_in_interfaces.vv new file mode 100644 index 0000000..0a3e839 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/fn_type_only_args_in_interfaces.vv @@ -0,0 +1,22 @@ + +struct Type1 {} +struct Type2 {} +struct Type3 {} + + +pub interface Widget1 { + init(Type1, Type2) +} + +pub interface Widget2 { + init(Type1) + draw(Type2, Type3) +} + +pub interface Widget3 { + fnoparams1() + fnoparams2() + draw(Type1, Type2) +} + +syntax_error diff --git a/v_windows/v/old/vlib/v/parser/tests/fn_type_only_args_no_body.out b/v_windows/v/old/vlib/v/parser/tests/fn_type_only_args_no_body.out new file mode 100644 index 0000000..fad0819 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/fn_type_only_args_no_body.out @@ -0,0 +1,6 @@ +vlib/v/parser/tests/fn_type_only_args_no_body.vv:2:1: error: functions with type only args can not have bodies + 1 | fn test(int) { + 2 | } + | ^ + 3 | + 4 | fn main() { diff --git a/v_windows/v/old/vlib/v/parser/tests/fn_type_only_args_no_body.vv b/v_windows/v/old/vlib/v/parser/tests/fn_type_only_args_no_body.vv new file mode 100644 index 0000000..d661c15 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/fn_type_only_args_no_body.vv @@ -0,0 +1,6 @@ +fn test(int) { +} + +fn main() { + test(0) +} diff --git a/v_windows/v/old/vlib/v/parser/tests/fn_type_only_args_unknown_name.out b/v_windows/v/old/vlib/v/parser/tests/fn_type_only_args_unknown_name.out new file mode 100644 index 0000000..1f94768 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/fn_type_only_args_unknown_name.out @@ -0,0 +1,6 @@ +vlib/v/parser/tests/fn_type_only_args_unknown_name.vv:2:1: error: functions with type only args can not have bodies + 1 | fn test(param) { + 2 | } + | ^ + 3 | + 4 | fn main() { diff --git a/v_windows/v/old/vlib/v/parser/tests/fn_type_only_args_unknown_name.vv b/v_windows/v/old/vlib/v/parser/tests/fn_type_only_args_unknown_name.vv new file mode 100644 index 0000000..7bb6b78 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/fn_type_only_args_unknown_name.vv @@ -0,0 +1,6 @@ +fn test(param) { +} + +fn main() { + test(0) +} diff --git a/v_windows/v/old/vlib/v/parser/tests/fn_use_builtin_err.out b/v_windows/v/old/vlib/v/parser/tests/fn_use_builtin_err.out new file mode 100644 index 0000000..5e57fe2 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/fn_use_builtin_err.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/fn_use_builtin_err.vv:1:4: error: cannot redefine builtin function `print` + 1 | fn print(strings ...string) { + | ~~~~~ + 2 | for s in strings { + 3 | println(s) diff --git a/v_windows/v/old/vlib/v/parser/tests/fn_use_builtin_err.vv b/v_windows/v/old/vlib/v/parser/tests/fn_use_builtin_err.vv new file mode 100644 index 0000000..1466e4c --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/fn_use_builtin_err.vv @@ -0,0 +1,9 @@ +fn print(strings ...string) { + for s in strings { + println(s) + } +} + +fn main() { + print('text') +} diff --git a/v_windows/v/old/vlib/v/parser/tests/for.out b/v_windows/v/old/vlib/v/parser/tests/for.out new file mode 100644 index 0000000..acc089b --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/for.out @@ -0,0 +1,4 @@ +vlib/v/parser/tests/for.vv:1:5: error: cannot declare index variable with range `for` + 1 | for i, k in 0..5 { + | ^ + 2 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/for.vv b/v_windows/v/old/vlib/v/parser/tests/for.vv new file mode 100644 index 0000000..1a48f69 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/for.vv @@ -0,0 +1,2 @@ +for i, k in 0..5 { +} diff --git a/v_windows/v/old/vlib/v/parser/tests/for_in_mut_index_of_array.out b/v_windows/v/old/vlib/v/parser/tests/for_in_mut_index_of_array.out new file mode 100644 index 0000000..f8e5a51 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/for_in_mut_index_of_array.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/for_in_mut_index_of_array.vv:3:6: error: index of array or key of map cannot be mutated + 1 | fn main() { + 2 | mut m := [1, 2, 3] + 3 | for mut i, _ in m { + | ~~~ + 4 | println(i) + 5 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/for_in_mut_index_of_array.vv b/v_windows/v/old/vlib/v/parser/tests/for_in_mut_index_of_array.vv new file mode 100644 index 0000000..eb04d96 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/for_in_mut_index_of_array.vv @@ -0,0 +1,6 @@ +fn main() { + mut m := [1, 2, 3] + for mut i, _ in m { + println(i) + } +} diff --git a/v_windows/v/old/vlib/v/parser/tests/for_in_mut_key_of_map.out b/v_windows/v/old/vlib/v/parser/tests/for_in_mut_key_of_map.out new file mode 100644 index 0000000..6737a53 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/for_in_mut_key_of_map.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/for_in_mut_key_of_map.vv:3:6: error: index of array or key of map cannot be mutated + 1 | fn main() { + 2 | mut m := map{'foo': 1, 'bar': 2} + 3 | for mut k, _ in m { + | ~~~ + 4 | println(k) + 5 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/for_in_mut_key_of_map.vv b/v_windows/v/old/vlib/v/parser/tests/for_in_mut_key_of_map.vv new file mode 100644 index 0000000..c8a2296 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/for_in_mut_key_of_map.vv @@ -0,0 +1,6 @@ +fn main() { + mut m := map{'foo': 1, 'bar': 2} + for mut k, _ in m { + println(k) + } +} diff --git a/v_windows/v/old/vlib/v/parser/tests/function_variadic_arg_non_final.out b/v_windows/v/old/vlib/v/parser/tests/function_variadic_arg_non_final.out new file mode 100644 index 0000000..7c69a4b --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/function_variadic_arg_non_final.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/function_variadic_arg_non_final.vv:1:6: error: cannot use ...(variadic) with non-final parameter para1 + 1 | fn f(para1 ...int, para2 f32) int { + | ~~~~~ + 2 | return 22 + 3 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/function_variadic_arg_non_final.vv b/v_windows/v/old/vlib/v/parser/tests/function_variadic_arg_non_final.vv new file mode 100644 index 0000000..f7ce72a --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/function_variadic_arg_non_final.vv @@ -0,0 +1,7 @@ +fn f(para1 ...int, para2 f32) int { + return 22 +} + +fn main() { + a := f(11, 1.1) +} diff --git a/v_windows/v/old/vlib/v/parser/tests/generic_lowercase_err.out b/v_windows/v/old/vlib/v/parser/tests/generic_lowercase_err.out new file mode 100644 index 0000000..3a02413 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/generic_lowercase_err.out @@ -0,0 +1,3 @@ +vlib/v/parser/tests/generic_lowercase_err.vv:1:22: error: generic parameter needs to be uppercase + 1 | fn lowercase_generic<a>() {} + | ^ diff --git a/v_windows/v/old/vlib/v/parser/tests/generic_lowercase_err.vv b/v_windows/v/old/vlib/v/parser/tests/generic_lowercase_err.vv new file mode 100644 index 0000000..4d9bcad --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/generic_lowercase_err.vv @@ -0,0 +1 @@ +fn lowercase_generic<a>() {} diff --git a/v_windows/v/old/vlib/v/parser/tests/generic_type_alias_decl.out b/v_windows/v/old/vlib/v/parser/tests/generic_type_alias_decl.out new file mode 100644 index 0000000..95c9e02 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/generic_type_alias_decl.out @@ -0,0 +1,3 @@ +vlib/v/parser/tests/generic_type_alias_decl.vv:1:1: error: generic type aliases are not yet implemented + 1 | type Pointer<T> = &T + | ~~~~~~~~~~~~~~~ diff --git a/v_windows/v/old/vlib/v/parser/tests/generic_type_alias_decl.vv b/v_windows/v/old/vlib/v/parser/tests/generic_type_alias_decl.vv new file mode 100644 index 0000000..b2a177a --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/generic_type_alias_decl.vv @@ -0,0 +1 @@ +type Pointer<T> = &T diff --git a/v_windows/v/old/vlib/v/parser/tests/if_guard_redefinition.out b/v_windows/v/old/vlib/v/parser/tests/if_guard_redefinition.out new file mode 100644 index 0000000..7f2a5b2 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/if_guard_redefinition.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/if_guard_redefinition.vv:7:8: error: redefinition of `x` + 5 | fn main() { + 6 | x := 1 + 7 | if x := opt_fn() { + | ^ + 8 | println(x) + 9 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/if_guard_redefinition.vv b/v_windows/v/old/vlib/v/parser/tests/if_guard_redefinition.vv new file mode 100644 index 0000000..b54ee90 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/if_guard_redefinition.vv @@ -0,0 +1,10 @@ +fn opt_fn() ?int { + return 2 +} + +fn main() { + x := 1 + if x := opt_fn() { + println(x) + } +} diff --git a/v_windows/v/old/vlib/v/parser/tests/inc_use_as_value.out b/v_windows/v/old/vlib/v/parser/tests/inc_use_as_value.out new file mode 100644 index 0000000..11888f8 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/inc_use_as_value.out @@ -0,0 +1,6 @@ +vlib/v/parser/tests/inc_use_as_value.vv:2:14: error: cannot use i++ as value + 1 | fn main() { + 2 | for i := 0; i++; i < 100 { + | ^ + 3 | } + 4 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/inc_use_as_value.vv b/v_windows/v/old/vlib/v/parser/tests/inc_use_as_value.vv new file mode 100644 index 0000000..885f6b7 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/inc_use_as_value.vv @@ -0,0 +1,4 @@ +fn main() { + for i := 0; i++; i < 100 { + } +} diff --git a/v_windows/v/old/vlib/v/parser/tests/interface_duplicate_interface_method.out b/v_windows/v/old/vlib/v/parser/tests/interface_duplicate_interface_method.out new file mode 100644 index 0000000..eaee38e --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/interface_duplicate_interface_method.out @@ -0,0 +1,6 @@ +vlib/v/parser/tests/interface_duplicate_interface_method.vv:4:2: error: duplicate method `fun` + 2 | interface Abc { + 3 | fun() + 4 | fun() + | ~~~ + 5 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/interface_duplicate_interface_method.vv b/v_windows/v/old/vlib/v/parser/tests/interface_duplicate_interface_method.vv new file mode 100644 index 0000000..4d29383 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/interface_duplicate_interface_method.vv @@ -0,0 +1,5 @@ +// duplicate interface methods in decleration +interface Abc { + fun() + fun() +} diff --git a/v_windows/v/old/vlib/v/parser/tests/interface_duplicate_method.out b/v_windows/v/old/vlib/v/parser/tests/interface_duplicate_method.out new file mode 100644 index 0000000..f83ad2a --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/interface_duplicate_method.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/interface_duplicate_method.vv:5:12: error: duplicate method `foo` + 3 | // duplicate normal method definitions on interface + 4 | fn (a Abc) foo() {} + 5 | fn (a Abc) foo() {} + | ~~~ diff --git a/v_windows/v/old/vlib/v/parser/tests/interface_duplicate_method.vv b/v_windows/v/old/vlib/v/parser/tests/interface_duplicate_method.vv new file mode 100644 index 0000000..ab22330 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/interface_duplicate_method.vv @@ -0,0 +1,5 @@ +interface Abc {} + +// duplicate normal method definitions on interface +fn (a Abc) foo() {} +fn (a Abc) foo() {}
\ No newline at end of file diff --git a/v_windows/v/old/vlib/v/parser/tests/invalid_attribute_a.out b/v_windows/v/old/vlib/v/parser/tests/invalid_attribute_a.out new file mode 100644 index 0000000..7ae507c --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/invalid_attribute_a.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/invalid_attribute_a.vv:1:9: error: unexpected token `]`, an argument is expected after `:` + 1 | [foobar:] + | ^ + 2 | fn my_fn_with_invalid_attr() { + 3 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/invalid_attribute_a.vv b/v_windows/v/old/vlib/v/parser/tests/invalid_attribute_a.vv new file mode 100644 index 0000000..971dc28 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/invalid_attribute_a.vv @@ -0,0 +1,3 @@ +[foobar:] +fn my_fn_with_invalid_attr() { +} diff --git a/v_windows/v/old/vlib/v/parser/tests/invalid_attribute_b.out b/v_windows/v/old/vlib/v/parser/tests/invalid_attribute_b.out new file mode 100644 index 0000000..763de97 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/invalid_attribute_b.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/invalid_attribute_b.vv:1:6: error: unexpected token `:`, an argument is expected after `:` + 1 | [foo::] + | ^ + 2 | fn my_fn_with_invalid_attr() { + 3 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/invalid_attribute_b.vv b/v_windows/v/old/vlib/v/parser/tests/invalid_attribute_b.vv new file mode 100644 index 0000000..d6af445 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/invalid_attribute_b.vv @@ -0,0 +1,3 @@ +[foo::] +fn my_fn_with_invalid_attr() { +} diff --git a/v_windows/v/old/vlib/v/parser/tests/invalid_attribute_c.out b/v_windows/v/old/vlib/v/parser/tests/invalid_attribute_c.out new file mode 100644 index 0000000..a30cb42 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/invalid_attribute_c.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/invalid_attribute_c.vv:1:6: error: unexpected token `[`, an argument is expected after `:` + 1 | [bar:[] + | ^ + 2 | fn my_fn_with_invalid_attr() { + 3 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/invalid_attribute_c.vv b/v_windows/v/old/vlib/v/parser/tests/invalid_attribute_c.vv new file mode 100644 index 0000000..527076d --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/invalid_attribute_c.vv @@ -0,0 +1,3 @@ +[bar:[] +fn my_fn_with_invalid_attr() { +} diff --git a/v_windows/v/old/vlib/v/parser/tests/invalid_attribute_d.out b/v_windows/v/old/vlib/v/parser/tests/invalid_attribute_d.out new file mode 100644 index 0000000..3d05dc2 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/invalid_attribute_d.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/invalid_attribute_d.vv:1:9: error: unexpected token `}`, an argument is expected after `:` + 1 | [foobar:} + | ^ + 2 | fn my_fn_with_invalid_attr() { + 3 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/invalid_attribute_d.vv b/v_windows/v/old/vlib/v/parser/tests/invalid_attribute_d.vv new file mode 100644 index 0000000..0b7d2e2 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/invalid_attribute_d.vv @@ -0,0 +1,3 @@ +[foobar:} +fn my_fn_with_invalid_attr() { +} diff --git a/v_windows/v/old/vlib/v/parser/tests/invalid_fn_decl_script_err.out b/v_windows/v/old/vlib/v/parser/tests/invalid_fn_decl_script_err.out new file mode 100644 index 0000000..aead2d0 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/invalid_fn_decl_script_err.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/invalid_fn_decl_script_err.vv:3:4: error: function declarations in script mode should be before all script statements + 1 | mynum := 10 + 2 | + 3 | fn main() { + | ~~~~ + 4 | println(mynum) + 5 | }
\ No newline at end of file diff --git a/v_windows/v/old/vlib/v/parser/tests/invalid_fn_decl_script_err.vv b/v_windows/v/old/vlib/v/parser/tests/invalid_fn_decl_script_err.vv new file mode 100644 index 0000000..196895a --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/invalid_fn_decl_script_err.vv @@ -0,0 +1,5 @@ +mynum := 10 + +fn main() { + println(mynum) +} diff --git a/v_windows/v/old/vlib/v/parser/tests/invalid_recursive_struct1_err.out b/v_windows/v/old/vlib/v/parser/tests/invalid_recursive_struct1_err.out new file mode 100644 index 0000000..8cac758 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/invalid_recursive_struct1_err.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/invalid_recursive_struct1_err.vv:1:8: error: invalid recursive struct `Human` + 1 | struct Human { + | ~~~~~ + 2 | child Human + 3 | }
\ No newline at end of file diff --git a/v_windows/v/old/vlib/v/parser/tests/invalid_recursive_struct1_err.vv b/v_windows/v/old/vlib/v/parser/tests/invalid_recursive_struct1_err.vv new file mode 100644 index 0000000..649ca81 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/invalid_recursive_struct1_err.vv @@ -0,0 +1,3 @@ +struct Human { + child Human +} diff --git a/v_windows/v/old/vlib/v/parser/tests/invalid_recursive_struct2_err.out b/v_windows/v/old/vlib/v/parser/tests/invalid_recursive_struct2_err.out new file mode 100644 index 0000000..d784e50 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/invalid_recursive_struct2_err.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/invalid_recursive_struct2_err.vv:5:8: error: invalid recursive struct `Human` + 3 | } + 4 | + 5 | struct Human { + | ~~~~~ + 6 | child Child + 7 | }
\ No newline at end of file diff --git a/v_windows/v/old/vlib/v/parser/tests/invalid_recursive_struct2_err.vv b/v_windows/v/old/vlib/v/parser/tests/invalid_recursive_struct2_err.vv new file mode 100644 index 0000000..0088c8e --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/invalid_recursive_struct2_err.vv @@ -0,0 +1,7 @@ +struct Child { + be Human +} + +struct Human { + child Child +} diff --git a/v_windows/v/old/vlib/v/parser/tests/long_generic_err.out b/v_windows/v/old/vlib/v/parser/tests/long_generic_err.out new file mode 100644 index 0000000..d27f9f0 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/long_generic_err.out @@ -0,0 +1,3 @@ +vlib/v/parser/tests/long_generic_err.vv:1:17: error: generic parameter name needs to be exactly one char + 1 | fn long_generic<Abc>() {} + | ~~~ diff --git a/v_windows/v/old/vlib/v/parser/tests/long_generic_err.vv b/v_windows/v/old/vlib/v/parser/tests/long_generic_err.vv new file mode 100644 index 0000000..ae3e538 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/long_generic_err.vv @@ -0,0 +1 @@ +fn long_generic<Abc>() {} diff --git a/v_windows/v/old/vlib/v/parser/tests/map_init.out b/v_windows/v/old/vlib/v/parser/tests/map_init.out new file mode 100644 index 0000000..7185266 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/map_init.out @@ -0,0 +1,6 @@ +vlib/v/parser/tests/map_init.vv:3:22: error: `}` expected; explicit `map` initialization does not support parameters + 1 | fn main() { + 2 | a := map[string]int{} + 3 | b := map[string]f64{cap: 10} + | ~~~ + 4 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/map_init.vv b/v_windows/v/old/vlib/v/parser/tests/map_init.vv new file mode 100644 index 0000000..2ab972d --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/map_init.vv @@ -0,0 +1,4 @@ +fn main() { + a := map[string]int{} + b := map[string]f64{cap: 10} +} diff --git a/v_windows/v/old/vlib/v/parser/tests/map_init_void.out b/v_windows/v/old/vlib/v/parser/tests/map_init_void.out new file mode 100644 index 0000000..fd76d7e --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/map_init_void.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/map_init_void.vv:2:18: error: map value type cannot be void + 1 | fn main() { + 2 | m := map[string]{} + | ^ + 3 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/map_init_void.vv b/v_windows/v/old/vlib/v/parser/tests/map_init_void.vv new file mode 100644 index 0000000..5ad2727 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/map_init_void.vv @@ -0,0 +1,3 @@ +fn main() { + m := map[string]{} +} diff --git a/v_windows/v/old/vlib/v/parser/tests/map_init_void2.out b/v_windows/v/old/vlib/v/parser/tests/map_init_void2.out new file mode 100644 index 0000000..81031dc --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/map_init_void2.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/map_init_void2.vv:1:19: error: expecting type declaration + 1 | fn f(m map[string]) { + | ^ + 2 | println('illegal function') + 3 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/map_init_void2.vv b/v_windows/v/old/vlib/v/parser/tests/map_init_void2.vv new file mode 100644 index 0000000..0b9a8e4 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/map_init_void2.vv @@ -0,0 +1,7 @@ +fn f(m map[string]) { + println('illegal function') +} + +fn main() { + println('Hello world') +} diff --git a/v_windows/v/old/vlib/v/parser/tests/match_range_dotdot_err.out b/v_windows/v/old/vlib/v/parser/tests/match_range_dotdot_err.out new file mode 100644 index 0000000..bc815ed --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/match_range_dotdot_err.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/match_range_dotdot_err.vv:3:4: error: match only supports inclusive (`...`) ranges, not exclusive (`..`) + 1 | fn test_match() { + 2 | match 5 { + 3 | 0..10 { '0-9' } + | ~~ + 4 | else { 'other' } + 5 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/match_range_dotdot_err.vv b/v_windows/v/old/vlib/v/parser/tests/match_range_dotdot_err.vv new file mode 100644 index 0000000..0c7f112 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/match_range_dotdot_err.vv @@ -0,0 +1,6 @@ +fn test_match() { + match 5 { + 0..10 { '0-9' } + else { 'other' } + } +} diff --git a/v_windows/v/old/vlib/v/parser/tests/method_decl_on_non_local_array.out b/v_windows/v/old/vlib/v/parser/tests/method_decl_on_non_local_array.out new file mode 100644 index 0000000..f01fc00 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/method_decl_on_non_local_array.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/method_decl_on_non_local_array.vv:1:7: error: cannot define new methods on non-local type []int + 1 | fn (a []int) get_number() int { + | ~~~~~ + 2 | return 1 + 3 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/method_decl_on_non_local_array.vv b/v_windows/v/old/vlib/v/parser/tests/method_decl_on_non_local_array.vv new file mode 100644 index 0000000..9822ce5 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/method_decl_on_non_local_array.vv @@ -0,0 +1,3 @@ +fn (a []int) get_number() int { + return 1 +} diff --git a/v_windows/v/old/vlib/v/parser/tests/method_decl_on_non_local_map.out b/v_windows/v/old/vlib/v/parser/tests/method_decl_on_non_local_map.out new file mode 100644 index 0000000..d8459da --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/method_decl_on_non_local_map.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/method_decl_on_non_local_map.vv:1:7: error: cannot define new methods on non-local type map[string]string + 1 | fn (a map[string]string) get_number() int { + | ~~~~~~~~~~~~~~~~~ + 2 | return 1 + 3 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/method_decl_on_non_local_map.vv b/v_windows/v/old/vlib/v/parser/tests/method_decl_on_non_local_map.vv new file mode 100644 index 0000000..f95e719 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/method_decl_on_non_local_map.vv @@ -0,0 +1,3 @@ +fn (a map[string]string) get_number() int { + return 1 +} diff --git a/v_windows/v/old/vlib/v/parser/tests/method_decl_on_non_local_type.out b/v_windows/v/old/vlib/v/parser/tests/method_decl_on_non_local_type.out new file mode 100644 index 0000000..1b57bbd --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/method_decl_on_non_local_type.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/method_decl_on_non_local_type.vv:1:7: error: cannot define new methods on non-local type int + 1 | fn (a int) get_number() int { + | ~~~ + 2 | return 1 + 3 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/method_decl_on_non_local_type.vv b/v_windows/v/old/vlib/v/parser/tests/method_decl_on_non_local_type.vv new file mode 100644 index 0000000..f75565b --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/method_decl_on_non_local_type.vv @@ -0,0 +1,3 @@ +fn (a int) get_number() int { + return 1 +} diff --git a/v_windows/v/old/vlib/v/parser/tests/module_multiple_names_err.out b/v_windows/v/old/vlib/v/parser/tests/module_multiple_names_err.out new file mode 100644 index 0000000..6ae53a8 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/module_multiple_names_err.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/module_multiple_names_err.vv:1:13: error: `module main`, you can only declare one module, unexpected `os` + 1 | module main os + | ~~ + 2 | fn main() { + 3 | println('hello, world') diff --git a/v_windows/v/old/vlib/v/parser/tests/module_multiple_names_err.vv b/v_windows/v/old/vlib/v/parser/tests/module_multiple_names_err.vv new file mode 100644 index 0000000..96158af --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/module_multiple_names_err.vv @@ -0,0 +1,4 @@ +module main os +fn main() { + println('hello, world') +} diff --git a/v_windows/v/old/vlib/v/parser/tests/module_syntax_err.out b/v_windows/v/old/vlib/v/parser/tests/module_syntax_err.out new file mode 100644 index 0000000..38a1905 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/module_syntax_err.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/module_syntax_err.vv:1:12: error: `module main`, unexpected `.` after module name + 1 | module main.os + | ^ + 2 | fn main() { + 3 | println('hello, world') diff --git a/v_windows/v/old/vlib/v/parser/tests/module_syntax_err.vv b/v_windows/v/old/vlib/v/parser/tests/module_syntax_err.vv new file mode 100644 index 0000000..8f8c91f --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/module_syntax_err.vv @@ -0,0 +1,4 @@ +module main.os +fn main() { + println('hello, world') +} diff --git a/v_windows/v/old/vlib/v/parser/tests/multi_argumented_assign_err.out b/v_windows/v/old/vlib/v/parser/tests/multi_argumented_assign_err.out new file mode 100644 index 0000000..4e1a64c --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/multi_argumented_assign_err.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/multi_argumented_assign_err.vv:3:10: error: unexpected +=, expecting := or = or comma + 1 | fn main() { + 2 | mut a, mut b, mut c := 0,1, 2 + 3 | a, b, c += 1, 2, 4 + | ~~ + 4 | println('$a $b $c') + 5 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/multi_argumented_assign_err.vv b/v_windows/v/old/vlib/v/parser/tests/multi_argumented_assign_err.vv new file mode 100644 index 0000000..26257b8 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/multi_argumented_assign_err.vv @@ -0,0 +1,5 @@ +fn main() { + mut a, mut b, mut c := 0,1, 2 + a, b, c += 1, 2, 4 + println('$a $b $c') +} diff --git a/v_windows/v/old/vlib/v/parser/tests/nested_defer.out b/v_windows/v/old/vlib/v/parser/tests/nested_defer.out new file mode 100644 index 0000000..c5da8dc --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/nested_defer.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/nested_defer.vv:5:3: error: `defer` blocks cannot be nested + 3 | defer { + 4 | a = 12 + 5 | defer { + | ~~~~~ + 6 | a = 13 + 7 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/nested_defer.vv b/v_windows/v/old/vlib/v/parser/tests/nested_defer.vv new file mode 100644 index 0000000..7abc2d3 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/nested_defer.vv @@ -0,0 +1,14 @@ +fn test1() int { + mut a := 0 + defer { + a = 12 + defer { + a = 13 + } + } + return a + +fn main() { + x := test1() + println(x) +} diff --git a/v_windows/v/old/vlib/v/parser/tests/nested_unsafe_expr.out b/v_windows/v/old/vlib/v/parser/tests/nested_unsafe_expr.out new file mode 100644 index 0000000..1d815ed --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/nested_unsafe_expr.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/nested_unsafe_expr.vv:4:8: error: already inside `unsafe` block + 2 | a := 0 + 3 | unsafe { + 4 | a += unsafe{2} + | ~~~~~~ + 5 | } + 6 | println(a) diff --git a/v_windows/v/old/vlib/v/parser/tests/nested_unsafe_expr.vv b/v_windows/v/old/vlib/v/parser/tests/nested_unsafe_expr.vv new file mode 100644 index 0000000..1ab098c --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/nested_unsafe_expr.vv @@ -0,0 +1,7 @@ +fn main() { + a := 0 + unsafe { + a += unsafe{2} + } + println(a) +} diff --git a/v_windows/v/old/vlib/v/parser/tests/nested_unsafe_stmt.out b/v_windows/v/old/vlib/v/parser/tests/nested_unsafe_stmt.out new file mode 100644 index 0000000..b76a6e5 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/nested_unsafe_stmt.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/nested_unsafe_stmt.vv:4:3: error: already inside `unsafe` block + 2 | a := 0 + 3 | unsafe { + 4 | unsafe { + | ~~~~~~ + 5 | a++ + 6 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/nested_unsafe_stmt.vv b/v_windows/v/old/vlib/v/parser/tests/nested_unsafe_stmt.vv new file mode 100644 index 0000000..283e76d --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/nested_unsafe_stmt.vv @@ -0,0 +1,9 @@ +fn main() { + a := 0 + unsafe { + unsafe { + a++ + } + } + println(a) +} diff --git a/v_windows/v/old/vlib/v/parser/tests/operator_normal_fn.out b/v_windows/v/old/vlib/v/parser/tests/operator_normal_fn.out new file mode 100644 index 0000000..9313c0a --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/operator_normal_fn.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/operator_normal_fn.vv:1:4: error: cannot use operator overloading with normal functions + 1 | fn +(x int) int { + | ^ + 2 | return 5 + x + 3 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/operator_normal_fn.vv b/v_windows/v/old/vlib/v/parser/tests/operator_normal_fn.vv new file mode 100644 index 0000000..5a82b31 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/operator_normal_fn.vv @@ -0,0 +1,3 @@ +fn +(x int) int { + return 5 + x +} diff --git a/v_windows/v/old/vlib/v/parser/tests/or_default_missing.out b/v_windows/v/old/vlib/v/parser/tests/or_default_missing.out new file mode 100644 index 0000000..82cfa59 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/or_default_missing.out @@ -0,0 +1,14 @@ +vlib/v/parser/tests/or_default_missing.vv:4:3: error: `or` block must provide a default value of type `int`, or return/continue/break or call a [noreturn] function like panic(err) or exit(1) + 2 | m := [3, 4, 5] + 3 | el := m[4] or { + 4 | println('error') + | ~~~~~~~~~~~~~~~~ + 5 | } + 6 | println(el) +vlib/v/parser/tests/or_default_missing.vv:16:16: error: last statement in the `or {}` block should be an expression of type `int` or exit parent scope + 14 | } + 15 | mut testvar := 0 + 16 | el := m['pp'] or { + | ~~~~ + 17 | testvar = 12 + 18 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/or_default_missing.vv b/v_windows/v/old/vlib/v/parser/tests/or_default_missing.vv new file mode 100644 index 0000000..ad9fa62 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/or_default_missing.vv @@ -0,0 +1,20 @@ +fn test_array_or() { + m := [3, 4, 5] + el := m[4] or { + println('error') + } + println(el) +} + +fn test_map_or() { + m := map{ + 'as': 3 + 'qw': 4 + 'kl': 5 + } + mut testvar := 0 + el := m['pp'] or { + testvar = 12 + } + println('$el $testvar') +} diff --git a/v_windows/v/old/vlib/v/parser/tests/postfix_err.out b/v_windows/v/old/vlib/v/parser/tests/postfix_err.out new file mode 100644 index 0000000..d83ccfa --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/postfix_err.out @@ -0,0 +1,21 @@ +vlib/v/parser/tests/postfix_err.vv:5:10: warning: `++` operator can only be used as a statement + 3 | fn test_postfix() { + 4 | mut x := 1 + 5 | _ = (x++) + | ^ + 6 | x--, x-- // OK + 7 | f(x++) +vlib/v/parser/tests/postfix_err.vv:7:7: warning: `++` operator can only be used as a statement + 5 | _ = (x++) + 6 | x--, x-- // OK + 7 | f(x++) + | ^ + 8 | a := [x] + 9 | _ = a[x--] +vlib/v/parser/tests/postfix_err.vv:9:11: warning: `--` operator can only be used as a statement + 7 | f(x++) + 8 | a := [x] + 9 | _ = a[x--] + | ^ + 10 | } + 11 | diff --git a/v_windows/v/old/vlib/v/parser/tests/postfix_err.vv b/v_windows/v/old/vlib/v/parser/tests/postfix_err.vv new file mode 100644 index 0000000..a1ba568 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/postfix_err.vv @@ -0,0 +1,11 @@ +fn f(i int) {} + +fn test_postfix() { + mut x := 1 + _ = (x++) + x--, x-- // OK + f(x++) + a := [x] + _ = a[x--] +} + diff --git a/v_windows/v/old/vlib/v/parser/tests/postfix_inc.out b/v_windows/v/old/vlib/v/parser/tests/postfix_inc.out new file mode 100644 index 0000000..189a413 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/postfix_inc.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/postfix_inc.vv:3:1: error: token `++` must be on the same line as the previous token + 1 | mut v := 4 + 2 | _ = v + 3 | ++v + | ~~ diff --git a/v_windows/v/old/vlib/v/parser/tests/postfix_inc.vv b/v_windows/v/old/vlib/v/parser/tests/postfix_inc.vv new file mode 100644 index 0000000..3f2fd06 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/postfix_inc.vv @@ -0,0 +1,3 @@ +mut v := 4 +_ = v +++v diff --git a/v_windows/v/old/vlib/v/parser/tests/prefix_first.out b/v_windows/v/old/vlib/v/parser/tests/prefix_first.out new file mode 100644 index 0000000..3a4adc6 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/prefix_first.out @@ -0,0 +1,28 @@ +vlib/v/parser/tests/prefix_first.vv:15:3: warning: move infix `-` operator before new line (if infix intended) or use brackets for a prefix expression + 13 | _ = if true { + 14 | v = 1 + 15 | -1 + | ^ + 16 | } else {1} + 17 | _ = p +vlib/v/parser/tests/prefix_first.vv:27:3: warning: move infix `&` operator before new line (if infix intended) or use brackets for a prefix expression + 25 | _ = opt() or { + 26 | _ = 1 + 27 | &v + | ^ + 28 | } + 29 | } +vlib/v/parser/tests/prefix_first.vv:13:6: error: `if` expression requires an expression as the last statement of every branch + 11 | + 12 | // later this should compile correctly + 13 | _ = if true { + | ~~~~~~~ + 14 | v = 1 + 15 | -1 +vlib/v/parser/tests/prefix_first.vv:25:12: error: last statement in the `or {}` block should be an expression of type `&int` or exit parent scope + 23 | // later this should compile correctly + 24 | v := 3 + 25 | _ = opt() or { + | ~~~~ + 26 | _ = 1 + 27 | &v diff --git a/v_windows/v/old/vlib/v/parser/tests/prefix_first.vv b/v_windows/v/old/vlib/v/parser/tests/prefix_first.vv new file mode 100644 index 0000000..83e180c --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/prefix_first.vv @@ -0,0 +1,29 @@ +// a prefix op can be parsed as an infix op if there's an expression on the line before +// https://github.com/vlang/v/pull/6491 +fn test_prefix() { + mut v := 1 + mut p := &v + // OK, special workaround + unsafe { + v = 1 + *p = 2 + } + + // later this should compile correctly + _ = if true { + v = 1 + -1 + } else {1} + _ = p +} + +fn opt() ?&int {return none} + +fn test_prefix_or() { + // later this should compile correctly + v := 3 + _ = opt() or { + _ = 1 + &v + } +} diff --git a/v_windows/v/old/vlib/v/parser/tests/prohibit_redeclaration_of_builtin_types.out b/v_windows/v/old/vlib/v/parser/tests/prohibit_redeclaration_of_builtin_types.out new file mode 100644 index 0000000..e292e0a --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/prohibit_redeclaration_of_builtin_types.out @@ -0,0 +1,3 @@ +vlib/v/parser/tests/prohibit_redeclaration_of_builtin_types.vv:1:8: error: cannot register struct `Option`, another type with this name exists + 1 | struct Option {} + | ~~~~~~ diff --git a/v_windows/v/old/vlib/v/parser/tests/prohibit_redeclaration_of_builtin_types.vv b/v_windows/v/old/vlib/v/parser/tests/prohibit_redeclaration_of_builtin_types.vv new file mode 100644 index 0000000..26669cc --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/prohibit_redeclaration_of_builtin_types.vv @@ -0,0 +1 @@ +struct Option {} diff --git a/v_windows/v/old/vlib/v/parser/tests/redeclaration_of_imported_fn.out b/v_windows/v/old/vlib/v/parser/tests/redeclaration_of_imported_fn.out new file mode 100644 index 0000000..1c02758 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/redeclaration_of_imported_fn.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/redeclaration_of_imported_fn.vv:3:4: error: cannot redefine imported function `input` + 1 | import os { input } + 2 | + 3 | fn input() {} + | ~~~~~ + 4 | + 5 | input() diff --git a/v_windows/v/old/vlib/v/parser/tests/redeclaration_of_imported_fn.vv b/v_windows/v/old/vlib/v/parser/tests/redeclaration_of_imported_fn.vv new file mode 100644 index 0000000..45a3b5a --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/redeclaration_of_imported_fn.vv @@ -0,0 +1,5 @@ +import os { input } + +fn input() {} + +input() diff --git a/v_windows/v/old/vlib/v/parser/tests/register_imported_alias.out b/v_windows/v/old/vlib/v/parser/tests/register_imported_alias.out new file mode 100644 index 0000000..3cc0365 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/register_imported_alias.out @@ -0,0 +1,4 @@ +vlib/v/parser/tests/register_imported_alias.vv:2:6: error: cannot register alias `Duration`, this type was already imported + 1 | import time { Duration } + 2 | type Duration = bool + | ~~~~~~~~ diff --git a/v_windows/v/old/vlib/v/parser/tests/register_imported_alias.vv b/v_windows/v/old/vlib/v/parser/tests/register_imported_alias.vv new file mode 100644 index 0000000..0200e5d --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/register_imported_alias.vv @@ -0,0 +1,2 @@ +import time { Duration } +type Duration = bool diff --git a/v_windows/v/old/vlib/v/parser/tests/register_imported_enum.out b/v_windows/v/old/vlib/v/parser/tests/register_imported_enum.out new file mode 100644 index 0000000..89f888b --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/register_imported_enum.out @@ -0,0 +1,4 @@ +vlib/v/parser/tests/register_imported_enum.vv:2:6: error: cannot register enum `Method`, this type was already imported + 1 | import net.http { Method } + 2 | enum Method { foo bar } + | ~~~~~~ diff --git a/v_windows/v/old/vlib/v/parser/tests/register_imported_enum.vv b/v_windows/v/old/vlib/v/parser/tests/register_imported_enum.vv new file mode 100644 index 0000000..bb1bb6e --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/register_imported_enum.vv @@ -0,0 +1,2 @@ +import net.http { Method } +enum Method { foo bar } diff --git a/v_windows/v/old/vlib/v/parser/tests/register_imported_interface.out b/v_windows/v/old/vlib/v/parser/tests/register_imported_interface.out new file mode 100644 index 0000000..58b2029 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/register_imported_interface.out @@ -0,0 +1,4 @@ +vlib/v/parser/tests/register_imported_interface.vv:2:11: error: cannot register interface `Reader`, this type was already imported + 1 | import io { Reader } + 2 | interface Reader {} + | ~~~~~~ diff --git a/v_windows/v/old/vlib/v/parser/tests/register_imported_interface.vv b/v_windows/v/old/vlib/v/parser/tests/register_imported_interface.vv new file mode 100644 index 0000000..c659327 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/register_imported_interface.vv @@ -0,0 +1,2 @@ +import io { Reader } +interface Reader {} diff --git a/v_windows/v/old/vlib/v/parser/tests/register_imported_struct.out b/v_windows/v/old/vlib/v/parser/tests/register_imported_struct.out new file mode 100644 index 0000000..259b831 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/register_imported_struct.out @@ -0,0 +1,4 @@ +vlib/v/parser/tests/register_imported_struct.vv:2:8: error: cannot register struct `File`, this type was already imported + 1 | import os { File } + 2 | struct File {} + | ~~~~ diff --git a/v_windows/v/old/vlib/v/parser/tests/register_imported_struct.vv b/v_windows/v/old/vlib/v/parser/tests/register_imported_struct.vv new file mode 100644 index 0000000..a9c54db --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/register_imported_struct.vv @@ -0,0 +1,2 @@ +import os { File } +struct File {} diff --git a/v_windows/v/old/vlib/v/parser/tests/select_bad_key_1.out b/v_windows/v/old/vlib/v/parser/tests/select_bad_key_1.out new file mode 100644 index 0000000..a9f946c --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/select_bad_key_1.out @@ -0,0 +1,14 @@ +vlib/v/parser/tests/select_bad_key_1.vv:19:3: notice: `>` is deprecated and will soon be forbidden - just state the timeout in nanoseconds + 17 | a++ + 18 | } + 19 | > 50 * time.millisecond { + | ^ + 20 | println('timeout') + 21 | } +vlib/v/parser/tests/select_bad_key_1.vv:39:8: error: select key: receive expression expected + 37 | fn f3_bad(ch1 chan St) { + 38 | select { + 39 | b := 17 { + | ~~ + 40 | println(b) + 41 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/select_bad_key_1.vv b/v_windows/v/old/vlib/v/parser/tests/select_bad_key_1.vv new file mode 100644 index 0000000..3e9da5d --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/select_bad_key_1.vv @@ -0,0 +1,47 @@ +import time + +struct St { + a int +} + +fn f1_good(ch1 chan St, ch2 chan int, ch3 chan int) { + mut a := 5 + select { + a = <- ch3 { + println(a) + } + b := <- ch1 { + println(b.a) + } + ch1 <- a { + a++ + } + > 50 * time.millisecond { + println('timeout') + } + } + println('done') +} + +fn f2_good(ch1 chan St) { + select { + b := <- ch1 { + println(b) + } + else { + println('no channel ready') + } + } +} + +fn f3_bad(ch1 chan St) { + select { + b := 17 { + println(b) + } + } +} + +fn main() {} + + diff --git a/v_windows/v/old/vlib/v/parser/tests/select_bad_key_2.out b/v_windows/v/old/vlib/v/parser/tests/select_bad_key_2.out new file mode 100644 index 0000000..a7a6109 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/select_bad_key_2.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/select_bad_key_2.vv:7:3: error: invalid type `f64` for timeout - expected integer number of nanoseconds aka `time.Duration` + 5 | println(b) + 6 | } + 7 | a + 7 { + | ~~~~~ + 8 | println("shouldn't get here") + 9 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/select_bad_key_2.vv b/v_windows/v/old/vlib/v/parser/tests/select_bad_key_2.vv new file mode 100644 index 0000000..a3fcda8 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/select_bad_key_2.vv @@ -0,0 +1,13 @@ +fn f3_bad(ch1 chan int) { + a := 3.75 + select { + b := <-ch1 { + println(b) + } + a + 7 { + println("shouldn't get here") + } + } +} + +fn main() {} diff --git a/v_windows/v/old/vlib/v/parser/tests/select_bad_key_3.out b/v_windows/v/old/vlib/v/parser/tests/select_bad_key_3.out new file mode 100644 index 0000000..029add6 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/select_bad_key_3.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/select_bad_key_3.vv:6:3: error: invalid type `void` for timeout - expected integer number of nanoseconds aka `time.Duration` + 4 | println(b) + 5 | } + 6 | println(7) { + | ~~~~~~~~~~ + 7 | println("shouldn't get here") + 8 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/select_bad_key_3.vv b/v_windows/v/old/vlib/v/parser/tests/select_bad_key_3.vv new file mode 100644 index 0000000..c7bf3a6 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/select_bad_key_3.vv @@ -0,0 +1,12 @@ +fn f3_bad(ch1 chan int) { + select { + b := <-ch1 { + println(b) + } + println(7) { + println("shouldn't get here") + } + } +} + +fn main() {} diff --git a/v_windows/v/old/vlib/v/parser/tests/select_bad_key_4.out b/v_windows/v/old/vlib/v/parser/tests/select_bad_key_4.out new file mode 100644 index 0000000..3fac7dd --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/select_bad_key_4.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/select_bad_key_4.vv:7:8: error: select key: `<-` operator expected + 5 | println(b) + 6 | } + 7 | c := -a { + | ^ + 8 | println("shouldn't get here") + 9 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/select_bad_key_4.vv b/v_windows/v/old/vlib/v/parser/tests/select_bad_key_4.vv new file mode 100644 index 0000000..bee7402 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/select_bad_key_4.vv @@ -0,0 +1,13 @@ +fn f3_bad(ch1 chan int) { + mut a := 5 + select { + a = <-ch1 { + println(b) + } + c := -a { + println("shouldn't get here") + } + } +} + +fn main() {} diff --git a/v_windows/v/old/vlib/v/parser/tests/select_else_1.out b/v_windows/v/old/vlib/v/parser/tests/select_else_1.out new file mode 100644 index 0000000..9704fbb --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/select_else_1.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/select_else_1.vv:12:3: error: `else` and timeout value are mutually exclusive `select` keys + 10 | println("shouldn't get here") + 11 | } + 12 | 30 * time.millisecond { + | ~~~~~~~~~~~~~~~~~~~~~ + 13 | println('bad') + 14 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/select_else_1.vv b/v_windows/v/old/vlib/v/parser/tests/select_else_1.vv new file mode 100644 index 0000000..78077f4 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/select_else_1.vv @@ -0,0 +1,18 @@ +import time + +fn f3_bad(ch1 chan int) { + a := 5 + select { + b := <-ch1 { + println(b) + } + else { + println("shouldn't get here") + } + 30 * time.millisecond { + println('bad') + } + } +} + +fn main() {} diff --git a/v_windows/v/old/vlib/v/parser/tests/select_else_2.out b/v_windows/v/old/vlib/v/parser/tests/select_else_2.out new file mode 100644 index 0000000..f927031 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/select_else_2.out @@ -0,0 +1,14 @@ +vlib/v/parser/tests/select_else_2.vv:9:3: notice: `>` is deprecated and will soon be forbidden - just state the timeout in nanoseconds + 7 | println(b) + 8 | } + 9 | > 30 * time.millisecond { + | ^ + 10 | println('bad') + 11 | } +vlib/v/parser/tests/select_else_2.vv:12:3: error: timeout `> t` and `else` are mutually exclusive `select` keys + 10 | println('bad') + 11 | } + 12 | else { + | ~~~~ + 13 | println("shouldn't get here") + 14 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/select_else_2.vv b/v_windows/v/old/vlib/v/parser/tests/select_else_2.vv new file mode 100644 index 0000000..2666dbc --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/select_else_2.vv @@ -0,0 +1,18 @@ +import time + +fn f3_bad(ch1 chan int) { + a := 5 + select { + b := <-ch1 { + println(b) + } + > 30 * time.millisecond { + println('bad') + } + else { + println("shouldn't get here") + } + } +} + +fn main() {} diff --git a/v_windows/v/old/vlib/v/parser/tests/sql_no_db_expr_a.out b/v_windows/v/old/vlib/v/parser/tests/sql_no_db_expr_a.out new file mode 100644 index 0000000..41417ae --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/sql_no_db_expr_a.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/sql_no_db_expr_a.vv:4:1: error: invalid expression: unexpected token `}` + 2 | // SqlStmt + 3 | sql := + 4 | } + | ^ diff --git a/v_windows/v/old/vlib/v/parser/tests/sql_no_db_expr_a.vv b/v_windows/v/old/vlib/v/parser/tests/sql_no_db_expr_a.vv new file mode 100644 index 0000000..5181f2d --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/sql_no_db_expr_a.vv @@ -0,0 +1,4 @@ +fn x() { + // SqlStmt + sql := +} diff --git a/v_windows/v/old/vlib/v/parser/tests/sql_no_db_expr_b.out b/v_windows/v/old/vlib/v/parser/tests/sql_no_db_expr_b.out new file mode 100644 index 0000000..da86e9c --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/sql_no_db_expr_b.out @@ -0,0 +1,6 @@ +vlib/v/parser/tests/sql_no_db_expr_b.vv:3:11: error: invalid expression: unexpected token `:=` + 1 | fn x() { + 2 | // SqlExpr + 3 | x := sql := + | ~~ + 4 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/sql_no_db_expr_b.vv b/v_windows/v/old/vlib/v/parser/tests/sql_no_db_expr_b.vv new file mode 100644 index 0000000..fa36435 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/sql_no_db_expr_b.vv @@ -0,0 +1,4 @@ +fn x() { + // SqlExpr + x := sql := +} diff --git a/v_windows/v/old/vlib/v/parser/tests/string_invalid_prefix_err.out b/v_windows/v/old/vlib/v/parser/tests/string_invalid_prefix_err.out new file mode 100644 index 0000000..416d415 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/string_invalid_prefix_err.out @@ -0,0 +1,6 @@ +vlib/v/parser/tests/string_invalid_prefix_err.vv:2:12: error: only `c`, `r`, `js` are recognized string prefixes, but you tried to use `w` + 1 | fn main() { + 2 | why := w'why' + | ^ + 3 | println(why) + 4 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/string_invalid_prefix_err.vv b/v_windows/v/old/vlib/v/parser/tests/string_invalid_prefix_err.vv new file mode 100644 index 0000000..6c8630c --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/string_invalid_prefix_err.vv @@ -0,0 +1,4 @@ +fn main() { + why := w'why' + println(why) +} diff --git a/v_windows/v/old/vlib/v/parser/tests/struct_embed_duplicate.out b/v_windows/v/old/vlib/v/parser/tests/struct_embed_duplicate.out new file mode 100644 index 0000000..752ed81 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/struct_embed_duplicate.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/struct_embed_duplicate.vv:7:2: error: cannot embed `Abc` more than once + 5 | struct Xyz { + 6 | Abc + 7 | Abc + | ~~~ + 8 | bar int + 9 | }
\ No newline at end of file diff --git a/v_windows/v/old/vlib/v/parser/tests/struct_embed_duplicate.vv b/v_windows/v/old/vlib/v/parser/tests/struct_embed_duplicate.vv new file mode 100644 index 0000000..46563a4 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/struct_embed_duplicate.vv @@ -0,0 +1,9 @@ +struct Abc { + foo int = 5 +} + +struct Xyz { + Abc + Abc + bar int +} diff --git a/v_windows/v/old/vlib/v/parser/tests/struct_embed_unknown_module.out b/v_windows/v/old/vlib/v/parser/tests/struct_embed_unknown_module.out new file mode 100644 index 0000000..5d4542c --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/struct_embed_unknown_module.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/struct_embed_unknown_module.vv:2:2: error: unknown module `custom` + 1 | struct WithEmbed { + 2 | custom.Foo + | ~~~~~~ + 3 | }
\ No newline at end of file diff --git a/v_windows/v/old/vlib/v/parser/tests/struct_embed_unknown_module.vv b/v_windows/v/old/vlib/v/parser/tests/struct_embed_unknown_module.vv new file mode 100644 index 0000000..1e084a8 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/struct_embed_unknown_module.vv @@ -0,0 +1,3 @@ +struct WithEmbed { + custom.Foo +} diff --git a/v_windows/v/old/vlib/v/parser/tests/struct_embed_wrong_pos_long_err.out b/v_windows/v/old/vlib/v/parser/tests/struct_embed_wrong_pos_long_err.out new file mode 100644 index 0000000..a4bc579 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/struct_embed_wrong_pos_long_err.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/struct_embed_wrong_pos_long_err.vv:4:2: error: struct embedding must be declared at the beginning of the struct body + 2 | struct Foo2 { + 3 | mut: + 4 | cli.Command + | ~~~~~~~~~~~ + 5 | } + 6 | fn main() {}
\ No newline at end of file diff --git a/v_windows/v/old/vlib/v/parser/tests/struct_embed_wrong_pos_long_err.vv b/v_windows/v/old/vlib/v/parser/tests/struct_embed_wrong_pos_long_err.vv new file mode 100644 index 0000000..8dcc62e --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/struct_embed_wrong_pos_long_err.vv @@ -0,0 +1,6 @@ +import cli +struct Foo2 { +mut: + cli.Command +} +fn main() {}
\ No newline at end of file diff --git a/v_windows/v/old/vlib/v/parser/tests/struct_embed_wrong_pos_short_err.out b/v_windows/v/old/vlib/v/parser/tests/struct_embed_wrong_pos_short_err.out new file mode 100644 index 0000000..04240f8 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/struct_embed_wrong_pos_short_err.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/struct_embed_wrong_pos_short_err.vv:6:2: error: struct embedding must be declared at the beginning of the struct body + 4 | struct Foo2 { + 5 | mut: + 6 | Foo + | ~~~ + 7 | } + 8 | fn main() {}
\ No newline at end of file diff --git a/v_windows/v/old/vlib/v/parser/tests/struct_embed_wrong_pos_short_err.vv b/v_windows/v/old/vlib/v/parser/tests/struct_embed_wrong_pos_short_err.vv new file mode 100644 index 0000000..cc270fa --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/struct_embed_wrong_pos_short_err.vv @@ -0,0 +1,8 @@ +struct Foo { + foo string +} +struct Foo2 { +mut: + Foo +} +fn main() {}
\ No newline at end of file diff --git a/v_windows/v/old/vlib/v/parser/tests/struct_field_expected.out b/v_windows/v/old/vlib/v/parser/tests/struct_field_expected.out new file mode 100644 index 0000000..9fa06a2 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/struct_field_expected.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/struct_field_expected.vv:6:2: error: unexpected token `.`, expecting struct field name + 4 | + 5 | x = { + 6 | .a : 'Alpha' + | ^ + 7 | .b : 'Beta' + 8 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/struct_field_expected.vv b/v_windows/v/old/vlib/v/parser/tests/struct_field_expected.vv new file mode 100644 index 0000000..bf4929c --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/struct_field_expected.vv @@ -0,0 +1,9 @@ +enum TestEnum { + a b +} + +x = { + .a : 'Alpha' + .b : 'Beta' +} + diff --git a/v_windows/v/old/vlib/v/parser/tests/struct_field_unknown_module_a.out b/v_windows/v/old/vlib/v/parser/tests/struct_field_unknown_module_a.out new file mode 100644 index 0000000..81ac9db --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/struct_field_unknown_module_a.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/struct_field_unknown_module_a.vv:2:7: error: unknown module `ui` + 1 | struct Inter { + 2 | code ui.KeyCode + | ~~ + 3 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/struct_field_unknown_module_a.vv b/v_windows/v/old/vlib/v/parser/tests/struct_field_unknown_module_a.vv new file mode 100644 index 0000000..31058d5 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/struct_field_unknown_module_a.vv @@ -0,0 +1,3 @@ +struct Inter { + code ui.KeyCode +} diff --git a/v_windows/v/old/vlib/v/parser/tests/struct_field_unknown_module_b.out b/v_windows/v/old/vlib/v/parser/tests/struct_field_unknown_module_b.out new file mode 100644 index 0000000..e467979 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/struct_field_unknown_module_b.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/struct_field_unknown_module_b.vv:2:7: error: unknown module `term.unknownmod` + 1 | struct Inter { + 2 | code term.unknownmod.KeyCode + | ~~~~~~~~~~~~~~~ + 3 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/struct_field_unknown_module_b.vv b/v_windows/v/old/vlib/v/parser/tests/struct_field_unknown_module_b.vv new file mode 100644 index 0000000..3193a7c --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/struct_field_unknown_module_b.vv @@ -0,0 +1,3 @@ +struct Inter { + code term.unknownmod.KeyCode +} diff --git a/v_windows/v/old/vlib/v/parser/tests/struct_field_unknown_module_c.out b/v_windows/v/old/vlib/v/parser/tests/struct_field_unknown_module_c.out new file mode 100644 index 0000000..84bd41e --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/struct_field_unknown_module_c.out @@ -0,0 +1,6 @@ +vlib/v/parser/tests/struct_field_unknown_module_c.vv:4:7: error: unknown module `term.ui`; did you mean `ui`? + 2 | + 3 | struct Inter { + 4 | code term.ui.KeyCode + | ~~~~~~~ + 5 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/struct_field_unknown_module_c.vv b/v_windows/v/old/vlib/v/parser/tests/struct_field_unknown_module_c.vv new file mode 100644 index 0000000..cce4940 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/struct_field_unknown_module_c.vv @@ -0,0 +1,5 @@ +import term.ui + +struct Inter { + code term.ui.KeyCode +} diff --git a/v_windows/v/old/vlib/v/parser/tests/struct_module_section.out b/v_windows/v/old/vlib/v/parser/tests/struct_module_section.out new file mode 100644 index 0000000..3bc03f7 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/struct_module_section.out @@ -0,0 +1,12 @@ +vlib/v/parser/tests/struct_module_section.vv:16:3: error: field `i` of struct `S1` is immutable + 14 | + 15 | mut s := S1{} + 16 | s.i++ + | ^ + 17 | mut s2 := S2{} + 18 | s2.j++ +vlib/v/parser/tests/struct_module_section.vv:18:4: error: field `j` of struct `S2` is immutable + 16 | s.i++ + 17 | mut s2 := S2{} + 18 | s2.j++ + | ^ diff --git a/v_windows/v/old/vlib/v/parser/tests/struct_module_section.vv b/v_windows/v/old/vlib/v/parser/tests/struct_module_section.vv new file mode 100644 index 0000000..d15a49c --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/struct_module_section.vv @@ -0,0 +1,18 @@ +struct S1 { +pub mut: + v byte +module: + i int +} + +struct S2 { +module: + j int +mut: + v byte +} + +mut s := S1{} +s.i++ +mut s2 := S2{} +s2.j++ diff --git a/v_windows/v/old/vlib/v/parser/tests/struct_update_err.out b/v_windows/v/old/vlib/v/parser/tests/struct_update_err.out new file mode 100644 index 0000000..ee72f49 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/struct_update_err.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/struct_update_err.vv:15:3: error: unexpected token `...`, expecting name + 13 | f2 := Foo{ + 14 | name: 'f2' + 15 | ...f + | ~~~ + 16 | } + 17 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/struct_update_err.vv b/v_windows/v/old/vlib/v/parser/tests/struct_update_err.vv new file mode 100644 index 0000000..46aa523 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/struct_update_err.vv @@ -0,0 +1,17 @@ +struct Foo { + name string + age int +} + +struct Foo2 {} + +fn main() { + f := Foo{ + name: 'test' + age: 18 + } + f2 := Foo{ + name: 'f2' + ...f + } +} diff --git a/v_windows/v/old/vlib/v/parser/tests/too_many_generics_err.out b/v_windows/v/old/vlib/v/parser/tests/too_many_generics_err.out new file mode 100644 index 0000000..82cb5fb --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/too_many_generics_err.out @@ -0,0 +1,3 @@ +vlib/v/parser/tests/too_many_generics_err.vv:1:40: error: cannot have more than 9 generic parameters + 1 | fn too_many<A, B, D, E, F, G, H, I, J, K>() {} + | ^ diff --git a/v_windows/v/old/vlib/v/parser/tests/too_many_generics_err.vv b/v_windows/v/old/vlib/v/parser/tests/too_many_generics_err.vv new file mode 100644 index 0000000..a42f2c1 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/too_many_generics_err.vv @@ -0,0 +1 @@ +fn too_many<A, B, D, E, F, G, H, I, J, K>() {} diff --git a/v_windows/v/old/vlib/v/parser/tests/type_alias_existing_type_err.out b/v_windows/v/old/vlib/v/parser/tests/type_alias_existing_type_err.out new file mode 100644 index 0000000..6ea695f --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/type_alias_existing_type_err.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/type_alias_existing_type_err.vv:3:1: error: cannot register alias `Foo`, another type with this name exists + 1 | struct Foo{} + 2 | + 3 | type Foo = Foo + | ~~~~~~~~~~~~~~ + 4 | + 5 | fn main() { diff --git a/v_windows/v/old/vlib/v/parser/tests/type_alias_existing_type_err.vv b/v_windows/v/old/vlib/v/parser/tests/type_alias_existing_type_err.vv new file mode 100644 index 0000000..c1aeeed --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/type_alias_existing_type_err.vv @@ -0,0 +1,7 @@ +struct Foo{} + +type Foo = Foo + +fn main() { + +} diff --git a/v_windows/v/old/vlib/v/parser/tests/type_alias_same_type_err.out b/v_windows/v/old/vlib/v/parser/tests/type_alias_same_type_err.out new file mode 100644 index 0000000..c5b3797 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/type_alias_same_type_err.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/type_alias_same_type_err.vv:1:1: error: a type alias can not refer to itself: Foo + 1 | type Foo = Foo + | ~~~~~~~~~~~~~~ + 2 | + 3 | fn main() { diff --git a/v_windows/v/old/vlib/v/parser/tests/type_alias_same_type_err.vv b/v_windows/v/old/vlib/v/parser/tests/type_alias_same_type_err.vv new file mode 100644 index 0000000..4cf7265 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/type_alias_same_type_err.vv @@ -0,0 +1,5 @@ +type Foo = Foo + +fn main() { + +} diff --git a/v_windows/v/old/vlib/v/parser/tests/uncomplete_module_call_err.out b/v_windows/v/old/vlib/v/parser/tests/uncomplete_module_call_err.out new file mode 100644 index 0000000..8acb09d --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/uncomplete_module_call_err.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/uncomplete_module_call_err.vv:7:1: error: unexpected token `}`, expecting name + 5 | fn main() { + 6 | os. + 7 | } + | ^ diff --git a/v_windows/v/old/vlib/v/parser/tests/uncomplete_module_call_err.vv b/v_windows/v/old/vlib/v/parser/tests/uncomplete_module_call_err.vv new file mode 100644 index 0000000..7a3cb06 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/uncomplete_module_call_err.vv @@ -0,0 +1,7 @@ +module main + +import os + +fn main() { + os. +} diff --git a/v_windows/v/old/vlib/v/parser/tests/unexpected_expr.out b/v_windows/v/old/vlib/v/parser/tests/unexpected_expr.out new file mode 100644 index 0000000..46c1610 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/unexpected_expr.out @@ -0,0 +1,3 @@ +vlib/v/parser/tests/unexpected_expr.vv:1:5: error: invalid expression: unexpected keyword `break` + 1 | _ = break + | ~~~~~ diff --git a/v_windows/v/old/vlib/v/parser/tests/unexpected_expr.vv b/v_windows/v/old/vlib/v/parser/tests/unexpected_expr.vv new file mode 100644 index 0000000..25b0690 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/unexpected_expr.vv @@ -0,0 +1 @@ +_ = break diff --git a/v_windows/v/old/vlib/v/parser/tests/unexpected_keyword.out b/v_windows/v/old/vlib/v/parser/tests/unexpected_keyword.out new file mode 100644 index 0000000..08adaf7 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/unexpected_keyword.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/unexpected_keyword.vv:5:12: error: expecting method name + 3 | } + 4 | + 5 | fn (s Abc) import(name string) { + | ~~~~~~ + 6 | println(name) + 7 | } diff --git a/v_windows/v/old/vlib/v/parser/tests/unexpected_keyword.vv b/v_windows/v/old/vlib/v/parser/tests/unexpected_keyword.vv new file mode 100644 index 0000000..4d60303 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/unexpected_keyword.vv @@ -0,0 +1,12 @@ +struct Abc { + x int +} + +fn (s Abc) import(name string) { + println(name) +} + +fn main() { + s := Abc{} + s.import('lib') +} diff --git a/v_windows/v/old/vlib/v/parser/tests/unnecessary_mut.out b/v_windows/v/old/vlib/v/parser/tests/unnecessary_mut.out new file mode 100644 index 0000000..4399c9f --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/unnecessary_mut.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/unnecessary_mut.vv:3:5: error: remove unnecessary `mut` + 1 | fn main() { + 2 | mut x := 0 + 3 | if mut x == 0 { + | ~~~ + 4 | println(true) + 5 | }
\ No newline at end of file diff --git a/v_windows/v/old/vlib/v/parser/tests/unnecessary_mut.vv b/v_windows/v/old/vlib/v/parser/tests/unnecessary_mut.vv new file mode 100644 index 0000000..6c7a470 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/unnecessary_mut.vv @@ -0,0 +1,7 @@ +fn main() { + mut x := 0 + if mut x == 0 { + println(true) + } + _ = x +} diff --git a/v_windows/v/old/vlib/v/parser/tests/unnecessary_mut_2.out b/v_windows/v/old/vlib/v/parser/tests/unnecessary_mut_2.out new file mode 100644 index 0000000..5f7dfee --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/unnecessary_mut_2.out @@ -0,0 +1,6 @@ +vlib/v/parser/tests/unnecessary_mut_2.vv:2:9: error: unexpected token `true` + 1 | fn main() { + 2 | if mut true { + | ~~~~ + 3 | println(true) + 4 | }
\ No newline at end of file diff --git a/v_windows/v/old/vlib/v/parser/tests/unnecessary_mut_2.vv b/v_windows/v/old/vlib/v/parser/tests/unnecessary_mut_2.vv new file mode 100644 index 0000000..0df3f80 --- /dev/null +++ b/v_windows/v/old/vlib/v/parser/tests/unnecessary_mut_2.vv @@ -0,0 +1,5 @@ +fn main() { + if mut true { + println(true) + } +} |