mirror of
https://github.com/vlang/v.git
synced 2025-09-10 16:00:31 -04:00
This commit is contained in:
parent
17812a77b8
commit
ab707dce5c
@ -173,6 +173,8 @@ fn (mut c Checker) for_in_stmt(mut node ast.ForInStmt) {
|
|||||||
unwrapped_typ := c.unwrap_generic(typ)
|
unwrapped_typ := c.unwrap_generic(typ)
|
||||||
unwrapped_sym := c.table.sym(unwrapped_typ)
|
unwrapped_sym := c.table.sym(unwrapped_typ)
|
||||||
|
|
||||||
|
c.table.used_features.comptime_calls['${int(unwrapped_typ)}.next'] = true
|
||||||
|
|
||||||
if node.key_var.len > 0 {
|
if node.key_var.len > 0 {
|
||||||
key_type := match unwrapped_sym.kind {
|
key_type := match unwrapped_sym.kind {
|
||||||
.map { unwrapped_sym.map_info().key_type }
|
.map { unwrapped_sym.map_info().key_type }
|
||||||
|
23
vlib/v/tests/skip_unused/generic_iterator_loop.vv
Normal file
23
vlib/v/tests/skip_unused/generic_iterator_loop.vv
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
module main
|
||||||
|
|
||||||
|
struct Foo {}
|
||||||
|
|
||||||
|
fn (f Foo) next() ?Foo {
|
||||||
|
return none
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Bar {}
|
||||||
|
|
||||||
|
fn (f Bar) next() ?Bar {
|
||||||
|
return none
|
||||||
|
}
|
||||||
|
|
||||||
|
fn loop[T](iter T) {
|
||||||
|
for _ in iter {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
loop(Foo{})
|
||||||
|
loop(Bar{})
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user