X Tutup
The Wayback Machine - https://web.archive.org/web/20250603040548/https://github.com/github/semantic/issues/484
Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Leaf nodes in precise AST sometimes have unnecessary contents #484

Closed as not planned
@patrickt

Description

@patrickt

Ported from tree-sitter/haskell-tree-sitter#136.

In Python, true and false are matched by rules of the same name. The TH generates leaf datatypes for these containing Text, like so:

newtype True = True { bytes :: Text }

However, as there’s no way for the grammar to ever produce a parse tree for which bytes is something other than "true", this is superfluous and could be elided for improved performance and a closer match to the language’s semantics. Otherwise put, all values of True should really be the same, but the Text field means that the datatype doesn’t enforce that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ast:codegenBugs in Template Haskell AST generation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup