Rust printer: equals/hashCode in a closed class hierarchy
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Java
- Stelle
- 1
- Fork
- 1
- Merge medio
- 48m
- PR unite (30g)
- 2
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di CodeLaser/maddi
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
Javadoc warnings are the only noise on an otherwise clean CI runForse di nuovo libera @jayeshamundkar06-bit l’ha presa 27 giorni fa e non c’è nessuna pull request aperta. Apertabuild/ci good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
Tutte le issue di CodeLaser/maddi
Issue simili
-
area:cpan-port area:performance bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
fglock/PerlOnJava#2230 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
federicoiosue/Omni-Notes#1044 ·
-
Industrial Center Text TypoApertaBug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Terraform releases proxy leaves a temp folder behind on every cache refreshForse già presa @dhananjay6561 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
terrakube-io/terrakube#4069 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno