diff --git a/vlib/v/ast/str.v b/vlib/v/ast/str.v index cbcd726621..84fbc45a25 100644 --- a/vlib/v/ast/str.v +++ b/vlib/v/ast/str.v @@ -165,6 +165,10 @@ pub fn (lit &StringInterLiteral) get_fspec_braces(i int) (string, bool) { break } SelectorExpr { + if sub_expr.field_name[0] == `@` { + needs_braces = true + break + } sub_expr = sub_expr.expr continue } diff --git a/vlib/v/fmt/tests/string_interpolation_literal_keep.vv b/vlib/v/fmt/tests/string_interpolation_literal_keep.vv index 28f15ea833..133b15b270 100644 --- a/vlib/v/fmt/tests/string_interpolation_literal_keep.vv +++ b/vlib/v/fmt/tests/string_interpolation_literal_keep.vv @@ -10,4 +10,5 @@ fn main() { println('a: $a $b xxx') eprintln('e: $e') _ = ' ${foo.method(bar).str()} ' + println('(${some_struct.@type}, $some_struct.y)') }