Skip to content

Align language checks, lowering and the runtime - #98

Open
devagrawal09 wants to merge 29 commits into
solidjs:mainfrom
devagrawal09:upstream/lang-fixes
Open

devagrawal09 wants to merge 29 commits into
solidjs:mainfrom
devagrawal09:upstream/lang-fixes

Conversation

@devagrawal09

Copy link
Copy Markdown
Collaborator

What and why

Make real relative JS modules win over the injected ./api, and erase declaration-only imports. Extend written .d.rx declarations with private aliases, generics, type imports and failure rows. Fix casts, computed keys, multiline chains, escapes, fragments and JSX spacing across the reference and Rust implementations.

Recover diagnostics independently across modules. Align rx-tsc with declaration-file precedence, source write types, and handler snapshots. Diagnose misplaced styles, statically shadowed typed boundaries, and unsupported action defaults. Add the fixed pure JavaScript prelude and detach store snapshots at action call time without changing ordinary JS argument identity. Block-function equations still instantiate; SNAPSHOT_ARGUMENT explains when to use an expression-bodied function instead.

This change includes checker and lowering parity in compiler CI. It does not include declaration generation, dev keys or the map.

Breaking changes

  • A real ./api takes precedence; an unresolved injected API with no implementation reports MISSING_TEST_API.
  • Corrected escape and JSX whitespace handling can change rendered text.
  • STYLE_SCOPE and DEAD_TYPED_BOUNDARY reject previously accepted shapes. The latter only fires when the inner fallback is statically inert.
  • Structured store arguments to actions retain their call-time state rather than following subsequent writes.

Verification

Check Result
Interpreter, Solid oracle, compiled scenarios Pass
TypeScript projection scenarios 202 pass
SSR/hydration 143 pass, 1 fail, 7 skipped; S-solid-28 observed a late hydration frame before its expected answer
Rust tests, Node-API, runtime Pass
Checker and projection parity 414/414 and 235/235
Lowering parity 209/239 after esbuild normalization across three targets; the exact 30 mismatches match the CI baseline

Questions for Ryan

  • Is the fixed pure prelude the right boundary, or should more names require foreign declarations?
  • Is static-fallback-only DEAD_TYPED_BOUNDARY the right level of proof for an error?
  • Does real-file precedence leave the injected API in the right role for tests and small examples?

… its line.

`e as T` is TypeScript's assertion: erased where the program runs, kept in the projection. A statement-bodied arrow that fails to parse is no longer re-read as a record, which blamed the handler's `let` with JS_LOCAL.
`source open := false` is already a boolean. Inside `{if open}` the read is `true`, and `open := false` was checked against that. The projection keeps the slot's type and checks the write against it.
The projection checks the import against the declaration, so a ref parameter or result is that type and not the accessor the implementation is written with. The compiled import is unchanged.
The read happens when the handler runs, and the branch may no longer hold. Snapshot into a local and narrow that. A check inside the handler still narrows its own snapshot.
…s an error.

CSS-2 already scopes a stylesheet to its own view, so Row stayed unstyled with no warning. STYLE_SCOPE names the other component and the fix: its own style, or a class map.
…has none.

n++ in a handler was reported as a generic parse error once the statement reading won outright. The expression reading's ASSIGNMENT hint is kept, and JS_LOCAL from re-reading the body as a record is not.
NoteList's stylesheet does not reach Row (CSS-2). .when and td were pruned; they belong on Row.
…eeps the value.

`out := s as Status` evaluated to undefined: the oracle's expression walk had no case for `as`. The checker walks through it too, so the read is still the operand.
…rt type.

The projection aliases the other declare namespace, not the sibling .ts.
The model marks that region shadowed by the inner one, so the map can draw it.
yumemi-thomas added a commit to yumemi-thomas/reactivescript that referenced this pull request Nov 28, 2026
…e backslash and kept the letter ("a\nb" was `anb`, "\x41" was `x41`), silently, since the emitters quote what the parser read and the crate and ref agreed. A quoted string and a template cook \n \t \r \b \f \v \0, quotes, \\, \xHH, \uHHHH (a surrogate pair is one character), \u{…}, line continuations, and a template's \r\n as \n; what a module refuses (a legacy octal, \8, missing hex digits, past 10FFFF, a quoted string past its line) is PARSE at the backslash, and so is a lone surrogate, which no Rust string holds. An attribute's quoted value stays JSX's text, uncooked (`pattern="\d+"`). Found by solidjs#98 (5fc18a6), whose scenario S-surface-15 follows. No program of examples/, eval/ or scenarios/ changes output or verdict.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
yumemi-thomas added a commit to yumemi-thomas/reactivescript that referenced this pull request Nov 28, 2026
… the text `null` (a leftover of DV-13's workaround), where the reference writes a fragment; and a fragment among an element's children is its children in both emitters, since Solid's DOM compiler refuses a fragment inside an element (`<p>end<></></p>` failed the reference's dom lowering). Found by solidjs#98 (675cd04). S-surface-16, on the interpreter, both compiled runners, the oracle, the served runner and crate.ts --lower. Changed: eval/results/board-probe-2026-11-17/probe2/apps/board-rx-opus-2 renders nothing where its two empty views showed `null`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
yumemi-thomas added a commit to yumemi-thomas/reactivescript that referenced this pull request Nov 28, 2026
…ween two nodes is read as Solid's compiler reads it (its trim_jsx_text, Babel's trimWhitespace): where it holds a line break, each later line's indentation and the lines of white space alone go and the rest are joined by a space, then every white-space run is one space. The parsers dropped a line's leading and trailing white space, which JSX keeps: `<span> · note</span>` lost its space, `{d} </label>` its trailing one. Both parsers read the whole run and give it one text node (spans.rs checks the node against its run as so read). Found by solidjs#98 (6ac4e3b). S-surface-17 on every runner. Frames that move: S-context-2 (`a-x.10 b-y.20`) and S-module-45 (`… m1 o`), whose programs write a space before a closing tag; output that moves: eval/results/r15prep/repro/keyed-checklist-reverts-selection.rx (`{it.t} </span>` keeps its space).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
yumemi-thomas added a commit to yumemi-thomas/reactivescript that referenced this pull request Nov 28, 2026
…ith `.name` or `?.` is the next step of the chain before it (a formatter's break of a long chain), in either scope, with comments and blank lines between; both parsers ended the declaration at the line break and refused the line (PARSE "expected a declaration or markup"). No line could begin so before, so no program changes meaning. Re-implemented from solidjs#98's d103f95 (its `as` and computed keys are not taken: 07, R2). S-surface-18 on every runner; no program of examples/, eval/ or scenarios/ changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
yumemi-thomas added a commit to yumemi-thomas/reactivescript that referenced this pull request Nov 28, 2026
…overing, as the editor does (CP-8e), reports each module that does not parse by the error a strict parse stops at (the message it always gave), and the checker's diagnostics of every module that imports none of those, even through another; one that imports one is not checked, as what the broken module declares is not known. It stopped at the first module that did not parse. `model`, `compile` and the builds still stop. Found by solidjs#98 (81aaa4a). compiler/tests/cli.rs check_reports_every_module_past_a_parse_error; no verdict of examples/, eval/ or scenarios/ changes (the reference has no command line).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
yumemi-thomas added a commit to yumemi-thomas/reactivescript that referenced this pull request Nov 28, 2026
…{ … }` body that is neither a block nor a record is refused by the reading that got further (a handler's `let k = 1` then `n++` was refused as the record a `{` could also begin, at the `let`: `JS_LOCAL` for a `let` that is in a handler); and `x++` / `x--` are ASSIGNMENT however they fail (`x +` and a sign that begins nothing, or `x - -…` at the next line), naming the source before the operator (`n += k` named `x`). ParseError carries where it stopped in the reference too. Found by solidjs#98 (3805aeb), re-implemented: our parser has no `stmt_err`. S-parse-hints gains three rejected variants (JS_LOCAL, PARSE and PARSE before); crate.ts and crate.ts --text agree on every program; no verdict of examples/, eval/ or scenarios/ changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
yumemi-thomas added a commit to yumemi-thomas/reactivescript that referenced this pull request Nov 28, 2026
…the projection let the view branch around a handler narrow its every read (TypeScript narrows a captured const), so `seen := detail.id` after an await, with another handler clearing `detail` in between, failed at run time with no diagnostic. A handler fires while its element exists, so before its first await the branch holds and the narrowing is sound (kept); the statements after one that awaits are now projected as a block that binds each source or equation they read again to its declared type (`{ const detail = __.now<__w_detail>(); … }`), in handlers and action bodies, in both projectors. Found by solidjs#98 (f4667d7), which reads every handler read unnarrowed and so also refuses the sound reads before an await. S-types-4 (TS18047 twice, the sound read accepted) on the types runner with ref and with the crate; crate.ts --project agrees on all 868 programs; every scenario's types as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
yumemi-thomas added a commit to yumemi-thomas/reactivescript that referenced this pull request Nov 28, 2026
…s stylesheet names, that its own markup does not have and another component of the module does, is an error: a component is its own view (CSS-2), so the rule styles nothing, and CSS-3 pruned it in silence. A part inside :global(…) and an at-rule's prelude are not judged; where an element computes its class from what is not a literal (or spreads), no class of that stylesheet is judged. examples/notes/ui.rx had two such rules (`td`, `.when` in NoteList's style, for Row's elements): moved into Row's own <style>. Found by solidjs#98 (a5e9030, 8b241fa), which judges classes only; re-implemented over the AST in both checkers (ref/src/style.ts, check.rs). S-surface-19, guide section; crate and ref agree on all 1713 programs. Verdicts that change (archived eval apps, each a real dead rule): eval/results/board-probe-2026-11-17/apps/board-rx-opus-2 (board.rx: `.card`, `.col`, `.selected` for Column; its main.rx), …/probe2/apps/board-rx-opus-2, …/probe3/apps/board-rx-opus-3 (App's style for four components), eval/results/round15-2026-11-16/apps/board-rx-opus-2 (column.rx `.report` for Report; board.rx, main.rx), …/board-rx-opus-4 (App's style). examples/notes now compiles with the rules applied.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
yumemi-thomas added a commit to yumemi-thomas/reactivescript that referenced this pull request Nov 28, 2026
…` that declares nothing, whose content is only catch-alls with fallbacks that cannot fail (text, literals, plain elements with literal attributes), besides markup that cannot fail and plain elements around them: the catch-all takes every failure first and sends nothing on, so the typed fallback never shows. A fallback that reads or renders a component can fail into the typed boundary and is not judged, nor is content beside the catch-all, nor `fallback(e: Panic)`. Re-implemented from solidjs#98 (4fa970a, caa132d: the narrow form the report recommends). S-fail-11 (its program shows the outer fallback through a failing inner fallback) on the interpreter, both compiled runners and the oracle; crate and ref agree on all 1718 programs; no program of examples/, eval/ or scenarios/ changes verdict.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
yumemi-thomas added a commit to yumemi-thomas/reactivescript that referenced this pull request Nov 28, 2026
…s#99 (stable dev declaration keys) and solidjs#100 (the map and keyed dev hot replacement), both by devagrawal09, weighed idea by idea without waiting for them to land (DEV-6: 22 ideas ranked by value to a .rx developer against cost, each taken, adapted, deferred or rejected with its reason), and the ones taken written as rules on this branch's design: a development build is the browser's build under the dev server and differs from the production lowering by one thing, each source's creating call under `__rt.key(key, shape, …)` (DEV-1); a key is `<module>|<scope>|<name>[#n]` and its shape a hash of the declaration's AST, from both emitters, not the model (DEV-2); the entry is a hot boundary that re-runs the program under a transparent memo and carries each live source whose shape is unchanged, resetting (and saying so) an edited declaration, a key of several instances and a question with no answer, with no rename or move heuristics and no module kept alive across the swap (DEV-3); a development client hydrates the production server's output, nothing added taking a hydration id (DEV-4); production output unchanged (DEV-5). What waits on Solid #5089 (`openView`: travel, map-observed replacement) and the map itself are next steps (DEV-7). solidjs#98's rules this branch declined are not taken through either PR. spec-refs knows the DEV- prefix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
yumemi-thomas added a commit to yumemi-thomas/reactivescript that referenced this pull request Nov 28, 2026
…of a declared action binds each parameter to its argument's value at the call, nested lists and records included, whatever is written after (a replacement, or a write along a path). The rule is written first; the runtimes disagreed and neither was right: the interpreter kept a replaced list but saw a path write in place, the compiled code (and the oracle) read the store itself after the await. The call now takes Solid's `snapshot` of an argument that is a store, and rebuilds a list or record written at the call around the stores in it (`calledWith` in rt-web.ts — the runtime a page runs, whose served-and-hydrated run showed the reset without it —, rt.ts and the oracle); anything else keeps its identity (S-region-7 removes a row by identity: a deep copy of every argument broke it). The interpreter copies an argument read from a source. Found by solidjs#98 (d303341, ref/compile/action-input.ts); re-implemented in the shared runtime, which both emitters' code calls. S-action-6 on the interpreter, both compiled runners, the oracle and the served runner; every scenario passes on all four.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
yumemi-thomas added a commit to yumemi-thomas/reactivescript that referenced this pull request Nov 28, 2026
…erence's type projection left only contexts out of a .d.rx's TypeScript and read an `import` row (MO-14a, read in any declaration file) as a function's, so `sigOf` threw a TypeError and the types runner could not check a program importing from such a file; it now leaves imports and the host's view out, as the crate's projection does. Found by the comparison with solidjs#98 (its type imports in a .d.rx, which are not taken: MO-8x keeps a .d.rx local). S-module-51 on the types runner with ref (TypeError before) and with the crate, and crate.ts --project.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
yumemi-thomas added a commit to yumemi-thomas/reactivescript that referenced this pull request Nov 28, 2026
…of test262's expression-level tests (tc39/test262 @ 4e4505c343d64b3c25da2338f2594504b0728594, BSD, LICENSE-test262) as .rx equations (`v = <expr>`, `w = str(v)`), regenerated by ref/test262/extract.mjs from the pinned checkout (deterministic: a second run writes the same files). Outcome a (593): constants with operators whose meaning .rx keeps, the value equal to Node's; b (42): `==`/`!=`/`===`/`!==`, equal to Node's value of the text as E-6 means it (`===`); c (219): a form 07 §3 removes, or text strict JavaScript refuses, refused and never compiled. Lanes: rxc check, rxc lower (dom, ssr, universal), each module run (universal over compile/rt.ts, dom over rt-web.ts in happy-dom, ssr rendered by Solid's server build), ref's checker, interpreter and compiler; the value caught as the program hands it to `str`, compared exactly (encode.mjs). A process per lane, one case at a time, killed past 15 s or 2 GB resident (the case fails: hang, memory); rxc over chunks, a chunk that dies run again case by case. The 268 failures of this tree are ref/test262/expected-failures.json, by case, with their cause and lanes; a failure not listed, one that passes or one whose lanes changed fails: the list only shrinks. In scripts/ci (`test262`) and the suites workflow.

Measured on 72cdde5 + this change (Solid caba92afb, darwin-arm64): 854 cases, 586 pass, 268 listed (a 226, b 26, c 16); every passing a/b case answered in all 8 lanes (383). By cause: BigInt literals refused 66; `** & | ^ << >> >>>` refused 66; unary `+ ~ typeof void` refused 38; exponents refused 26; hex/octal/binary refused 17; `.5`/`5.` refused 16; regex literals refused 9; `2.e1` read as `2 .e1` (undefined; `2.e-1` NaN) 8, silent in every target; `005`, `1__0`, `0_1`, `10._1` accepted 8; `??` mixed with `||`/`&&` accepted 4; `--x` compiled as `-(-x)` 3; the comma operator refused 1; `() => { }` compiled as `() => ({})` 1; ref's interpreter loses a computed method's receiver 3; ref's compiler prints `(() => 1)()` as `() => 1()` 2. Every string and template case passes (147 + 60, the solidjs#98 fix, e9e8ddd). Nothing fixed.

Positive controls (each removed after, the run green again): the crate's lexer, in a copy, cooking `\t` as `t` — `"\t"` fails in crate-universal/dom/ssr, exit 1; reading `_` in a number as `0` — the four separator cases fail (`2_2` = 202); reading unary `+` — twelve listed cases CHANGED (the crate passes, ref refuses), exit 1; spinning on `~` — the fourteen cases with `~` fail as hang in crate-check and crate-lower; ref's lexer, in a copy, cooking `\t` as `t` — `"\t"` fails in ref-interp and ref-compiled; a worker that spins, and one that grows past 2 GB off the heap — hang at 10 s, memory at 2470 MB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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