Prepack: --timeout crashes Prepack

Created on 13 May 2018  路  3Comments  路  Source: facebook/prepack

Prepacking

while (true) {}

with --timeout 1 results in

/Users/nikolait/git/prepack/lib/invariant.js:22
  throw error;
  ^

Invariant Violation: FatalError must generate at least one CompilerDiagnostic
This is likely a bug in Prepack, not your code. Feel free to open an issue on GitHub.
    at invariant (/Users/nikolait/git/prepack/lib/invariant.js:20:15)
    at run (/Users/nikolait/git/prepack/lib/prepack-cli.js:391:33)
    at Object.<anonymous> (/Users/nikolait/git/prepack/lib/prepack-cli.js:471:3)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:188:16)
bug help wanted interpreter

All 3 comments

still trying to get around the project, but it might be in realm:325 in testTimeout, the throw might need to be updated from throw new _errors.FatalError("Timed out"); to something like

 throw new _errors.CompilerDiagnostic(
        "Possible time error",
        loc,
        "PPXXXX",
        "TimeError"
      );

so we can surface a more descriptive error

I can help get a pr if that's the general correct issue to fix

That sounds like exactly the right thing to do.

The pattern is usually:

          let error = new CompilerDiagnostic("...", prop.loc, "PPxxxx", "FatalError");
          if (realm.handleError(error) === "Fail") throw new FatalError();

Fixed by referenced pull request.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bevacqua picture bevacqua  路  8Comments

cblappert picture cblappert  路  7Comments

jtenner picture jtenner  路  5Comments

jacktuck picture jacktuck  路  3Comments

phpnode picture phpnode  路  3Comments