mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
fmt: fix optional formatting
This commit is contained in:
parent
fecf4ddf65
commit
faed178cb1
5
vlib/v/fmt/tests/optional_keep.vv
Normal file
5
vlib/v/fmt/tests/optional_keep.vv
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
pub fn test() ?&SomeType {
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SomeType {
|
||||||
|
}
|
@ -631,13 +631,13 @@ pub fn (table &Table) type_to_str(t Type) string {
|
|||||||
res = '[]' + res
|
res = '[]' + res
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if type_is(t, .optional) {
|
|
||||||
res = '?' + res
|
|
||||||
}
|
|
||||||
nr_muls := type_nr_muls(t)
|
nr_muls := type_nr_muls(t)
|
||||||
if nr_muls > 0 {
|
if nr_muls > 0 {
|
||||||
res = strings.repeat(`&`, nr_muls) + res
|
res = strings.repeat(`&`, nr_muls) + res
|
||||||
}
|
}
|
||||||
|
if type_is(t, .optional) {
|
||||||
|
res = '?' + res
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
if res.starts_with(cur_mod +'.') {
|
if res.starts_with(cur_mod +'.') {
|
||||||
res = res[cur_mod.len+1.. ]
|
res = res[cur_mod.len+1.. ]
|
||||||
|
Loading…
Reference in New Issue
Block a user