Skip to content

Merge master into v1 - #1795

Merged
TwitchBronBron merged 23 commits into
v1from
merge-master-into-v1
Sep 9, 2026
Merged

Merge master into v1#1795
TwitchBronBron merged 23 commits into
v1from
merge-master-into-v1

Conversation

@TwitchBronBron

@TwitchBronBron TwitchBronBron commented Sep 8, 2026

Copy link
Copy Markdown
Member

Brings v1 up to date with every master commit through 0.73.3. Conflicts were resolved in v1's favor architecturally, but each feature was re-implemented against v1's APIs rather than dropped.

Ported from master

Worth a reviewer's attention

  • master's whitespace fast-path skipped addToken to avoid allocating a Token it discards. In v1 addToken is also what routes a token into leadingTrivia, so skipping it silently dropped all whitespace trivia (20 test failures). Kept the allocation, took only the interning half.
  • Modifies default max worker thread logic to be only as much as memory allows #1798 rewrote WorkerPool around master's simpler worker tracking. v1 has an isDead crashed-worker feature master lacks, so only getDefaultMaxWorkerThreads was ported, on top of v1's tracking — taking master's file wholesale would have deleted that feature.
  • @typescript-eslint/no-unsafe-argument is warn here, not error. Master enabled it after cleaning up v0's call sites; v1's rewrites carry ~76 more violations that were never part of that cleanup. TODO left in .eslintrc.js.
  • Three tests arrived from master asserting v0 behavior v1 changed deliberately: Comment tokens are trivia rather than emitted, getReferences returns [] rather than null, and the NamespacedVariableNameExpression chain step no longer exists. Updated to v1's contract, reasoning inline.

Breaking changes

  • getDefinition returns Array<Location | LocationLink> instead of Location[] (Program, BrsFile, LspProject, Project, ProjectManager, WorkerThreadProject, ProvideDefinitionEvent.definitions). Inherent to Add generic go-to-definition for file path strings in BRS/BS/XML files #1648. Pushing a Location still works; reading results now needs narrowing.
  • AliasStatement.value narrowed to VariableExpression | DottedGetExpression — master's abstract clone(): Expression made the old Expression field fail to compile against its own constructor. Only breaks code that was already building invalid AST.
  • xml-tag-wrong-case is a new Error-severity diagnostic, so projects with <Children>/<Component> that previously built clean will report errors. Suppressible via diagnosticFilters.

Verificationnpm run test:nocover: 4503 passing, 0 failing (v1 baseline was 4373, so all 130 new tests from master run). npx tsc --noEmit and npm run lint clean. Verified by hand that wrong-cased XML round-trips through transpile unchanged, and that continuegoto codegen is correct for nested loops, empty bodies, and continue inside an if.

🤖 Generated with Claude Code

chrisdp and others added 19 commits September 3, 2026 16:14
…1712)

Co-authored-by: Bronley Plumb <bronley@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Fixes all 183 violations across 35 files by either giving values their
real types, narrowing existing `as any` casts to specific types, or
routing generic event forwarding through the underlying emitter
directly instead of a call-site cast. A few genuinely unavoidable
any[] spreads (blocked from using .apply() by prefer-spread) are left
as scoped, commented eslint-disable-next-line suppressions.

Also fixes two related bugs uncovered along the way:
- walkArray's optional `filter` callback had a stray inner `<T>` that
  shadowed the outer generic, silently widening every filtered item
  to `any` instead of the array's real element type.
- Several event-forwarding `on()` implementations (Project,
  ProjectManager, DocumentManager, WorkerThreadProject) called
  handlers without awaiting/voiding them, silently swallowing
  unhandled promise rejections.

The highest-leverage single fix: AstNode's abstract `clone()` had no
declared return type at all, which alone accounted for 60+ of the 183
errors once no-unsafe-argument was enabled. Giving it (and Statement's
and Expression's overrides) an explicit return type fixed the majority
of the parser/AST files in one change.

Resolves #457

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Review pass on top of #1785. Two goals: revert every change that altered
runtime behavior, and cut the eslint-disable count where the rule can be
satisfied by a better type instead.

Reverted to master's logic (these were behavior changes, not type fixes):
- BusyStatusTracker.once() / DocumentManager.once(): restore the on()/off()
  closure instead of calling the emitter directly
- on() in DocumentManager, Project, WorkerThreadProject, ProjectManager:
  drop the `void handler(...)` wrapper. Not awaiting async handlers is a
  real bug, but fixing it changes rejection behavior and belongs in its
  own PR
- BrsFile: restore the `arg.name` and `calleeName` duck-types. Narrowing
  them to VariableExpression drops DottedGetExpression, so `person.name`
  and `m.top.id` args silently lost their text. Added a regression test

Fewer suppressions, no logic change:
- pure-passthrough rest params typed `unknown[]` rather than `any[]`, which
  the rule accepts without a disable (and matches @rokucommunity/logger's
  own `debug(...messages: unknown[])`) - Logger, Scope, XmlFile, Sequencer
- `as never` instead of `as any` for the two finalizeClone propsToReparent
  arrays whose constraint genuinely resolves to never
- catch-all emit() overload so the widened event name needs no cast
- Program.addOrReplaceFile: collapse the two identical branches

Net: 12 disables (10 of them in the lsp event wrappers, where a widened
`string` can't match a literal-string overload and no type fixes it).
Worth considering an .eslintrc override for src/lsp/** instead.

tsc clean, lint clean, 3043 passing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Add a type-predicate overload to `AstNode.findAncestor` so a guard matcher
infers its own result type, removing the redundant type argument from ~22
call sites. The pre-existing boolean-matcher signature is retained as a
second overload, so explicit type arguments still work unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
# Conflicts:
#	src/Program.ts
#	src/Scope.ts
#	src/parser/AstNode.spec.ts
#	src/parser/AstNode.ts
#	src/parser/Expression.ts
#	src/parser/Statement.ts
#	src/validators/ClassValidator.ts
`PreceedingRegexTypes` gates where a `/` may begin a regex literal.
`TemplateStringExpressionBegin` was missing, so any regex opening a
template string expression lexed as division instead -- and a `}` in a
character class then ended the expression early. `Comma` was missing
for the same reason, breaking regexes in array/argument literals.

Neither token can precede division, so adding them is unambiguous.
Also drops a duplicate `Throw` entry.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: TwitchBronBron <2544493+TwitchBronBron@users.noreply.github.com>
Co-authored-by: Bronley Plumb <bronley@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
#1648)

Co-authored-by: Bronley Plumb <bronley@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: rokucommunity-bot <93661887+rokucommunity-bot@users.noreply.github.com>
Co-authored-by: Bronley Plumb <bronley@gmail.com>
TwitchBronBron and others added 4 commits September 9, 2026 07:01
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: rokucommunity-bot <93661887+rokucommunity-bot@users.noreply.github.com>
Ports every master commit since 0.73.1 (through 0.73.3). Where master's code
collided with v1's rewrites, v1's architecture wins and the change was
re-implemented against it rather than taken verbatim.

Features ported:
- `continue` transpiles to a goto label for firmware below 11.5 (#489)
- go-to-definition for file path strings in BRS/BS/XML (#1648)
- `isTerminal`/`previousInChain` on AstNode (#1788)
- nested curly braces in template strings (#1539)
- regex literals after `${` and `,` (#1789)
- wrong-cased XML tag diagnostic (#1793)
- duplicate/crashing "find all references" fix (#1791)
- duplicate sourceMappingURL fix (#1786)
- findAncestor type-guard inference (#1787)
- lexer token-text interning (#1712)
- memory-aware default for max worker threads (#1798)
- js-yaml override bumped to ^4.3.2 (#1796)

Notable adaptations:
- master's whitespace fast-path skipped `addToken`, which in v1 is also what
  routes a token into `leadingTrivia`. Kept the Token allocation (trivia depends
  on it) and took only the interning half of that optimization.
- #1798 rewrote WorkerPool around master's simpler worker tracking. v1 has an
  `isDead` crashed-worker feature master lacks, so only the
  `getDefaultMaxWorkerThreads` logic was ported, on top of v1's tracking.
- `no-unsafe-argument` is a warning, not an error: master enabled it after
  cleaning up v0's call sites, and v1's rewrites carry ~76 more that were never
  part of that cleanup.
- three tests from master assert v0 behavior v1 changed on purpose
  (Comment tokens are trivia, `getReferences` returns `[]` not null, and the
  NamespacedVariableNameExpression chain step is gone). Updated to v1's contract.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@TwitchBronBron
TwitchBronBron merged commit 44f1c8c into v1 Sep 9, 2026
11 checks passed
@TwitchBronBron
TwitchBronBron deleted the merge-master-into-v1 branch September 9, 2026 15:02
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.

5 participants