Rust printer: Statement.getBasichead() printed as 'return self' in both branches
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 50/100
Direzione di ricerca
Start with the Rust translation of Statement.getBasichead() in the fernflower reproduction and trace how the Shared<Statement> field first is translated through recursive calls returning &Self. Compare the generated Rust with the Java branches and inspect build_continue_set and is_head_do_statement to understand the impact. Done means the translated else branch preserves the recursive call and the translation report identifies any remaining unsupported behavior.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
On fernflower (test-oss/fernflower, translated with --translate rust), Statement.getBasichead() is printed with self in both branches:
public BasicBlockStatement getBasichead() {
if (type == StatementType.BASIC_BLOCK) {
return (BasicBlockStatement)this;
}
else {
return first.getBasichead();
}
}
pub fn get_basichead(&self) -> &Self {
if self.r#type == StatementStatementType::BasicBlock {
return self;
} else {
return self;
}
}
It compiles, so rustc does not catch it, and the translation report has no message for these lines. The recursion into first is gone. Callers that build continue-sets from it (build_continue_set, is_head_do_statement) inherit the wrong result.
The setting:
Statementis the root of a closed hierarchy, andBasicBlockStatementis a member of it.firstisOption<crate::jrt::Shared<Statement<'a>>>.
A small reproduction with a plain field, then with a nullable field and a member cast (return (Leaf) this / return first.head()), prints the recursion correctly. So the trigger is probably the Shared handle, or the &Self return through it. It is not the cast.
Found while reviewing the printed bodies against the Java.
🤖 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