internal/core/export: fix bytes printing bug
Change-Id: If8c7e78805c5f21b188cf28bc4c58d12b67842c0
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/7847
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/internal/core/export/testdata/adt.txtar b/internal/core/export/testdata/adt.txtar
index 7d741c1..c29a70f 100644
--- a/internal/core/export/testdata/adt.txtar
+++ b/internal/core/export/testdata/adt.txtar
@@ -12,6 +12,8 @@
foo: C.name
}
+bytes: '\xeb \x1a\xf5\xaa\xf0\xd6\x06)'
+
c1: mystrings.Contains("aa", "a")
s1: """
@@ -95,8 +97,9 @@
foo: C.name
}
}
-c1: mystrings.Contains("aa", "a")
-s1: """
+bytes: '\xeb \x1a\xf5\xaa\xf0\xd6\x06)'
+c1: mystrings.Contains("aa", "a")
+s1: """
multi
\(bar)
line
@@ -153,6 +156,7 @@
[d2 foobar]
[d2 foobar name]
[d2 foobar foo]
+[bytes]
[c1]
[s1]
[l1]
diff --git a/internal/core/export/value.go b/internal/core/export/value.go
index a5a6ae2..50e8c48 100644
--- a/internal/core/export/value.go
+++ b/internal/core/export/value.go
@@ -257,7 +257,7 @@
if b := extractBasic(orig); b != nil {
return b
}
- s := literal.String.WithOptionalTabIndent(len(e.stack)).Quote(string(n.B))
+ s := literal.Bytes.WithOptionalTabIndent(len(e.stack)).Quote(string(n.B))
return &ast.BasicLit{
Kind: token.STRING,
Value: s,