Errors related to imports different in fine-grained incremental mode

Đang mở
#4,398 2 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
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
devtools

Hướng nghiên cứu

Start with the test cases in test-data/unit/fine-grained-modules.test, especially testDeletionOfSubmoduleTriggersImportFrom1 and testDeleteTwoFilesErrorsElsewhere, and compare their incremental and non-incremental output. Done means redundant import-related errors are removed, the preferred missing-module message is consistent, and error line numbers match across modes.

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

Mô tả

priority-1-normal topic-fine-grained-incremental

The example from test-data/unit/fine-grained-modules.test illustrates a problem with inconsistent import-related messages:

[case testDeletionOfSubmoduleTriggersImportFrom1]
from p import q
[file p/__init__.py]
[file p/q.py]
[delete p/q.py.2]
[file p/q.py.3]
[out]
==
main:1: error: Cannot find module named 'p.q'
-- TODO: The following messages are different compared to non-incremental mode
main:1: note: (Perhaps setting MYPYPATH or using the "--ignore-missing-imports" flag would help)
main:1: error: Module 'p' has no attribute 'q'
==

The expected behavior is to show only one of Cannot find module named 'p.q' / Module 'p' has no attribute 'q' (preferably the first alternative) in all modes.

Another test case which illustrates the problem:

[case testDeleteTwoFilesErrorsElsewhere]
import a
import b
a.f()
b.g()
[file a.py]
def f() -> None: pass
[file b.py]
def g() -> None: pass
[delete a.py.2]
[delete b.py.2]
[out]
==
main:1: error: Cannot find module named 'a'
main:1: note: (Perhaps setting MYPYPATH or using the "--ignore-missing-imports" flag would help)
-- TODO: Remove redundant error message
main:1: error: Cannot find module named 'b'
main:2: error: Cannot find module named 'b'

We should also make sure that error line numbers are consistent.

Ngôn ngữ chính
Python
Star
20.6k
Fork
3.3k
Merge trung bình
1 ngày 18 giờ
Pull request đã merge (30 ngày)
54

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

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 python/mypy

Tất cả issue của python/mypy

Issue tương tự

Thêm issue về Python

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.