Skip to content

Mirror #3226: parse TS variance annotations - #13

Merged
inth3shadows merged 6 commits into
mainfrom
mirror/3226
Nov 6, 2026
Merged

inth3shadows merged 6 commits into
mainfrom
mirror/3226

Conversation

@inth3shadows

Copy link
Copy Markdown
Owner

Mirrors upstream colbymchenry#3226 (commits 0014466 and 6e4354d, branch fix/ts-variance) into fork main. It also:

Differential result for the patched wasm (before --update, exit 0)

corpus      files  DIVERGENT  new  worse  improved  now-agree
effect       2056        185    0      0        62         54
zod           515          0    0      0         0          4
excalidraw    695          5    0      0         0          0
vscode      11267         11    0      0         0          0
local          25          5    0      0         0          1   (variance.ts)

These numbers match colbymchenry#3226's own measurement:

  • Effect goes from 239 to 185 files with errors.
  • Zod goes from 4 to 0.
  • VS Code and Excalidraw are unchanged.

Verified locally on mirror/3226

  • tsc --noEmit exits 0.
  • The full suite at --maxWorkers=4 gives 10529 passed and 1 failed. The failure is the ui-server-api "busiest symbol" timing assertion, 123ms against a 100ms limit under load. It passes 2/2 when run alone.
  • typescript-variance-parse.test.ts passes 7/7.

After this merges, re-index TypeScript projects.

…n out T>`)

Vendor tree-sitter-typescript v0.23.2 with a grammar patch, regenerated
with tree-sitter-cli 0.25.10, for both the wasm and the kernel (which now
compiles the same C instead of the crate). `type_parameter` takes an
optional `in` / `out` / `in out`, with `const` on either side; `out` stays
usable as a parameter name (upstream colbymchenry#364's rule + brajevicm@9fcaa13).

Known limit: a type or JSX tag literally named `out`/`in` right after an
expression `<` (`<out>x`, `<out>…</out>`) no longer parses; accepting `out`
as a type name everywhere instead broke `[out: T]` tuple labels.

Effect: 239 -> 185 files with a parse error, 54 newly clean, none newly
broken; Zod 4 -> 0. VS Code src/ and Excalidraw (.ts/.tsx) parse to
identical trees. Provenance in docs/grammars/tree-sitter-typescript.md.
…g claims

Review follow-ups on the variance patch: assert tree shape (call_expression
type arguments, mapped-type and type-predicate names, tuple labels) rather
than only hasError; make the extraction test fail without the patch; scope
the indexing setup to the test that uses it; drop the next-line-method guard
(it belongs with the colbymchenry#335 scanner change). The changelog no longer names
Effect files that colbymchenry#335 still blocks, and the docs list the `<out.Provider>`
tsx limit, the real over-acceptance (`<out in>`), and that the second
`const` is ours rather than colbymchenry#364's.
The patched grammar fixes 54 Effect files, all 4 Zod files and the
variance.ts fixture; Excalidraw and VS Code are unchanged; no new errors.
@inth3shadows
inth3shadows merged commit d531fff into main Nov 6, 2026
1 check passed
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