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

Roles are sorted in encoding step but not in decoding one #431

@ncordon

Description

@ncordon

A node with roles like:

Visibility, World, Declaration, Type

would be encoded as:

Declaration, Type, Visibility, World

due to this line which is code called by libuast. We should probably move the sorting to after the transformations step (as suggested by @creachadair and @dennwc) to avoid having decoding and encodings (when we parse a tree and we just decode it for example, then if we encode and decode back we end up with different orders).

Reproducible example, using scala-client:

import org.bblfsh.client.v2.BblfshClient, BblfshClient._

// This file is in scala-client repo
val fileName = "src/test/resources/Tiny.java"
val fileContent = Source.fromFile(fileName).getLines.mkString("\n")
val resp = client.parse(fileName, fileContent)
val ctx: ContextExt = resp.uast.decode()
val tree = ctx.root()
val bytes = ctx.encode(tree, fmt)
val decoded = BblfshClient.decode(bytes, fmt)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions