Skip to content

Fix associativity resolution with mixed shift precedences - #5796

Merged
clason merged 1 commit into
release-0.26from
backport-5782-to-release-0.26
Jul 27, 2026
Merged

clason merged 1 commit into
release-0.26from
backport-5782-to-release-0.26

Conversation

@tree-sitter-ci-bot

Copy link
Copy Markdown

Description

Backport of #5782 to release-0.26.

…hift

A SHIFT/REDUCE conflict can bundle several shift interpretations with
different precedences against a single reduce. `handle_conflict` weighed them
with only `shift_is_less` and `shift_is_more`, so a lone lower-precedence
shift set `shift_is_less` and the REDUCE won outright, even when another
interpretation tied the REDUCE in precedence and the REDUCE was declared
right-associative. That tie's associativity should have won by shifting, so a
right-associative rule silently became left-associative as soon as an
unrelated lower-precedence rule was added to the grammar.

Track the equal-precedence case explicitly, and in the reduce-wins branch
shift instead when a tying interpretation exists and the reduce actions are
purely right-associative.

Co-authored-by: Will Lillis <[email protected]>
(cherry picked from commit 0900f84)
@clason
clason merged commit 4b7e2c9 into release-0.26 Jul 27, 2026
20 checks passed
@clason
clason deleted the backport-5782-to-release-0.26 branch July 27, 2026 06:30
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
tree-sitter 0.26.12

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.<details>
  <summary>release notes</summary>
  <pre>## What's Changed
* fix(generate): fold case-insensitive patterns ourselves by @WillLillis in tree-sitter/tree-sitter#5761
* fix(query): keep the trailing anchor when a zero-matched quantifier is anchored on both sides by @tree-sitter-ci-bot[bot] in tree-sitter/tree-sitter#5764
* fix(templates): add C source files to Python sdist by @WillLillis in tree-sitter/tree-sitter#5765
* fix(init): don't lowercase repository url by @tree-sitter-ci-bot[bot] in tree-sitter/tree-sitter#5768
* fix(highlight): use `std::sync::OnceCell` for various loader fields by @WillLillis in tree-sitter/tree-sitter#5785
* fix(parser): restart recovery for invalid tokens in the error state by @tree-sitter-ci-bot[bot] in tree-sitter/tree-sitter#5792
* Fix associativity resolution with mixed shift precedences by @tree-sitter-ci-bot[bot] in tree-sitter/tree-sitter#5796
* fix(parser): fix parsing bug repeat operator by @tree-sitter-ci-bot[bot] in tree-sitter/tree-sitter#5829
* release v0.26.12 by @clason in tree-sitter/tree-sitter#5831


**Full Changelog**: https://github.com/tree-sitter/tree-sitter/compare/v0.26.11...v0.26.12</pre>
  <p>View the full release notes at <a href="/web-api/iframe-proxy?url=https://github.comhttps://github.com/tree-sitter/tree-sitter/releases/tag/v0.26.12">https://github.com/tree-sitter/tree-sitter/releases/tag/v0.26.12</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!16260
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants