fmt: keep braces around @ escaped fields in string interpolation (#8488)

pull/8492/head weekly.2021.5
Lukas Neubert 2021-02-01 10:04:57 +01:00 committed by GitHub
parent 8b0401a46f
commit 43676330ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -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
}

View File

@ -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)')
}