1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/v/tests/anon_fn_redefinition_test.v

25 lines
407 B
V

const default_logger = Example{}
struct Example {
structs []Another = [Another{}]
}
pub struct Another {
function fn (string) = fn (value string) {
println('${value}')
}
}
pub fn (e Example) useless() string {
return 'ok'
}
fn test_anon_fn_redefinition() {
e1 := Example{}
assert e1.useless() == 'ok'
e2 := Example{}
assert e2.useless() == 'ok'
e3 := Example{}
assert e3.useless() == 'ok'
}