mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: check undefined ident in reference selector (#14949)
This commit is contained in:
parent
8b8667dd9a
commit
56d62a6e6f
@ -1124,6 +1124,7 @@ pub fn (mut c Checker) selector_expr(mut node ast.SelectorExpr) ast.Type {
|
||||
// This means that the field has an undefined type.
|
||||
// This error was handled before.
|
||||
// c.error('`void` type has no fields', node.pos)
|
||||
node.expr_type = ast.void_type
|
||||
return ast.void_type
|
||||
}
|
||||
node.expr_type = typ
|
||||
|
6
vlib/v/checker/tests/undefined_ident_in_ref_selector.out
Normal file
6
vlib/v/checker/tests/undefined_ident_in_ref_selector.out
Normal file
@ -0,0 +1,6 @@
|
||||
vlib/v/checker/tests/undefined_ident_in_ref_selector.vv:6:10: error: undefined ident: `line`
|
||||
4 |
|
||||
5 | fn read() int {
|
||||
6 | return &line.len
|
||||
| ~~~~
|
||||
7 | }
|
7
vlib/v/checker/tests/undefined_ident_in_ref_selector.vv
Normal file
7
vlib/v/checker/tests/undefined_ident_in_ref_selector.vv
Normal file
@ -0,0 +1,7 @@
|
||||
module main
|
||||
|
||||
fn main() {}
|
||||
|
||||
fn read() int {
|
||||
return &line.len
|
||||
}
|
Loading…
Reference in New Issue
Block a user