fix(tvix/value): add ident_str representation of strings

When printing strings as identifiers (in attribute sets), the string
should only be quoted and escaped if it contains escape characters.

Change-Id: If2bcfa1e93dc8f00be4d7a57ec1d82fc679103c3
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6127
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
Autosubmit: tazjin <tazjin@tvl.su>
This commit is contained in:
Vincent Ambo 2022-08-10 19:09:27 +03:00 committed by tazjin
parent 92c53fe982
commit 5685f7c594
2 changed files with 25 additions and 8 deletions

View file

@ -37,7 +37,7 @@ impl Display for NixAttrs {
NixAttrs::Map(map) => {
for (name, value) in map {
f.write_fmt(format_args!("{} = {}; ", name, value))?;
f.write_fmt(format_args!("{} = {}; ", name.ident_str(), value))?;
}
}