Open kbkpbot opened 1 year ago
There are special rules in checker for chan try_pop: https://github.com/vlang/v/tree/master/vlib/v/checker/fn.v/#L1699
if left_sym.info is ast.Chan { if method_name == 'try_push' { exp_arg_typ = left_sym.info.elem_type.ref() } else if method_name == 'try_pop' { exp_arg_typ = left_sym.info.elem_type param_is_mut = true no_type_promotion = true } }
I think it is better update the corresponding doc: https://modules.vlang.io/index.html#chan.try_pop
fn (mut ch Channel) try_pop(dest voidptr) ChanState
such as ch.try_pop(mut i) , not ch.try_pop(&i)
ch.try_pop(mut i)
ch.try_pop(&i)
https://modules.vlang.io/index.html#chan.try_pop
BTW, in file: https://github.com/vlang/v/blob/master/vlib/sync/bench/many_writers_and_receivers_on_1_channel.v/#L51 if should be:
for ch.try_pop(mut tmp) == .success
Describe the issue
There are special rules in checker for chan try_pop: https://github.com/vlang/v/tree/master/vlib/v/checker/fn.v/#L1699
I think it is better update the corresponding doc: https://modules.vlang.io/index.html#chan.try_pop
such as
ch.try_pop(mut i)
, notch.try_pop(&i)
Links
https://modules.vlang.io/index.html#chan.try_pop