[Bug] List type parameters silently accept non-type expressions
评估
- 难度
- 3/5
- 预计耗时
- 半天
- 新手友好度
- 55/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- tooling
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- TypeScript
- 星标
- 272
- 派生
- 56
- 平均合并
- 12 小时 18 分钟
- 30 天内合并 PR
- 5
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
salesforce/agentscript 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 61/100
salesforce/agentscript#85 ·
-
README Quick Start fails on macOS: Node 26 incompatibility and missing tree-sitter CLI prerequisite可能重新可做 @dsorajisto 于 156 天前认领,目前没有进行中的 PR。 未关闭
难度 2/5 半天 新手友好度 75/100
salesforce/agentscript#33 · 2 条评论 ·
-
[Bug] Compiler rewrites literal @variables text in expressions可能已有人在做 @BichengWang 于 1 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 72/100
salesforce/agentscript#96 ·
-
难度 4/5 3-5 天 新手友好度 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`)可能已有人在做 @srikolagani 于 40 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 55/100
salesforce/agentscript#71 · 1 条评论 ·
查看 salesforce/agentscript 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
melgarafael/DeskcommCRM#3000 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
callstackincubator/simlock#639 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 80/100
aws/agentcore-cli#2606 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 7 天内回复
-
ai-driven-qa bug Cosmetic
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复