child_by_field_* can return a grandchild through a visible alias of a hidden rule
Author: mgsloanCreated Sep 15, 2026Updated Sep 15, 2026
AI Policy
- I have read the AI Policy and this issue complies with it.
Problem
For:
type T=typeof a.btree-sitter parse --cst --no-ranges has this for typeof a.b:
type_query
"typeof"
member_expression
object: identifier `a`
"."
property: property_identifier `b`type_query.child_by_field_name("object") should return None, but instead it returns the identifier. The bug also affects child_by_field_id.
Steps to reproduce
This test generated by Codex+Astra has a synthetic grammar involving an alias of a hidden rule that has fields.
I have not generated a fix. I can do so if that would be helpful. Kindly let me know
Expected behavior
Field lookup should never return a grandchild within the visible tree.
Tree-sitter version (tree-sitter --version)
1b8407d1e718f2a26e2886c03cc55622d8d1d7bd
Operating system/version
Debian
Source: tree-sitter/tree-sitter