Suppression comments in inactive code are reported as unused

Đang mở
#5,680 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python, rust
Lĩnh vực
backend, testing-qa

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Rust
Star
7.2k
Fork
578
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của facebook/pyrefly

Tất cả issue của facebook/pyrefly

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.