Skip to content

fix(lib): cast NULL in ts_subtree_children macro#5343

Merged
amaanq merged 1 commit intotree-sitter:masterfrom
lucasew:fix/explicit-cast
Feb 21, 2026
Merged

fix(lib): cast NULL in ts_subtree_children macro#5343
amaanq merged 1 commit intotree-sitter:masterfrom
lucasew:fix/explicit-cast

Conversation

@lucasew
Copy link
Contributor

@lucasew lucasew commented Feb 18, 2026

Explicitly casting NULL to (Subtree *) in the ternary expression ensures
type consistency. This resolves ambiguous type inference issues encountered
by strict static analysis tools and C-to-Go transpilers (like ccgo).

Signed-off-by: lucasew lucas59356@gmail.com

@lucasew
Copy link
Contributor Author

lucasew commented Feb 18, 2026

This looks like the hashbang situation from NixOS users. I am working on using ccgo from modernc to compile this into Go code along with the grammars. I got success in that with pretty printing the AST in a fully static Golang binary with about 4MB. That compiler found some issues dealing with this edge case.

@tree-sitter tree-sitter deleted a comment from dianecloud Feb 21, 2026
@amaanq
Copy link
Member

amaanq commented Feb 21, 2026

CI is failing across the board @lucasew

Explicitly casting NULL to (Subtree *) in the ternary expression ensures
type consistency. This resolves ambiguous type inference issues encountered
by strict static analysis tools and C-to-Go transpilers (like ccgo).

Signed-off-by: lucasew <lucas59356@gmail.com>
@amaanq amaanq merged commit 4e9fede into tree-sitter:master Feb 21, 2026
14 checks passed
@clason clason added the ci:backport release-0.26 Backport label label Feb 21, 2026
@tree-sitter-ci-bot
Copy link

Successfully created backport PR for release-0.26:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants