`findit.find_implementations` on method call finds implementation for different subclass
Maintainer thường phản hồi trong vòng 7 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 30/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
- developer-experience
Hướng nghiên cứu
The reproduction is in example.py and bug.py using rope.contrib.findit.find_implementations on the a.f() call at line 10. Start by reading find_implementations in rope/contrib/findit.py and how it resolves the type of a to its defining class. Done means the call resolves to A.f and not B.f, with the reproduction printing line 2.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
Running Rope's rope.contrib.findit.find_implementations on the a.f() call in a file like
class A:
def f(self):
return 1
class B(A):
def f(self):
return 2
a: A = A()
a.f()
makes it return the position of B.f, which has nothing to do with that call as it's only related to A.
To Reproduce
Save the snippet above as example.py and run this script (let's call it bug.py) in the same folder:
from rope.base.project import Project
from rope.contrib.findit import find_implementations
project = Project(".")
resource = project.get_file("example.py")
pymodule = project.get_pymodule(resource)
call_offset = pymodule.lines.get_line_start(10) + 2 # l. 10: a.f()
for loc in find_implementations(project, resource, call_offset):
print(loc.lineno)
Expected behavior:
It should output 2, as line 2 is where A.f which is being called here is defined.
Actual behavior:
It outputs (line) 6, which is where B.f is defined. B.f has nothing to do with the call a.f, except that it happens to be an implementation of A.f as well (but that is not the implementation we're calling!).
Screenshots
None required.
Editor information (please complete the following information):
No editor needed to reproduce.
Additional context
This was found while trying to use findit.find_implementations to add support for the LSP textDocument/implementation capability to python-lsp-server:
- Ngôn ngữ chính
- Python
- Star
- 2.2k
- Fork
- 197
- Merge trung bình
- 2 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 5
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của python-rope/rope
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
python-rope/rope#927 ·
Maintainer thường phản hồi trong vòng 7 ngày
-
Extract raises IndexError or ModuleSyntaxError instead of RefactoringError for an empty or whitespace-only regionCó thể đã có người làm @aliassar đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
python-rope/rope#926 ·
Maintainer thường phản hồi trong vòng 7 ngày
-
simplify.real_code blanks t-strings, so renames inside them edit the wrong offsetCó thể đã có người làm @sean0407 đã nhận 10 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
python-rope/rope#913 ·
Maintainer thường phản hồi trong vòng 7 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
python-rope/rope#925 ·
Maintainer thường phản hồi trong vòng 7 ngày
-
Extract method/variable and introduce parameter don't check whether the new name is already in useĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 62/100
python-rope/rope#924 ·
Maintainer thường phản hồi trong vòng 7 ngày
Tất cả issue của python-rope/rope
Issue tương tự
-
HandyModRTransform.deriv3 is wrong for m > 2Có thể đã có người làm @SajalDevX đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
read_messages: the first read after subscribe/psubscribe returns no messages even when some are waitingCó thể đã có người làm @matheussilvano đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 80/100
The-Swarm-Corporation/swarms-framework-docs#399 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bump patch
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
autowarefoundation/autoware_carla_scenario#1321 ·
Maintainer thường phản hồi trong vòng 1 ngày