Skip to content

Better error message for wrong-cased XML tags - #1793

Merged
TwitchBronBron merged 3 commits into
masterfrom
xml-tag-casing-diagnostic
Sep 8, 2026
Merged

TwitchBronBron merged 3 commits into
masterfrom
xml-tag-casing-diagnostic

Conversation

@TwitchBronBron

@TwitchBronBron TwitchBronBron commented Sep 8, 2026 •

Copy link
Copy Markdown
Member

Roku requires <children>, <interface>, <script> etc. to be lower case. Wrong-cased tags used to fall through the parser's exact-case matching and report a generic Unexpected tag 'Children', which doesn't hint at the real problem. Now they report Tag 'Children' must be all lower case. Use 'children' instead.

Supersedes #1540, which went stale (its diagnostic code 1143 is now taken).

  • New xmlTagWrongCase diagnostic, code 1157
  • SGParser matches structural tags case-insensitively, so wrong-cased tags build a real AST node instead of hitting the unexpected-tag path
  • XmlFileValidator.validateTagCasing reports the casing, alongside the existing validateTagClosings

Two deliberate choices:

  • Validation skips the contents of <children> — node names in there are author-defined and legitimately mixed-case.
  • Transpile still emits the tag verbatim, so this reports the problem without rewriting the author's markup (there's a test pinning that).

Fixes #1399.

Roku requires structural tags like `<children>`, `<interface>` and `<script>`
to be all lower case. Previously a wrong-cased tag fell through the parser's
exact-case matching and surfaced as a generic "Unexpected tag 'Children'",
which doesn't hint at the actual problem.

The parser now matches structural tags case-insensitively so they build the
correct AST node, and XmlFileValidator reports the casing separately. Transpile
still emits the tag verbatim, so this reports the problem without silently
rewriting the author's markup.

Fixes #1399.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@TwitchBronBron TwitchBronBron changed the title Add specific diagnostic for wrong-cased XML structural tags Better error message for wrong-cased XML tags Sep 8, 2026
@TwitchBronBron
TwitchBronBron enabled auto-merge (squash) September 8, 2026 17:11
@TwitchBronBron
TwitchBronBron merged commit 24df692 into master Sep 8, 2026
10 checks passed
@TwitchBronBron
TwitchBronBron deleted the xml-tag-casing-diagnostic branch September 8, 2026 18:36
TwitchBronBron added a commit that referenced this pull request Sep 9, 2026
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>
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.

Better messaging for incorrect casing for <children>

1 participant