mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
fmt: format '1.' to '1.0' (#11312)
This commit is contained in:
parent
714fa3215c
commit
b635ff80de
@ -549,6 +549,9 @@ pub fn (mut f Fmt) expr(node ast.Expr) {
|
||||
}
|
||||
ast.FloatLiteral {
|
||||
f.write(node.val)
|
||||
if node.val.ends_with('.') {
|
||||
f.write('0')
|
||||
}
|
||||
}
|
||||
ast.GoExpr {
|
||||
f.go_expr(node)
|
||||
|
4
vlib/v/fmt/tests/float_literals_expected.vv
Normal file
4
vlib/v/fmt/tests/float_literals_expected.vv
Normal file
@ -0,0 +1,4 @@
|
||||
fn main() {
|
||||
a := 1.0
|
||||
println(a)
|
||||
}
|
4
vlib/v/fmt/tests/float_literals_input.vv
Normal file
4
vlib/v/fmt/tests/float_literals_input.vv
Normal file
@ -0,0 +1,4 @@
|
||||
fn main() {
|
||||
a := 1.
|
||||
println(a)
|
||||
}
|
Loading…
Reference in New Issue
Block a user