mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: check undefined variable in if guard (#16138)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
vlib/v/checker/tests/undefined_ident_in_if_guard_err.vv:6:11: error: undefined variable: `re`
|
||||
vlib/v/checker/tests/undefined_ident_in_if_guard_err_a.vv:6:11: error: undefined variable: `re`
|
||||
4 |
|
||||
5 | fn main() {
|
||||
6 | if re := re.regex_opt('a') {
|
||||
@@ -0,0 +1,6 @@
|
||||
vlib/v/checker/tests/undefined_ident_in_if_guard_err_b.vv:3:17: error: undefined variable: `id`
|
||||
1 | fn main(){
|
||||
2 | items := {'a': 'A'}
|
||||
3 | if id := items[id] {} else {}
|
||||
| ~~
|
||||
4 | }
|
||||
@@ -0,0 +1,4 @@
|
||||
fn main(){
|
||||
items := {'a': 'A'}
|
||||
if id := items[id] {} else {}
|
||||
}
|
||||
Reference in New Issue
Block a user