mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
fmt: fix ?void format error, add _keep.vv test
This commit is contained in:
parent
ffafeac0f8
commit
962bbf1c60
9
vlib/v/fmt/tests/void_optional_keep.vv
Normal file
9
vlib/v/fmt/tests/void_optional_keep.vv
Normal file
@ -0,0 +1,9 @@
|
||||
fn tt() ? {
|
||||
return error('error')
|
||||
}
|
||||
|
||||
fn main() {
|
||||
tt() or {
|
||||
panic('$err')
|
||||
}
|
||||
}
|
@ -707,7 +707,11 @@ pub fn (table &Table) type_to_str(t Type) string {
|
||||
res = strings.repeat(`&`, nr_muls) + res
|
||||
}
|
||||
if t.flag_is(.optional) {
|
||||
res = '?' + res
|
||||
if sym.kind == .void {
|
||||
res = '?'
|
||||
} else {
|
||||
res = '?' + res
|
||||
}
|
||||
}
|
||||
/*
|
||||
if res.starts_with(cur_mod +'.') {
|
||||
|
Loading…
Reference in New Issue
Block a user