Skip to content

fix: honor an omitted tokeniser state - #1530

Open
anishpentyala wants to merge 2 commits into
alecthomas:masterfrom
anishpentyala:fix-omitted-tokeniser-state
Open

anishpentyala wants to merge 2 commits into
alecthomas:masterfrom
anishpentyala:fix-omitted-tokeniser-state

Conversation

@anishpentyala

Copy link
Copy Markdown
Contributor

TokeniseOptions.State is documented to default to root, but supplying a non-nil options struct without a state currently panics when the iterator is consumed. This affects calls that only set EnsureLF or Nested, as well as zero-value options.

Default the empty state on a copy of the options. This preserves the supplied flags, leaves explicit non-root states alone, and does not write to caller-owned options during concurrent reuse. Nil options keep their existing defaults.

Tests cover the method and helper APIs, LF conversion, nested lexing, explicit states, newline recovery, unchanged caller options and concurrent reuse. The regressions fail on the unchanged production code.

Local validation on Linux/amd64: full library suites on Go 1.25.0, 1.26.6 and 1.27.1; root-package race tests; go vet .; go build ./...; golangci-lint 2.15.0.

Validation scope: Linux/amd64 library and root-package checks only. Native Windows/macOS, nested command modules, full-repository race, hosted CI and generated-code CI were not verified locally. This is separate from pending coalescer PR #1508; that PR is unchanged.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-22T17:51:50.287459Z c023d73 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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