Skip to content

Commit a9788d1

Browse files
lauraharkercopybara-github
authored andcommitted
Add test showing MinimizeExitPoints bug when AST is not normalized
PiperOrigin-RevId: 846832887
1 parent 53b8c2b commit a9788d1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/com/google/javascript/jscomp/MinimizeExitPointsTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,16 @@ public void testSwitchExitPoints1() {
322322
"switch (x) { case 1: if (x) { f(); } break; default: g(); }");
323323
}
324324

325+
@Test
326+
public void testFoldBlockScopedVariables_bug() {
327+
disableNormalize();
328+
fold(
329+
"function f() { if (x) {return;} else { let c = 1; } var c; return !!c; }",
330+
// TODO: b/470408326 - fix this output.
331+
// "Uncaught SyntaxError: Identifier 'c' has already been declared"
332+
"function f() { if (x){} else { let c = 1; var c; return !!c; } }");
333+
}
334+
325335
@Test
326336
public void testFoldBlockScopedVariables() {
327337
// When moving block-scoped variable declarations into inner blocks, first convert them to

0 commit comments

Comments
 (0)