Rust printer: Statement.getBasichead() printed as 'return self' in both branches
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 50/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- Java
- Estrellas
- 1
- Forks
- 1
- Merge medio
- 48 min
- PR fusionados (30 d)
- 2
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de CodeLaser/maddi
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
-
Javadoc warnings are the only noise on an otherwise clean CI runQuizá libre de nuevo @jayeshamundkar06-bit la tomó hace 27 días y no hay ningún pull request abierto. Abiertobuild/ci good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
Todos los issues de CodeLaser/maddi
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
federicoiosue/Omni-Notes#1044 ·
-
Industrial Center Text TypoAbiertoBug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Terraform releases proxy leaves a temp folder behind on every cache refreshPosiblemente ocupada @dhananjay6561 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
terrakube-io/terrakube#4069 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
find-sec-bugs/find-sec-bugs#789 ·