Skip to content
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

INTERNAL COMPILER ERROR when class calls non existent parent #596

Closed
ghost opened this issue Aug 25, 2014 · 1 comment
Closed

INTERNAL COMPILER ERROR when class calls non existent parent #596

ghost opened this issue Aug 25, 2014 · 1 comment
Assignees
Labels

Comments

@ghost
Copy link

ghost commented Aug 25, 2014

Hi,

try to compile

var a = function() {
  a.base(this, 'constructor');
};

with --compilation_level ADVANCED_OPTIMIZATIONS --jscomp_error=checkTypes. You'll get:

java.lang.RuntimeException: java.lang.RuntimeException: INTERNAL COMPILER ERROR.
Please report this problem.
null
  Node(CALL): test.js:2:2
  a.base(this, 'constructor');
  Parent(EXPR_RESULT): test.js:2:2
  a.base(this, 'constructor');

        at com.google.javascript.jscomp.Compiler.runInCompilerThread(Compiler.java:678)
        at com.google.javascript.jscomp.Compiler.compile(Compiler.java:592)
        at com.google.javascript.jscomp.Compiler.compile(Compiler.java:562)
        at com.google.javascript.jscomp.AbstractCommandLineRunner.doRun(AbstractCommandLineRunner.java:780)
        at com.google.javascript.jscomp.AbstractCommandLineRunner.run(AbstractCommandLineRunner.java:374)
        at com.google.javascript.jscomp.CommandLineRunner.main(CommandLineRunner.java:1004)
Caused by: java.lang.RuntimeException: INTERNAL COMPILER ERROR.
Please report this problem.
null
  Node(CALL): test.js:2:2
  a.base(this, 'constructor');
  Parent(EXPR_RESULT): test.js:2:2
  a.base(this, 'constructor');

        at com.google.javascript.jscomp.ProcessClosurePrimitives.maybeProcessClassBaseCall(ProcessClosurePrimitives.java:660)
        at com.google.javascript.jscomp.ProcessClosurePrimitives.visit(ProcessClosurePrimitives.java:271)
        at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:563)
        at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:557)
        at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:557)
        at com.google.javascript.jscomp.NodeTraversal.traverseFunction(NodeTraversal.java:597)
        at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:551)
        at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:557)
        at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:557)
        at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:557)
        at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:557)
        at com.google.javascript.jscomp.NodeTraversal.traverse(NodeTraversal.java:287)
        at com.google.javascript.jscomp.ProcessClosurePrimitives.process(ProcessClosurePrimitives.java:175)
        at com.google.javascript.jscomp.DefaultPassConfig$9$1.process(DefaultPassConfig.java:1007)
        at com.google.javascript.jscomp.PhaseOptimizer$NamedPass.process(PhaseOptimizer.java:271)
        at com.google.javascript.jscomp.PhaseOptimizer.process(PhaseOptimizer.java:215)
        at com.google.javascript.jscomp.Compiler.check(Compiler.java:793)
        at com.google.javascript.jscomp.Compiler.compileInternal(Compiler.java:706)
        at com.google.javascript.jscomp.Compiler.access$000(Compiler.java:88)
        at com.google.javascript.jscomp.Compiler$2.call(Compiler.java:595)
        at com.google.javascript.jscomp.Compiler$2.call(Compiler.java:592)
        at com.google.javascript.jscomp.Compiler$3.call(Compiler.java:639)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
        ... 26 more

The really annoying thing is that if you add

a.prototype.m = function() {};

then the compiler hangs for a few seconds longer and outputs:

test.js:2: ERROR - Property base never defined on a
  a.base(this, 'constructor');
  ^

1 error(s), 0 warning(s), 81.8% typed

And with a large code base which depend on this type, this could be like forever. I had to start chopping my code to see when the compiler would stop hanging before realising it was a non-declared parent.

@ghost
Copy link
Author

ghost commented Aug 26, 2014

Sorry, the hanging had nothing to do with this bug. I guess just the first part is important for the issue.

@MatrixFrog MatrixFrog self-assigned this Aug 26, 2014
@MatrixFrog MatrixFrog added the bug label Aug 26, 2014
pauldraper pushed a commit to pauldraper/closure-compiler that referenced this issue Oct 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant