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

fmt: fix string interpolation with CastExpr (#9137)

This commit is contained in:
Lukas Neubert 2021-03-06 19:47:19 +01:00 committed by GitHub
parent ce92bf8da0
commit 043c29cf95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View File

@ -162,6 +162,8 @@ pub fn (lit &StringInterLiteral) get_fspec_braces(i int) (string, bool) {
} else if sub_expr.left is CallExpr {
sub_expr = sub_expr.left
continue
} else if sub_expr.left is CastExpr {
needs_braces = true
}
break
}

View File

@ -11,4 +11,5 @@ fn main() {
eprintln('e: $e')
_ = ' ${foo.method(bar).str()} '
println('(${some_struct.@type}, $some_struct.y)')
_ := 'CastExpr ${int(d.e).str()}'
}