mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: for in index type error position
This commit is contained in:
parent
deab448d93
commit
50871d1a92
@ -954,7 +954,7 @@ fn (c mut Checker) stmt(node ast.Stmt) {
|
||||
value_type := c.table.value_type(typ)
|
||||
if value_type == table.void_type {
|
||||
typ_sym := c.table.get_type_symbol(typ)
|
||||
c.error('for in: cannot index `$typ_sym.name`', it.pos)
|
||||
c.error('for in: cannot index `$typ_sym.name`', expr_pos(it.cond))
|
||||
}
|
||||
it.cond_type = typ
|
||||
it.kind = sym.kind
|
||||
|
6
vlib/v/checker/tests/inout/for-in-index-type.out
Normal file
6
vlib/v/checker/tests/inout/for-in-index-type.out
Normal file
@ -0,0 +1,6 @@
|
||||
vlib/v/checker/tests/inout/for-in-index-type.v:2:11: error: for in: cannot index `int`
|
||||
1| fn main() {
|
||||
2| for a in 52 {
|
||||
~~
|
||||
3| println(a)
|
||||
4| }
|
5
vlib/v/checker/tests/inout/for-in-index-type.vv
Normal file
5
vlib/v/checker/tests/inout/for-in-index-type.vv
Normal file
@ -0,0 +1,5 @@
|
||||
fn main() {
|
||||
for a in 52 {
|
||||
println(a)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user