Rust printer: equals/hashCode in a closed class hierarchy
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
- 35/100
Hướng nghiên cứu
Start with RustTypePrinter to trace why hierarchy equals and hashCode methods are reported as unsupported, then inspect RustBodyPrinter.methodCall and RustJdk for the equality call paths described. Reproduce the fernflower (test-oss) failures, especially the Exprent and Statement cases. Done means hierarchy equality and hashing translate correctly, including inherited or identity comparison and reference or nullable operands, and the affected collection operations compile.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
The Rust printer does not translate equals/hashCode declared in a closed class hierarchy (RustHierarchies). RustTypePrinter skips such methods and reports UNSUPPORTED ("equals or hashCode in a class hierarchy"), so the hierarchy's enum gets no PartialEq/Hash.
Calls then fail in two ways:
a.equals(b)on the hierarchy's root type, which declares noequalsitself while its members do, resolves toObject.equals. RustJdk maps that to a plaina == &b, which leaves the two operands at different reference orOptionlevels, and the enum has noPartialEqin any case.- Collection operations that need equality (
list.remove(o),indexOf,contains, map keys) on hierarchy members fail the same way.
On fernflower (test-oss) this accounts for 44 of the 62 E0277 "can't compare" errors, in 34 functions, mostly Exprent and Statement. For example, if (asexpr.getLeft().equals(field)) becomes asexpr.get_left().as_ref().unwrap() == &field.
Proposed translation:
- print each member's
equalsas an implementation method, thenimpl PartialEq for <Root>that dispatches on the kind to the member's implementation; - a member without its own
equalsinherits the nearest one, or is compared by identity when there is none; - the same for
hashCode→impl Hash, when the hierarchy is used as a key; - route
Object.equalswith a source receiver type to the source-equality branch ofRustBodyPrinter.methodCall, soShared<T>operands compare throughShared::equalsand nullable ones throughOption<&T>.
🤖 Generated with Claude Code
- Ngôn ngữ chính
- Java
- Star
- 1
- Fork
- 1
- Merge trung bình
- 48 phút
- Pull request đã merge (30 ngày)
- 2
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 CodeLaser/maddi
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Javadoc warnings are the only noise on an otherwise clean CI runCó thể làm lại được @jayeshamundkar06-bit đã nhận 27 ngày trước và không có pull request nào đang mở. Đang mởbuild/ci good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
Tất cả issue của CodeLaser/maddi
Issue tương tự
-
area:cpan-port area:performance bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
fglock/PerlOnJava#2230 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
federicoiosue/Omni-Notes#1044 ·
-
Industrial Center Text TypoĐang mởBug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ 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
-
Terraform releases proxy leaves a temp folder behind on every cache refreshCó thể đã có người làm @dhananjay6561 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
terrakube-io/terrakube#4069 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày