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

Đang mở
#4,635 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
52/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
backend, compilers

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
TypeScript
Star
6.7k
Fork
229
Merge trung bình
14 giờ 29 phút
Pull request đã merge (30 ngày)
787

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của vercel-labs/scriptc

Tất cả issue của vercel-labs/scriptc

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.