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
Description
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.