[Bug] List type parameters silently accept non-type expressions
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- Nửa ngày
- Mức phù hợp với người mới
- 55/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
- tooling
Hướng nghiên cứu
Start in the TypedMapParser.validateSubscriptType function, which currently handles only identifier and nested-subscript arguments, and see how it dispatches on argument shape. Add an Error diagnostic of kind invalid-type-parameter for literal, reference and expression arguments inside list brackets, pointing at the argument. Done when the five declarations in the reproduction yield Error diagnostics and the real-schema regression tests pass, while supported primitives and the unknown-type and nested-list-type controls still behave as before.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
List declarations accept literals and other expressions as their element type without an error. The documented list syntax requires a supported type, such as list[string], but TypedMapParser.validateSubscriptType only handles identifier and nested-subscript arguments. Other argument shapes fall through validation.
Steps to Reproduce
- Use the source checkout at
16396089a4264b544d40d4aaf83c1f8aa981760cwith the standard AgentScript schema and default lint rules. - Parse each declaration in the reproduction below.
- Inspect the parse and lint diagnostics.
Expected Behavior
Each non-type argument produces an Error diagnostic pointing to the argument inside the brackets. Supported primitive identifiers remain accepted.
Actual Behavior
All five declarations parse without syntax errors and receive no type Error. The default lint engine reports only an unused-variable warning for an isolated declaration. Controls correctly reject list[missing] as unknown-type and list[list[string]] as nested-list-type.
Environment
- Node.js: 22.20.0
- pnpm: 10.28.0
- OS: macOS 27.0.1, arm64
- Package: source build of
@agentscript/language3.2.3 and@agentscript/agentscript-dialect3.4.0
Minimal Reproduction
variables:
number_parameter: mutable list[1]
boolean_parameter: mutable list[True]
string_parameter: mutable list["string"]
reference_parameter: mutable list[@variables.other]
expression_parameter: mutable list[string + number]
Additional Context
Real-schema regression tests for these five forms fail against unchanged code because the Error diagnostic array is empty. All 12 supported element types and the two negative controls pass in the same run: 5 failed, 14 passed. The change can reuse invalid-type-parameter for the previously unhandled argument shapes.
- Ngôn ngữ chính
- TypeScript
- Star
- 272
- Fork
- 56
- Merge trung bình
- 12 giờ 18 phút
- Pull request đã merge (30 ngày)
- 5
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của salesforce/agentscript
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 61/100
salesforce/agentscript#85 ·
-
README Quick Start fails on macOS: Node 26 incompatibility and missing tree-sitter CLI prerequisiteCó thể làm lại được @dsorajisto đã nhận 157 ngày trước và không có pull request nào đang mở. Đang mở
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 75/100
salesforce/agentscript#33 · 2 bình luận ·
-
[Bug] Compiler rewrites literal @variables text in expressionsCó thể đã có người làm @BichengWang đã nhận 1 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
salesforce/agentscript#96 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
salesforce/agentscript#73 ·
-
[bug]: @sf-agentscript/[email protected] (latest) still unusable — dist/ compiled against a newer @sf-agentscript/language than package.json pins (missing export `nullLiteralValidationPass`)Có thể đã có người làm @srikolagani đã nhận 41 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
salesforce/agentscript#71 · 1 bình luận ·
Tất cả issue của salesforce/agentscript
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Chocobozzz/PeerTube#7832 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Pay to use?Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 66/100
darkreader/darkreader#16108 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Add: Dak Nong TV SDĐang mởcheck:passed streams:add
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug engine
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
frostney/GocciaScript#1746 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
agilepathway/label-checker#739 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày