diff --git a/vlib/v/ast/str.v b/vlib/v/ast/str.v index fd4edf01aa..d8f3d4e618 100644 --- a/vlib/v/ast/str.v +++ b/vlib/v/ast/str.v @@ -158,6 +158,9 @@ pub fn (lit &StringInterLiteral) get_fspec_braces(i int) (string, bool) { CallExpr { if sub_expr.args.len != 0 { needs_braces = true + } else if sub_expr.left is CallExpr { + sub_expr = sub_expr.left + continue } break } diff --git a/vlib/v/fmt/tests/string_interpolation_literal_keep.vv b/vlib/v/fmt/tests/string_interpolation_literal_keep.vv index 573a0cdf36..28f15ea833 100644 --- a/vlib/v/fmt/tests/string_interpolation_literal_keep.vv +++ b/vlib/v/fmt/tests/string_interpolation_literal_keep.vv @@ -9,5 +9,5 @@ fn main() { d := 'a: ${a:5s} b: ${b:-5s} i: ${i:20d}' println('a: $a $b xxx') eprintln('e: $e') - println(d) + _ = ' ${foo.method(bar).str()} ' }