Typescript: Using noUnusedLocals crashes version 2.7

Created on 30 Jan 2018  路  9Comments  路  Source: microsoft/TypeScript



TypeScript Version: 2.7.1-insiders.20180127

Is not an issue with typescript@next. It'd be great to have this fix in the 2.7 release since this is a regression.


Search Terms:

noUnusedLocals, crash

Code

See attached.

Expected behavior:

tsc --noUnusedLocals SceneServiceFactory.ts returns expected errors in 2.6.

Actual behavior:

/usr/local/lib/node_modules/typescript/lib/tsc.js:59815
                throw e;
                ^

Error: Debug Failure.
    at checkUnusedClassMembers (/usr/local/lib/node_modules/typescript/lib/tsc.js:35731:38)
    at checkUnusedIdentifiers (/usr/local/lib/node_modules/typescript/lib/tsc.js:35617:29)
    at checkSourceFileWorker (/usr/local/lib/node_modules/typescript/lib/tsc.js:37887:21)
    at checkSourceFile (/usr/local/lib/node_modules/typescript/lib/tsc.js:37865:13)
    at Object.forEach (/usr/local/lib/node_modules/typescript/lib/tsc.js:260:30)
    at getDiagnosticsWorker (/usr/local/lib/node_modules/typescript/lib/tsc.js:37931:16)
    at getDiagnostics (/usr/local/lib/node_modules/typescript/lib/tsc.js:37908:24)
    at Object.getEmitResolver (/usr/local/lib/node_modules/typescript/lib/tsc.js:20096:17)
    at emitWorker (/usr/local/lib/node_modules/typescript/lib/tsc.js:59757:69)
    at /usr/local/lib/node_modules/typescript/lib/tsc.js:59731:66

SceneServiceFactory.ts.txt

Bug Fixed

Most helpful comment

All 9 comments

for this specific file, the semicolon after setPointCloudNodeAttributes is what is triggering the crash.

I am also getting this crash on typescript 2.7 when compiling on Mac OSX and using the "noUnusedLocals":true setting in tsconfig.json

The crash looks like this:
```
/app/node_modules/typescript/lib/tsc.js:59841
throw e;
^

Error: Debug Failure.
at checkUnusedClassMembers (/Users/roberto/dev/3pm-appdirect-nodejs/node_modules/typescript/lib/tsc.js:35757:38)
at checkUnusedIdentifiers (/Users/roberto/dev/3pm-appdirect-nodejs/node_modules/typescript/lib/tsc.js:35643:29)
at checkSourceFileWorker (/Users/roberto/dev/3pm-appdirect-nodejs/node_modules/typescript/lib/tsc.js:37913:21)
at checkSourceFile (/Users/roberto/dev/3pm-appdirect-nodejs/node_modules/typescript/lib/tsc.js:37891:13)
at getDiagnosticsWorker (/Users/roberto/dev/3pm-appdirect-nodejs/node_modules/typescript/lib/tsc.js:37945:17)
at Object.getDiagnostics (/Users/roberto/dev/3pm-appdirect-nodejs/node_modules/typescript/lib/tsc.js:37934:24)
at /Users/roberto/dev/3pm-appdirect-nodejs/node_modules/typescript/lib/tsc.js:59858:85
at runWithCancellationToken (/Users/roberto/dev/3pm-appdirect-nodejs/node_modules/typescript/lib/tsc.js:59834:24)
at getSemanticDiagnosticsForFileNoCache (/Users/roberto/dev/3pm-appdirect-nodejs/node_modules/typescript/lib/tsc.js:59848:20)
at getAndCacheDiagnostics (/Users/roberto/dev/3pm-appdirect-nodejs/node_modules/typescript/lib/tsc.js:60059:26)```

I think I hit the same issue here:
https://ci.appveyor.com/project/roblourens/vscode-chrome-debug-core/build/1.0.374

[00:38:32] Using gulpfile C:\projects\vscode-chrome-debug-core\gulpfile.js
[00:38:32] Starting 'build'...
C:\projects\vscode-chrome-debug-corenode_modules\typescript\lib\typescript.js:74441
throw e;
^
Error: Debug Failure.
at checkUnusedClassMembers (C:\projects\vscode-chrome-debug-corenode_modules\typescript\lib\typescript.js:43598:38)
at checkUnusedIdentifiers (C:\projects\vscode-chrome-debug-corenode_modules\typescript\lib\typescript.js:43482:29)
at checkSourceFileWorker (C:\projects\vscode-chrome-debug-corenode_modules\typescript\lib\typescript.js:46156:21)
at checkSourceFile (C:\projects\vscode-chrome-debug-corenode_modules\typescript\lib\typescript.js:46129:13)
at getDiagnosticsWorker (C:\projects\vscode-chrome-debug-corenode_modules\typescript\lib\typescript.js:46194:17)
at Object.getDiagnostics (C:\projects\vscode-chrome-debug-corenode_modules\typescript\lib\typescript.js:46180:24)
at C:\projects\vscode-chrome-debug-corenode_modules\typescript\lib\typescript.js:74462:85
at runWithCancellationToken (C:\projects\vscode-chrome-debug-corenode_modules\typescript\lib\typescript.js:74425:24)
at getSemanticDiagnosticsForFileNoCache (C:\projects\vscode-chrome-debug-corenode_modules\typescript\lib\typescript.js:74448:20)
at getAndCacheDiagnostics (C:\projects\vscode-chrome-debug-corenode_modules\typescript\lib\typescript.js:74684:26)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] prepare: gulp build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] prepare script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\appveyor\AppData\Roaming\npm-cache_logs\2018-02-01T00_38_35_289Z-debug.log
Command exited with code 1

The fix should be already in typescript@next and in the next 2.7.2 release. give typescript@next a try and let us know if you are still seeing issues.

That worked. Thanks :)

We're also experiencing this in 2.6.1 (typescript@next works fine). Is there any way to figure out which file tsc is breaking on?

for this specific call stack, it is a semicolon after a method or accessor declaration in your class. to know which specific class, consider running under a debugger. node --inspect tsc.js --p <proj>

Thanks @mhegazy, that worked great! Much better than me trying to find them with a regexp. :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jonathandturner picture jonathandturner  路  147Comments

RyanCavanaugh picture RyanCavanaugh  路  205Comments

Gaelan picture Gaelan  路  231Comments

rbuckton picture rbuckton  路  139Comments

born2net picture born2net  路  150Comments