Skip to content

Commit 039fb59

Browse files
committed
internal/core/export: fix bytes printing bug
Change-Id: If8c7e78805c5f21b188cf28bc4c58d12b67842c0 Reviewed-on: https://cue-review.googlesource.com/c/cue/+/7847 Reviewed-by: CUE cueckoo <[email protected]> Reviewed-by: Marcel van Lohuizen <[email protected]>
1 parent 64434c4 commit 039fb59

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

internal/core/export/testdata/adt.txtar

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ d2: C="foo\(bar)": {
1212
foo: C.name
1313
}
1414

15+
bytes: '\xeb \x1a\xf5\xaa\xf0\xd6\x06)'
16+
1517
c1: mystrings.Contains("aa", "a")
1618

1719
s1: """
@@ -95,8 +97,9 @@ d2: {
9597
foo: C.name
9698
}
9799
}
98-
c1: mystrings.Contains("aa", "a")
99-
s1: """
100+
bytes: '\xeb \x1a\xf5\xaa\xf0\xd6\x06)'
101+
c1: mystrings.Contains("aa", "a")
102+
s1: """
100103
multi
101104
\(bar)
102105
line
@@ -153,6 +156,7 @@ y1: {
153156
[d2 foobar]
154157
[d2 foobar name]
155158
[d2 foobar foo]
159+
[bytes]
156160
[c1]
157161
[s1]
158162
[l1]

internal/core/export/value.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ func (e *exporter) bytes(n *adt.Bytes, orig []adt.Conjunct) *ast.BasicLit {
257257
if b := extractBasic(orig); b != nil {
258258
return b
259259
}
260-
s := literal.String.WithOptionalTabIndent(len(e.stack)).Quote(string(n.B))
260+
s := literal.Bytes.WithOptionalTabIndent(len(e.stack)).Quote(string(n.B))
261261
return &ast.BasicLit{
262262
Kind: token.STRING,
263263
Value: s,

0 commit comments

Comments
 (0)