ReScript v12 RC: PPX auto-rewrite for JSX `@defer` causes curried/uncurried mismatch

Hi all — I’m investigating a native PPX rewrite edge case and wanted to confirm whether this is a known compiler limitation/bug.

Context

I am building rescript-solid: GitHub - Frank-III/rescript-solid

We have a native PPX that rewrites:

  • @show (works reliably)
  • @defer (problematic when payload is JSX)

Current behavior:

  • Explicit source works:
    • SolidJSX.ppxDefer(() => <p>...</p>) :white_check_mark:
  • Auto rewrite of JSX `@defer` can fail:
    • @defer { <p>...</p> } → rewritten by PPX → :x: with curried/uncurried error

Isolated repro

I created an isolated mini project at:

  • `examples/defer-repro`

Repro file:

open Solid

@jsx.component
let make = () => {
  let (count, _setCount) = createSignal(0)
  <div>
    <p>{string("Probe")}</p>
    {@defer {
      <p>{string("Deferred count: " ++ count()->Int.toString)}</p>
    }}
  </div>
}

Commands

Baseline (pass):

bun run -F solid-examples-defer-repro res:clean && bun run -F solid-examples-defer-repro res:build

Guarded rewrite mode (pass):

bun run -F solid-examples-defer-repro res:clean && RESCRIPT_SHOW_PPX_NATIVE_DEFER=1 bun run -F solid-examples-defer-repro res:build

Full JSX auto-rewrite mode (fails):

bun run -F solid-examples-defer-repro res:clean && RESCRIPT_SHOW_PPX_NATIVE_DEFER=1 RESCRIPT_SHOW_PPX_NATIVE_DEFER_JSX=1 bun run -F solid-examples-defer-repro res:build

Error

At examples/defer-repro/src/DeferRepro.res on the deferred JSX expression:

This function is a curried function where an uncurried function is expected

1 Like

Hmm I don’t understand why it works when it doesn’t return a jsx but it’s likely caused by the fact we changed how functions are encoded in the AST with uncurried mode, so this is likely not correct:

I’ll check how it should be rewritten.