Suppression comments in inactive code are reported as unused

オープン
#5,680 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python, rust

調査の方向性

Start by reproducing the report in the Pyrefly sandbox using the provided configuration and Python example. Then trace how inactive branches and # type: ignore comments are analyzed; the payload names no source files or tests, so locate the relevant test entry point. Done when the reported suppression is recognized as used and a regression test covers the example.

索引モデルが issue の本文から書いたものです。

説明

has-open-pr quansight
Describe the Bug
# Pyrefly sandbox configuration.
# See https://pyrefly.org/en/docs/configuration/ for available configuration options.
python-version = "3.12"
[errors]
unimported-directive = 'ignore'
not-required-key-access = 'warn'
no-any-return = 'error'
unused-type-ignore = 'error'
import sys

def via_else() -> int:
    if sys.version_info < (3,13):
        return 0
    else:
        x = 1
        return "x"  # type: ignore
ERROR sandbox.py:8:21-35: Unused `# type: ignore` comment [[unused-type-ignore](https://pyrefly.org/en/docs/error-kinds/#unused-type-ignore)]

I don't think the "unused # type: ignore" diagnostic is right? The return 'x' is incompatible with -> int so the # type: ignore isn't in fact unused?

Sandbox Link

https://pyrefly.org/sandbox/?project=v2.pVRLDoIwEL3KBBa4ECphZzyEByAxjSKyaY2lBBfe3TdtjVbQDdt2ZjLvM-9XZMaXx4IOnTywAbyoYPptPFQVATXWOGva0apal9WMmzazThqBrZzU1slYJ0QpRzfuIBDE0L-IT2nvHyhgQORAsdYi2LBTUasUmdbQpe-vZivEq13fWtEocdJHI6IOQewxOcjOxWU8jrQzisHYJYpnHk_2T--M5XYVuVR3FDle8O6G48Mqa9DEBOV-3ufvRPmIt8cT

(Only applicable for extension issues) IDE Information

No response

主要言語
Rust
スター
7.2k
フォーク
578
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

facebook/pyrefly のほかの issue

facebook/pyrefly の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。