Skip to content
This repository has been archived by the owner on Mar 8, 2020. It is now read-only.

Decode is not the inverse of encode #197

Open
ncordon opened this issue Oct 28, 2019 · 0 comments
Open

Decode is not the inverse of encode #197

ncordon opened this issue Oct 28, 2019 · 0 comments
Labels

Comments

@ncordon
Copy link
Member

ncordon commented Oct 28, 2019

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.

@ncordon ncordon added the bug label Oct 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant