SC2020: RegExpMatchArray.slice has no lowering (hono RegExpRouter serves 500s)

Aperta
#4,635 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
backend, compilers

Direzione di ricerca

Start by tracing how scriptc lowers Array.prototype.slice and how it handles RegExpMatchArray values; the issue does not name the relevant compiler files or tests. Reproduce with the stated hono 4.13.23 server under scriptc 0.4.17 and compare the default RegExpRouter with TrieRouter. Done means routes return successfully in the compiled ELF without requiring the TrieRouter workaround.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

Array.prototype.slice on a RegExpMatchArray has no lowering in 0.4.17 (SC2020). This breaks hono's default RegExpRouter at runtime: mergeStaticRoutes in hono/dist/router/reg-exp-router/router.js:78 calls path.match(regexp).slice(...), so every route returns 500 under a compiled ELF while compiling cleanly.

Reproduction

Compile a hono 4.13.23 server using the default router and hit any route natively. Workaround verified: new Hono({ router: new TrieRouter() }) — 6/6 routes pass.

Impact

Found while compiling the doop CLI/server to ELF with scriptc 0.4.17 (see doop compatibility program): RegExpMatchArray.slice lowering would remove the need for the TrieRouter convention.

Environment

  • scriptc 0.4.17
  • hono 4.13.23
Lingua principale
TypeScript
Stelle
6.7k
Fork
229
Merge medio
14h 29m
PR unite (30g)
787

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di vercel-labs/scriptc

Tutte le issue di vercel-labs/scriptc

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.