Skip to content

Internal error with let inside while loop #1124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ochafik opened this issue Sep 9, 2015 · 4 comments
Closed

Internal error with let inside while loop #1124

ochafik opened this issue Sep 9, 2015 · 4 comments
Assignees

Comments

@ochafik
Copy link

ochafik commented Sep 9, 2015

This simple code:

while (true) {
  let x = null;
  function f() {
    x();
  }
}

Gives the following trace (cmd line args: --language_in=ECMASCRIPT6_STRICT -O SIMPLE):

INTERNAL COMPILER ERROR.
Please report this problem.

Invalid attempt to remove node: NAME $jscomp$loop$0 3 [source_file: bug_closure.js] of CALL 3 [free_call: 1] [source_file: bug_closure.js]
  Node(NAME $jscomp$loop$0): bug_closure.js:3:2
  function f() {
  Parent(CALL): bug_closure.js:3:2
  function f() {

    at com.google.javascript.jscomp.NodeUtil.removeChild(NodeUtil.java:2293)
    at com.google.javascript.jscomp.UnreachableCodeElimination$EliminationPass.removeNode(UnreachableCodeElimination.java:261)
    at com.google.javascript.jscomp.UnreachableCodeElimination$EliminationPass.removeDeadExprStatementSafely(UnreachableCodeElimination.java:251)
    at com.google.javascript.jscomp.UnreachableCodeElimination$EliminationPass.visit(UnreachableCodeElimination.java:104)
    at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:609)
    at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:603)
    at com.google.javascript.jscomp.NodeTraversal.traverseBlockScope(NodeTraversal.java:652)
    at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:597)
    at com.google.javascript.jscomp.NodeTraversal.traverseBlockScope(NodeTraversal.java:652)
    at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:597)
    at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:603)
    at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:603)
    at com.google.javascript.jscomp.NodeTraversal.traverse(NodeTraversal.java:295)
    at com.google.javascript.jscomp.NodeTraversal.traverseEs6(NodeTraversal.java:560)
    at com.google.javascript.jscomp.UnreachableCodeElimination$1.enterFunction(UnreachableCodeElimination.java:81)

Note that it works fine with var instead of let.

@MatrixFrog
Copy link
Contributor

This might be another one that will be fixed with --language_out=ES5?

@Dominator008
Copy link
Contributor

@MatrixFrog Seems like it's a bug in Es6ToEs3RewriteBlockScopedDeclaration

@ochafik
Copy link
Author

ochafik commented Sep 9, 2015

(neither --language_out=ES5 nor --language_out=ECMASCRIPT5_STRICT help here, unfortunately)

@ochafik
Copy link
Author

ochafik commented Sep 12, 2015

Thanks a lot guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants