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

ast: fix string interpolation fmt with result call (#15467)

This commit is contained in:
yuyi 2022-08-19 14:44:59 +08:00 committed by GitHub
parent ea163197c7
commit 1dc62a5a66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -210,7 +210,7 @@ pub fn (lit &StringInterLiteral) get_fspec_braces(i int) (string, bool) {
}
CallExpr {
if sub_expr.args.len != 0 || sub_expr.concrete_types.len != 0
|| sub_expr.or_block.kind == .propagate_option
|| sub_expr.or_block.kind in [.propagate_option, .propagate_result]
|| sub_expr.or_block.stmts.len > 0 {
needs_braces = true
} else if sub_expr.left is CallExpr {

View File

@ -0,0 +1,7 @@
fn err() !u8 {
return 1
}
fn main() {
println('${err()!}')
}