-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
checker: add a deprecation warning for
const ()
groups (an error af…
…ter 2025-01-01) (#22019)
- Loading branch information
Showing
46 changed files
with
268 additions
and
322 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
vlib/v/checker/tests/const_decl_multi_return_err.vv:6:6: error: const declarations do not support multiple return values yet | ||
4 | | ||
5 | const ( | ||
6 | a = foo() | ||
| ~~~~~ | ||
7 | ) | ||
8 | | ||
vlib/v/checker/tests/const_decl_multi_return_err.vv:5:11: error: const declarations do not support multiple return values yet | ||
3 | } | ||
4 | | ||
5 | const a = foo() | ||
| ~~~~~ | ||
6 | | ||
7 | fn main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
vlib/v/checker/tests/const_define_in_function_err.vv:2:2: error: const can only be defined at the top level (outside of functions) | ||
1 | fn main() { | ||
2 | const (a = 1) | ||
2 | const a = 1 | ||
| ~~~~~ | ||
3 | println(a) | ||
4 | } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
fn main() { | ||
const (a = 1) | ||
const a = 1 | ||
println(a) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
vlib/v/checker/tests/const_field_add_err.vv:6:2: error: cannot modify constant `a` | ||
4 | | ||
5 | fn main() { | ||
6 | a += 1 | ||
vlib/v/checker/tests/const_field_add_err.vv:4:2: error: cannot modify constant `a` | ||
2 | | ||
3 | fn main() { | ||
4 | a += 1 | ||
| ^ | ||
7 | } | ||
5 | } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
const ( | ||
a = 1 | ||
) | ||
const a = 1 | ||
|
||
fn main() { | ||
a += 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
vlib/v/checker/tests/const_field_dec_err.vv:6:2: error: cannot modify constant `a` | ||
4 | | ||
5 | fn main() { | ||
6 | a-- | ||
vlib/v/checker/tests/const_field_dec_err.vv:4:2: error: cannot modify constant `a` | ||
2 | | ||
3 | fn main() { | ||
4 | a-- | ||
| ^ | ||
7 | } | ||
5 | } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
const ( | ||
a = 1 | ||
) | ||
const a = 1 | ||
|
||
fn main() { | ||
a-- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
vlib/v/checker/tests/const_field_inc_err.vv:6:2: error: cannot modify constant `a` | ||
4 | | ||
5 | fn main() { | ||
6 | a++ | ||
vlib/v/checker/tests/const_field_inc_err.vv:4:2: error: cannot modify constant `a` | ||
2 | | ||
3 | fn main() { | ||
4 | a++ | ||
| ^ | ||
7 | } | ||
5 | } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
const ( | ||
a = 1 | ||
) | ||
const a = 1 | ||
|
||
fn main() { | ||
a++ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
vlib/v/checker/tests/const_field_name_duplicate_err.vv:3:2: error: duplicate const `aaa` | ||
1 | const ( | ||
2 | aaa = 1 | ||
3 | aaa = 2 | ||
| ~~~ | ||
4 | ) | ||
5 | fn main() { | ||
vlib/v/checker/tests/const_field_name_duplicate_err.vv:2:1: error: unexpected name `cosnt` | ||
1 | const aaa = 1 | ||
2 | cosnt aaa = 2 | ||
| ~~~~~ | ||
3 | | ||
4 | fn main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
const ( | ||
aaa = 1 | ||
aaa = 2 | ||
) | ||
const aaa = 1 | ||
cosnt aaa = 2 | ||
|
||
fn main() { | ||
println(aaa) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
vlib/v/checker/tests/const_field_name_snake_case.vv:2:2: error: const names cannot contain uppercase letters, use snake_case instead | ||
1 | const ( | ||
2 | Red = 1 | ||
| ~~~ | ||
3 | ) | ||
4 | fn main() { println(Red) } | ||
vlib/v/checker/tests/const_field_name_snake_case.vv:1:7: error: const names cannot contain uppercase letters, use snake_case instead | ||
1 | const Red = 1 | ||
| ~~~ | ||
2 | | ||
3 | fn main() { println(Red) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
const ( | ||
Red = 1 | ||
) | ||
const Red = 1 | ||
|
||
fn main() { println(Red) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
vlib/v/checker/tests/const_field_sub_err.vv:6:2: error: cannot modify constant `a` | ||
4 | | ||
5 | fn main() { | ||
6 | a -= 1 | ||
vlib/v/checker/tests/const_field_sub_err.vv:4:2: error: cannot modify constant `a` | ||
2 | | ||
3 | fn main() { | ||
4 | a -= 1 | ||
| ^ | ||
7 | } | ||
5 | } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
const ( | ||
a = 1 | ||
) | ||
const a = 1 | ||
|
||
fn main() { | ||
a -= 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
vlib/v/checker/tests/globals/name_conflict_with_const.vv:6:2: error: duplicate global and const `foo` | ||
4 | | ||
5 | __global ( | ||
6 | foo = 123 | ||
| ~~~ | ||
7 | ) | ||
vlib/v/checker/tests/globals/name_conflict_with_const.vv:3:10: error: duplicate global and const `foo` | ||
1 | const foo = 'abc' | ||
2 | | ||
3 | __global foo = 123 | ||
| ~~~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
const ( | ||
foo = 'abc' | ||
) | ||
const foo = 'abc' | ||
|
||
__global ( | ||
foo = 123 | ||
) | ||
__global foo = 123 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
vlib/v/checker/tests/if_diff_expected_type_err.vv:7:11: error: mismatched types `&[]rune` and `[]rune` | ||
5 | | ||
6 | fn main() { | ||
7 | runes := if true { &some_runes } else { some_other_runes } | ||
vlib/v/checker/tests/if_diff_expected_type_err.vv:5:11: error: mismatched types `&[]rune` and `[]rune` | ||
3 | | ||
4 | fn main() { | ||
5 | runes := if true { &some_runes } else { some_other_runes } | ||
| ~~ | ||
8 | println(runes) | ||
9 | } | ||
6 | println(runes) | ||
7 | } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
const ( | ||
some_runes = [`a`, `b`, `c`] | ||
some_other_runes = [`c`, `b`, `a`] | ||
) | ||
const some_runes = [`a`, `b`, `c`] | ||
const some_other_runes = [`c`, `b`, `a`] | ||
|
||
fn main() { | ||
runes := if true { &some_runes } else { some_other_runes } | ||
println(runes) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
const ( | ||
_my_const = 0 | ||
) | ||
const _my_const = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
vlib/v/checker/tests/lock_const.vv:7:8: error: `a` must be declared as `shared` variable to be locked | ||
5 | fn main() { | ||
6 | mut c := 0 | ||
7 | rlock a { | ||
vlib/v/checker/tests/lock_const.vv:5:8: error: `a` must be declared as `shared` variable to be locked | ||
3 | fn main() { | ||
4 | mut c := 0 | ||
5 | rlock a { | ||
| ^ | ||
8 | c = a | ||
9 | } | ||
6 | c = a | ||
7 | } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
const ( | ||
a = 5 | ||
) | ||
const a = 5 | ||
|
||
fn main() { | ||
mut c := 0 | ||
|
Oops, something went wrong.