Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Commit

Permalink
cue/format: fix simplification bug
Browse files Browse the repository at this point in the history
Closes Issue #294

Change-Id: If7ac761d9cea5745f273f5c4ced11509d08efd80
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/5061
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
  • Loading branch information
mpvl committed Feb 24, 2020
1 parent 6ad04b3 commit d05ea95
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cue/format/simplify.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (s *labelSimplifier) markStrings(n ast.Node) bool {
case *ast.Ident:
s.scope[x.Name] = true

case *ast.ListLit:
case *ast.ListLit, *ast.Interpolation:
return false
}
return true
Expand Down
3 changes: 3 additions & 0 deletions cue/format/testdata/simplify.golden
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ quux: 5
// TODO(legacy): Don't simplify "hidden" fields for now.
"_foo": 3

// Issue #294
"\("x")": "x"

x: {
@tag0(foo)
r1: baz1
Expand Down
3 changes: 3 additions & 0 deletions cue/format/testdata/simplify.input
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ a:
// TODO(legacy): Don't simplify "hidden" fields for now.
"_foo": 3

// Issue #294
"\("x")": "x"

x: {
@tag0(foo)
r1: baz1
Expand Down

0 comments on commit d05ea95

Please sign in to comment.