Summary
The Java backend emits duplicate String ch declarations in the same method scope, causing "variable ch is already defined" compile errors. Java doesn't allow redeclaring a variable in the same scope, unlike Python where reassignment to the same name is always valid.
Reproduction
Transpiled Java:
void _parse_backtick_substitution() {
String ch = ...;
// ... later in same method ...
String ch = ...; // ERROR: variable ch is already defined
}
Impact
2 compile errors in _parse_backtick_substitution().
Fix
The Java backend should track declared variables per scope and emit plain assignment (ch = ...) instead of re-declaration (String ch = ...) when the variable already exists.
Discovered via ldayton/Parable#413.
Summary
The Java backend emits duplicate
String chdeclarations in the same method scope, causing "variable ch is already defined" compile errors. Java doesn't allow redeclaring a variable in the same scope, unlike Python where reassignment to the same name is always valid.Reproduction
Transpiled Java:
Impact
2 compile errors in
_parse_backtick_substitution().Fix
The Java backend should track declared variables per scope and emit plain assignment (
ch = ...) instead of re-declaration (String ch = ...) when the variable already exists.Discovered via ldayton/Parable#413.