You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**GWT version: 2.12.1
**Browser (with version): all
**Operating System: all
Description
Single assignments as case statements should behave the same whether within {} or not.
Instead, with {} around them, these assignments generate correct JS, but if not surrounded with {}, the generated case statements have superfluous return statements that lead to function termination
Steps to reproduce
public void onModuleLoad() {
String s = "a";
switch (s) {
case "a" -> result = 1;
default -> result = 2;
}
Window.alert("result:" + result); // is never reached
}
generated JS:
_.onModuleLoad_0_g$ = function z_g$(){
var s_0_g$;
s_0_g$ = 'a';
switch (s_0_g$) {
case 'a':
return this.result_1_g$ = 1;
default:return this.result_1_g$ = 2;
}
X9c_g$('result:' + this.result_1_g$);
}
;
Known workarounds
Put {} around case-statements
public void onModuleLoad() {
String s = "a";
switch (s) {
case "a" -> { result = 1; }
default -> { result = 2; }
}
Window.alert("result:" + result); // is reached
}
**GWT version: 2.12.1
**Browser (with version): all
**Operating System: all
Description
Single assignments as case statements should behave the same whether within {} or not.
Instead, with {} around them, these assignments generate correct JS, but if not surrounded with {}, the generated case statements have superfluous return statements that lead to function termination
Steps to reproduce
generated JS:
Known workarounds
Put {} around case-statements
generated JS:
The text was updated successfully, but these errors were encountered: