Repository navigation
Keep file names out of variable references, warn on a forvalues range after version N:, and resolve graph working directories and do-file arguments like Stata - #413
Merged
Conversation
…ersion N:, and fix graph working directories and arguments
Contributor
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. Next included review available in 50 minutes. View limit details
|
This was referenced Nov 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An audit of
v0.15.1..mainbefore the stable release turned up four bugs in recent changes:generate dta = 1andsave old.dta, references todtaincluded thedtainold.dta. The cause was the operator check, which readoldas the operatorso,l,d. Now a.namedoes not count when it is part of a file name: a word afterusing, or a word before the first comma ofsave,use,do,run,copyand similar commands. Path-like words (dir/old.dta,../x/old.dta) are covered too. A parenthesized operator argument counts only after an operator, soib(first).fooandL(1/3).foomatch andr(N).foodoes not. The operator-word pattern is also stricter: one optional factor operator, then time-series operators. Everything Find references to a variable inside factor-variable terms such as i.foo and _b[2.foo] #410 matched (i.,c.,ib3.,ibn.,L2.,LD., factor interactions,_b[]/_se[]) still matches.version 16: forvalues i = 3/1 {got no empty-range warning (from Warn about a forvalues range that runs no times, such as 3/1, and suggest the countdown #407). Command-position detection did not skip aversion #:prefix. It does now, including when combined withcapture/quietly/noisilyand their colon forms.sight graph --jsonlost a parent's working directory for a grandchild (from Add sight parse --json and sight graph --json, so other tools can read Sight's view of Stata code #347). Graph used only explicit backward directives to find an inherited working directory. It now does whatsight checkdoes: it registers every file's calls in a dependency graph, then resolves each file's working directory with auto-discovered parents. In the repro,work/jobs/child.do'sdo grand.donow resolves towork/grand.do, and the only entry point ismain.do. Graph follows check where check stops, too: inheritance is directive-based and one auto-discovered level deep. A four-level chain and a parent's in-scriptcd(notsight: cd) still leave a grandchild unresolved in both, by design (see docs/cross-file.md).sight graphdropped do-file arguments that start withif(from Add sight parse --json and sight graph --json, so other tools can read Sight's view of Stata code #347). Arguments came from the parser's varlist, so anything it put in a qualifier, weight,using,=expor options was lost. Arguments are now every word after the file name, in source order, as Stata passes them toargs. Words are split at spaces, and touching tokens form one word.do child.do if price > 100gives["if","price",">","100"]. Theargumentsdoc in docs/cli.md is updated. Before, tokens glued to a macro were split (`a'bgave two items). Now they are one word, which is what Stata passes.Proof: each item has a regression test that fails on
mainand passes here. The repros change from:["2:10","3:10"]→["2:10"];target: null, resolution: "missing"→target: "work/grand.do", resolution: "exact";[]→["if","price",">","100"].check:line-endings,typecheck,bun test ./tests(9867 pass, 0 fail) andlinteach pass on their own. Thecli-jsongolden fixtures are unchanged.Created with Claude Opus 5.5 in Claude Code.