Unexpected type checking with pyright
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 1-2 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- python
- 领域
- testing-qa
调研方向
Start by reproducing the reported pyright behavior with the issue’s code sample and inspect the library’s type annotations for ElectricPotentialArray, Power, and tu.V. The issue does not name a source file or test; trace how indexing is typed and add a focused regression check. Done means the invalid x[tu.V] expression is reported as a type error.
由索引模型根据 Issue 内容生成。
描述
Using pyright in neovim, I see unexpected behavior in type checking:
import tunits as tu
x = (tu.ElectricPotentialArray(np.array([1, 2, 3]) * tu.V), 5 * tu.W)
reveal_type(x) # Type of "x" is "tuple[ElectricPotentialArray, Power]"
y = x[tu.V]
reveal_type(y) # Type of "y" is "ElectricPotentialArray | Power"
The third line should be flagged as a type error. From the fourth line, it looks like tu.V is being treated as an integer. Is it possible that the type annotations for this library have some bug?
- 主要语言
- Python
- 星标
- 10
- 派生
- 8
- 平均合并
- 5 分钟
- 30 天内合并 PR
- 1
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
quantumlib/TypedUnits 的其他 Issue
-
Request for Windows ARM64 builds可能重新可做 关联的 PR 已关闭且未合并。 未关闭help wanted
难度 4/5 3-5 天 新手友好度 20/100
quantumlib/TypedUnits#87 · 1 条评论 ·
查看 quantumlib/TypedUnits 的全部 Issue
相似的 Issue
-
bug game: 0100FF500E34A000 game: 0400FF500E34A001 mac packing
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 2 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 74/100
jxxghp/MoviePilot#7576 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 64/100
jbaruch/software-factory#266 ·
维护者通常 1 天内回复
-
cron: raise a distinct error when next_fire finds no match in its search bound (from #813 item 5)未关闭
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复