Clean up node kinds in SymbolTableNode

Đang mở
#4,082 1 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ó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
compilers

Hướng nghiên cứu

Start by reading the SymbolTableNode handling described in the issue and the linked discussion in PR 4080. Map the current LDEF, GDEF, and MDEF kinds, module references, and type-alias attributes before deciding how the proposed SymbolNode subclasses and MypyFile marker fit. Done means the special kind handling and kind attribute are replaced by the proposed scope-based structure without losing type-alias behavior.

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

Mô tả

priority-0-high refactoring

It seems like we could remove the special handling of module references and other special node kinds in SymbolTableNode so that we could remove the kind attribute and replace it with a scope attribute, with only 3 possible values, corresponding to the current kinds LDEF, GDEF and MDEF. We'd create new SymbolNode subclasses for some of the node kinds. For module references we can perhaps just use a MypyFile target node as a marker. We could move some attributes that are specific to type aliases to live in the new SymbolNode subclass.

From https://github.com/python/mypy/pull/4080#discussion_r143480572:

@ilevkivskyi :

Type aliases are quite complicated (due to several corner cases). I tried to make some simplifications recently. It seems to me that we can introduce a dedicated SybmolNode (like Var or TypeInfo) and deprecate type_override and friends and just point .node to this new symbol node. This is major refactoring, but I think it may help.

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.