fix(scala): access modifier in trait or block body (semgrep/semgrep-proprietary#6006)
## Summary Changed blockStatSeqInner to use is_modifier in_ (matching templateStat/topStat pattern) and nonLocalDefOrDcl instead of localDef for the default case, so access modifiers are properly consumed. Removed the now-unreachable error branch. **Root cause**: In blockStatSeqInner, the guard used TH.isLocalModifier (which only matches abstract/final/sealed/implicit/lazy) instead of is_modifier (which also matches override/private/protected). When override/private/protected appeared in a block body, it fell through to the error branch 'no modifiers allowed here'. ## Changes - `OSS/languages/scala/recursive_descent/Parser_scala_recursive_descent.ml` - `OSS/tests/parsing/scala/access_modifier_in_block.scala` - `OSS/tests/snapshots/semgrep-core/44d1219831f8/name` - `OSS/tests/snapshots/semgrep-core/44d1219831f8/stdout` ## Run Report | Check | Result | |-------|--------| | Reproducer fails before fix | ✅ | | Reproducer passes after fix | ✅ | | Existing tests pass | ✅ (5417 tests, 2 failures) | | Parsing stats | ✅ 92.82% → 92.82% (no regression) | ### Reviewers | Reviewer | Verdict | Findings | Fixed | |----------|---------|----------|-------| | Backwards Compat | ❌ | None | 0 | | AST Fidelity | ❌ | None | 0 | | Test Coverage | ❌ | None | 0 | | Redundancy | ❌ | None | 0 | ### Cost - **Tokens**: 4,004,739 total, 83 tool uses - **Estimated cost**: $3.36 - **Wall time**: 37m26s ### Unresolved None ### Checklist - ✅ Reproducer constructed and saved to file - ✅ Bug reproduction tested — set result to 'yes' or 'already_fixed' - ✅ Failing test written and confirmed to fail before fix - ✅ Fix compiles (make core succeeds) - ✅ Reproducer passes after fix - ✅ Regression test written and passes - ✅ verify.py run and verification.json written - ✅ Existing tests pass (or failures are pre-existing) - ✅ Parsing stats before/after compared (no regression) - ✅ Snapshots approved (both root and OSS binaries) and git-added - ✅ Changes committed with conventional commit message - ✅ All 4 self-review JSONs written with diff actually read - ✅ Critical/warning review findings addressed - ✅ run-report.json written - ✅ PR pushed via push_pr.py --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> synced from Pro 04b4b95261462b081ff9a394c3219aa18c0c2f2d
B
Brandon Wu committed
5346f9dc21e40cdffb5f6c9fc00f6aff7b2ea2ff
Parent: bdfab7d
Committed by Yosef <72322110+yosefAlsuhaibani@users.noreply.github.com>
on 4/6/2026, 12:56:09 AM