Skip to content

Commit 4448203

Browse files
committed
Use 8-bit encoding for external syntax of BYTES.Bytes
1 parent 07d9bc6 commit 4448203

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

kore/src/Kore/Builtin/InternalBytes.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ patternVerifierHook =
149149
patternVerifierWorker external =
150150
case externalChild of
151151
StringLiteral_ literal -> do
152-
bytesValue <- Builtin.parseString Encoding.parseBase16 literal
152+
bytesValue <- Builtin.parseString Encoding.parse8Bit literal
153153
(return . InternalBytesF . Const)
154154
InternalBytes { bytesSort, bytesValue }
155155
_ -> Kore.Error.koreFail "Expected literal string"

kore/src/Kore/Builtin/InternalBytes/InternalBytes.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ asTermLike
9696
asTermLike InternalBytes { bytesSort, bytesValue } =
9797
mkDomainValue DomainValue
9898
{ domainValueSort = bytesSort
99-
, domainValueChild = mkStringLiteral $ Encoding.toBase16 bytesValue
99+
, domainValueChild = mkStringLiteral $ Encoding.decode8Bit bytesValue
100100
}
101101

102102
internalize

kore/test/Test/Kore/Builtin/InternalBytes.hs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,14 @@ test_InternalBytes =
603603
mkDomainValue
604604
$ DomainValue bytesSort
605605
$ mkStringLiteral "00"
606+
expect = Right $ asInternal "00"
607+
actual = verifyPattern (Just bytesSort) unverified
608+
assertEqual "" expect actual
609+
, testCase "\\dv{Bytes{}}(\"\x00\")" $ do
610+
let unverified =
611+
mkDomainValue
612+
$ DomainValue bytesSort
613+
$ mkStringLiteral "\x00"
606614
expect = Right $ asInternal "\x00"
607615
actual = verifyPattern (Just bytesSort) unverified
608616
assertEqual "" expect actual

0 commit comments

Comments
 (0)