Skip to content

Debug Failure. False expression. in collectEnclosingScopes during getApplicableRefactors #20559

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
aozgaa opened this issue Dec 8, 2017 · 4 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue Source: Telemetry The issue relates to the telemetry in editors

Comments

@aozgaa
Copy link
Contributor

aozgaa commented Dec 8, 2017

tsserver version: 2.6.1
hits: at least 773561
stack:

Error: Debug Failure. False expression.
    at Object.first (c:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:1898:15)
    at collectEnclosingScopes (c:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:77840:65)
    at getPossibleExtractionsWorker (c:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:77922:30)
    at getPossibleExtractions (c:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:77881:26)
    at Object.getAvailableActions (c:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:77514:35)
    at c:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:75017:128
    at Object.flatMapIter (c:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:1570:23)
    at Object.getApplicableRefactors (c:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:75016:23)
    at Object.getApplicableRefactors (c:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:80232:32)
    at IOSession.Session.getApplicableRefactors (c:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:86474:53)
    at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (c:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:85436:61)
    at c:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:86669:88
    at IOSession.Session.executeWithRequestId (c:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:86660:28)
    at IOSession.Session.executeCommand (c:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:86669:33)
    at IOSession.Session.onMessage (c:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:86689:35)
    at Interface.<anonymous> (c:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:87881:27)
    at emitOne (events.js:96:13)
    at Interface.emit (events.js:191:7)
    at Interface._onLine (readline.js:241:10)
    at Interface._normalWrite (readline.js:384:12)
    at Socket.ondata (readline.js:101:10)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:191:7)
    at readableAddChunk (_stream_readable.js:178:18)
    at Socket.Readable.push (_stream_readable.js:136:10)
    at Pipe.onread (net.js:560:20)
@aozgaa aozgaa changed the title Debug failure in collectEnclosingScopes during getApplicableRefactors Debug Failure. False expression. in collectEnclosingScopes during getApplicableRefactors Dec 19, 2017
@DanielRosenwasser DanielRosenwasser added the Source: Telemetry The issue relates to the telemetry in editors label Dec 19, 2017
@mhegazy mhegazy added the Bug A bug in TypeScript label Jan 20, 2018
@mhegazy mhegazy added this to the TypeScript 2.8 milestone Jan 20, 2018
@mhegazy
Copy link
Contributor

mhegazy commented Jan 20, 2018

The Source: Telemetry have limited information. we only have the call stack from the crash report. We need to either mitigate the crash, or add additional asserts to get more information in future crash reports.

@amcasey
Copy link
Member

amcasey commented Jan 23, 2018

This appears to indicate that range.range is an empty array (but not undefined?) in collectEnclosingScopes.

@amcasey
Copy link
Member

amcasey commented Jan 23, 2018

The loop assumes that all children of a BlockLike are in Statements. That is not the case for, e.g., the expression of a CaseClause. Curiously though, that case seems to tripping a different assert.

@amcasey
Copy link
Member

amcasey commented Jan 23, 2018

Repro:

switch (x) {
    case /*start*/1:
        break;/*end*/
}

amcasey added a commit to amcasey/TypeScript that referenced this issue Jan 23, 2018
amcasey added a commit to amcasey/TypeScript that referenced this issue Jan 24, 2018
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Jan 24, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue Source: Telemetry The issue relates to the telemetry in editors
Projects
None yet
Development

No branches or pull requests

4 participants