`explicit-any-use`/`unknown-from-error` errors highlight the expression but the error message references the variable
まだ誰も着手していません。
評価
調査の方向性
Search the Rust codebase for the diagnostic names explicit-any-use and unknown-from-error, then find where each diagnostic attaches its range and how the message gets the assigned variable name. Reproduce both snippets from the issue, or the sandbox, and compare the case where the result is not assigned. Done means the highlighted range and the message agree on whether the error is about the expression or the variable; add or update the relevant diagnostic test.
索引モデルが issue の本文から書いたものです。
説明
Describe the Bug
from typing import Any
def fn() -> Any: ...
def fn2() -> Unknown: ... # pyrefly: ignore[unknown-name]
foo = fn()
# ^^^^ error: The type of `foo` is an explicit `Any`
foo = fn2()
# ^^^^^ error: The type of `foo` is unknown because it comes from an error
the underlined code is the expression:
but the error messages refer to the variable foo.
this can be really confusing in some cases:
from typing import Any
def fn(foo: int) -> Any: ...
foo = fn(1)
# ^^^^^ error: The type of `foo` is an explicit `Any`
here it looks like the error is talking about the function parameter called foo
idk whether the best fix is to change the range where the errors are reported or just change the error messages. i'm leaning towards the former, because the error goes away when the result is not assigned to a variable, indicating that the error is actually about the variable rather than the expression.
Sandbox Link
(Only applicable for extension issues) IDE Information
No response
- 主要言語
- Rust
- スター
- 7.2k
- フォーク
- 578
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
facebook/pyrefly のほかの issue
-
pytorch tensor-shapes typechecking
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
good first issue typechecking
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
cargo b warning: unused dependency `zstd`対応中かも @Narendersingh007 が 4 日前に担当しました。 オープンgood first issue
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
-
pydantic
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
facebook/pyrefly の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
eventflux-io/eventflux#203 ·
メンテナーはふだん 1 日以内に返信
-
bug ui
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
userFRM/egui-charts#4068 ·
メンテナーはふだん 1 日以内に返信
-
fuzz-crash review-followup
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
marketing
難易度 2/5 半日 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
aws/aws-emulator#610 ·