[v1.5 regression] Repeating a type guard condition causes the guard to be lost
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
調査の方向性
The report provides a Python example where repeating a TypeGuard condition with or loses the guard and causes two false positives. Start by reading the type checker’s handling of TypeGuard narrowing and boolean or expressions, then look for tests covering repeated guards. Done means the reported example preserves the narrowed type and no longer emits the false-positive diagnostics.
索引モデルが issue の本文から書いたものです。
説明
Describe the Bug
Reported impact: 2 false-positive diagnostics in the attrs library
from typing import Any, TypeGuard
class C(Any):
pass
def has(cls: type) -> TypeGuard[type[C]]:
return hasattr(cls, "tag")
def f(t: type[object]) -> None:
if has(t) or has(t):
reveal_type(t)
t.tag # object has no class attribute `tag`
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
-
language-server
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
-
Attribute access after `if sys.platform != ...: return` is checked against the current platformオープン
難易度 4/5 3〜5日 初心者へのやさしさ 54/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
facebook/pyrefly の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
dekobon/big-code-analysis#1859 ·
メンテナーはふだん 1 日以内に返信
-
agent-self
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
yologdev/yoyo-evolve#1160 ·
-
phase:3
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
pchrysostomou/ananke#214 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
eliasstravik/herdr-projects#845 ·
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 63/100
ramensoftware/windhawk#1187 ·