Skip to content

Read syntax [, saveAs(string)] as defining saveAs', not saveas' - #392

Merged
jbearak merged 1 commit into
mainfrom
fix/mixed-case-option-locals
Nov 5, 2026
Merged

jbearak merged 1 commit into
mainfrom
fix/mixed-case-option-locals

Conversation

@jbearak

@jbearak jbearak commented Nov 5, 2026

Copy link
Copy Markdown
Owner

syntax [, saveAs(string)] defines the local saveAs, but Sight lowercased the whole option name to saveas. So `saveAs' was reported as an undefined macro, and `saveas' was accepted. In StataMP 18, syntax lowercases only an option's leading capitals: saveAs and MyOption define saveAs and myOption, and Stata rejects myoption(x) for myOption(string).

syntax_option_local_name now takes the local from syntax_option_spelling (#391). Recording a program's local()-style options also matches that exact local. So after MyLocal(string), c_local `myLocal' creates a macro at the call. After Cache(string), c_local `Cache' does not, because that local is cache and Cache is undefined in Stata.

Several property tests paired syntax, Cache(name) with c_local `Cache' and expected cache. They now c_local the local Stata actually defines.

Proof: the local names were probed on StataMP 18. Two new regression tests (saveAs in tests/unit/analyzer.test.ts, MyLocal in tests/unit/command-macro-writes.test.ts) fail without the fix. Typecheck, lint, and bun test ./tests pass (9670 tests).

Reviewed with sol-loop: 1 round with gpt-6.1-sol. Sol verdict: approved

Created with Claude Opus 5.5 in T3 Code.

Stata lowercases only a syntax option's leading capitals: saveAs(string)
and MyOption define `saveAs' and `myOption' (StataMP 18). Sight
lowercased the whole name, so it reported `saveAs' as undefined and
accepted `saveas'. A program's local()-style options now match the
exact local too, so `c_local `myLocal'' after MyLocal(string) creates
a macro, while `c_local `Cache'' after Cache(string) does not.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

Next included review available in 24 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available. Your 65 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Team
  • Run ID: 387a29da-017f-4fb9-890b-a9f083739f28
Commits

Reviewing files that changed from the base of the PR and between b92a853 and 071c1f2.

Files selected for processing: 7

  • src/analyzer/command-macro-writes.ts
  • src/analyzer/index.ts
  • tests/property/program-macro-creation-correctness.prop.test.ts
  • tests/property/program-pattern-detection-macro-creation.prop.test.ts
  • tests/property/syntax-command-analyzer.prop.test.ts
  • tests/unit/analyzer.test.ts
  • tests/unit/command-macro-writes.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@jbearak
jbearak merged commit 630bd4d into main Nov 5, 2026
16 checks passed
@jbearak
jbearak deleted the fix/mixed-case-option-locals branch November 5, 2026 21:30
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.

1 participant