Decode is not the inverse of encode
ncordon opened this issue · 0 comments
ncordon commented
This should hold for the binary format, but a minimal example shows that the bytes are not preserved:
from bblfsh import *
file = "fixtures/test.py"
client = BblfshClient("localhost:9432")
ctx = client.parse(file)
root = ctx.root.get()
pyCtx = context(root)
originalBytes = ctx._response.uast
encodedBytes = pyCtx.encode(fmt = 0)
# This is false
originalBytes == encodedBytes
# This is true
decode(encodedBytes).load() == root
For more context, check out scala-client#127. Problem may lie here, where we are not returning NODE_UINT
in any case. In the scala-client
we do return NODE_UINT
for some cases.