diff --git a/vlib/v/fmt/tests/attrs_keep.vv b/vlib/v/fmt/tests/attrs_keep.vv index da2606da89..cad488cec8 100644 --- a/vlib/v/fmt/tests/attrs_keep.vv +++ b/vlib/v/fmt/tests/attrs_keep.vv @@ -1,3 +1,8 @@ +struct AttrsWithEscpaedStringArgs { + dollar string [foo: '\$var'] + double_bs string [bar: '\\baz'] +} + [deprecated: 'use bar() instead'] [foo: bar] [if debug; inline] diff --git a/vlib/v/table/attr.v b/vlib/v/table/attr.v index b66572e2e4..106df986d9 100644 --- a/vlib/v/table/attr.v +++ b/vlib/v/table/attr.v @@ -29,9 +29,7 @@ pub fn (attr Attr) str() string { if attr.arg.len > 0 { s += ': ' if attr.is_string_arg { - mut a := attr.arg.replace('\\', '\\\\') - // FIXME: other escapes e.g. \r\n - a = a.replace("'", "\\'") + a := attr.arg.replace("'", "\\'") s += "'$a'" } else { s += attr.arg