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
import*astsfrom"typescript";letsourceCode="let a = /regexp/";lettsSourceFile=ts.createSourceFile("script.js",sourceCode,ts.ScriptTarget.Latest);console.log(ts.createPrinter().printFile(tsSourceFile));
Expected behavior:
The script should output let a = /regexp/;
Actual behavior:
The script crashes with the following stack trace:
.../node_modules/typescript/lib/typescript.js:3495
throw e;
^
Error: Debug Failure.
at Object.getLiteralText (/Users/work/GitHub/sample-js-selfparsing/node_modules/typescript/lib/typescript.js:7077:18)
at getLiteralTextOfNode (/Users/work/GitHub/sample-js-selfparsing/node_modules/typescript/lib/typescript.js:68597:23)
at emitLiteral (/Users/work/GitHub/sample-js-selfparsing/node_modules/typescript/lib/typescript.js:66918:24)
at pipelineEmitExpression (/Users/work/GitHub/sample-js-selfparsing/node_modules/typescript/lib/typescript.js:66816:28)
at pipelineEmitWithHint (/Users/work/GitHub/sample-js-selfparsing/node_modules/typescript/lib/typescript.js:66565:49)
at pipelineEmitWithSourceMap (/Users/work/GitHub/sample-js-selfparsing/node_modules/typescript/lib/typescript.js:66558:17)
at emitNodeWithNestedComments (/Users/work/GitHub/sample-js-selfparsing/node_modules/typescript/lib/typescript.js:64324:17)
at emitNodeWithSynthesizedComments (/Users/work/GitHub/sample-js-selfparsing/node_modules/typescript/lib/typescript.js:64274:13)
at emitNodeWithComments (/Users/work/GitHub/sample-js-selfparsing/node_modules/typescript/lib/typescript.js:64244:21)
at pipelineEmitWithComments (/Users/work/GitHub/sample-js-selfparsing/node_modules/typescript/lib/typescript.js:66547:17)
error Command failed with exit code 1.
Uh oh!
There was an error while loading. Please reload this page.
TypeScript Version: 2.4.2
Code
Expected behavior:
The script should output
let a = /regexp/;
Actual behavior:
The script crashes with the following stack trace:
Proposed fix:
fwouts@884cadf
Where would be a good place to add tests for this?
The text was updated successfully, but these errors were encountered: