mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: fix push on closed channel (#15468)
This commit is contained in:
@ -390,8 +390,6 @@ pub fn gen(files []&ast.File, table &ast.Table, pref &pref.Preferences) string {
|
||||
}
|
||||
|
||||
global_g.gen_jsons()
|
||||
global_g.write_optionals()
|
||||
global_g.write_results()
|
||||
global_g.dump_expr_definitions() // this uses global_g.get_str_fn, so it has to go before the below for loop
|
||||
for i := 0; i < global_g.str_types.len; i++ {
|
||||
global_g.final_gen_str(global_g.str_types[i])
|
||||
@ -406,6 +404,8 @@ pub fn gen(files []&ast.File, table &ast.Table, pref &pref.Preferences) string {
|
||||
global_g.gen_array_index_methods()
|
||||
global_g.gen_equality_fns()
|
||||
global_g.gen_free_methods()
|
||||
global_g.write_results()
|
||||
global_g.write_optionals()
|
||||
global_g.sort_globals_consts()
|
||||
global_g.timers.show('cgen unification')
|
||||
|
||||
|
1
vlib/v/tests/inout/push_on_closed_channel.out
Normal file
1
vlib/v/tests/inout/push_on_closed_channel.out
Normal file
@ -0,0 +1 @@
|
||||
Channel closed.
|
7
vlib/v/tests/inout/push_on_closed_channel.vv
Normal file
7
vlib/v/tests/inout/push_on_closed_channel.vv
Normal file
@ -0,0 +1,7 @@
|
||||
module main
|
||||
|
||||
fn main() {
|
||||
ch := chan int{cap: 100}
|
||||
ch.close()
|
||||
ch <- 1 or { println('Channel closed.') }
|
||||
}
|
Reference in New Issue
Block a user