Skip to content

[mesi] Remove dead branch in EsiParserConfig.DecreaseMaxDepth#157

Merged
s2x merged 1 commit into
mainfrom
fix/mesi-dead-branch-decreasemaxdepth
May 6, 2026
Merged

[mesi] Remove dead branch in EsiParserConfig.DecreaseMaxDepth#157
s2x merged 1 commit into
mainfrom
fix/mesi-dead-branch-decreasemaxdepth

Conversation

@s2x
Copy link
Copy Markdown
Contributor

@s2x s2x commented May 6, 2026

Closes #112

Summary

  • Removed unreachable else branch in DecreaseMaxDepthMaxDepth is uint, so the else (c.MaxDepth = 0) was a no-op
  • Changed c.MaxDepth = c.MaxDepth - 1 to idiomatic c.MaxDepth--
  • Added boundary test case: math.MaxUint → math.MaxUint - 1 to document no-wraparound intent

All existing tests pass.

MaxDepth is uint, so the else branch (c.MaxDepth = 0) was unreachable
— c.MaxDepth > 0 is false only when c.MaxDepth == 0, making the
assignment a no-op. Simplify to c.MaxDepth-- guarded by the existing
check.

Add boundary test for math.MaxUint to document no-wraparound intent.
@s2x s2x merged commit c195167 into main May 6, 2026
4 checks passed
@s2x s2x deleted the fix/mesi-dead-branch-decreasemaxdepth branch May 6, 2026 17:50
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.

[mesi] Dead branch in EsiParserConfig.DecreaseMaxDepth

1 participant