mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
fmt: use single quotes around fixed string arr default expr (#7581)
This commit is contained in:
parent
e26e0c3f72
commit
9a5bbc3101
@ -1840,7 +1840,9 @@ pub fn (mut f Fmt) array_init(it ast.ArrayInit) {
|
|||||||
}
|
}
|
||||||
f.write(f.table.type_to_str(it.elem_type))
|
f.write(f.table.type_to_str(it.elem_type))
|
||||||
if it.has_default {
|
if it.has_default {
|
||||||
f.write('{init: $it.default_expr}')
|
f.write('{init: ')
|
||||||
|
f.expr(it.default_expr)
|
||||||
|
f.write('}')
|
||||||
} else {
|
} else {
|
||||||
f.write('{}')
|
f.write('{}')
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,10 @@ fn main() {
|
|||||||
'eggs',
|
'eggs',
|
||||||
]
|
]
|
||||||
_ := []int{len: 10, cap: 10, init: 7}
|
_ := []int{len: 10, cap: 10, init: 7}
|
||||||
_ := []map[string]string{len: 5, cap: 50, init: 'a'}
|
_ := []map[string]string{len: 5, cap: 50, init: {
|
||||||
_ := []map[string][]int{len: 7, cap: 100, init: [1, 2]}
|
'a': 'a'
|
||||||
|
}}
|
||||||
|
_ := []map[string][]int{len: 7, cap: 100, init: {
|
||||||
|
'a': [1, 2]
|
||||||
|
}}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
fn foo() [1]f32 {
|
fn foo() [1]f32 {
|
||||||
return [f32(0.0)]!!
|
return [f32(0.0)]!!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
_ := [5]string{init: 'abc'}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user