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

オープン
#4,635 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
52/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
typescript
領域
backend, compilers

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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
主要言語
TypeScript
スター
6.7k
フォーク
229
平均マージ
14時間 29分
マージ済み PR(30日)
787

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

vercel-labs/scriptc のほかの issue

vercel-labs/scriptc の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。