Closed
Description
TypeScript Version: nightly (2.6.0-dev.20170913)
Try the refactoring on the following code:
Code
function MyClass() {
}
MyClass.prototype.foo = function(x) {
switch(x) {
case 0:
}
}
Expected behavior:
The refactoring is applied
Actual behavior:
The code is unchanged, an error is thrown:
[Error - 13:34:21] 'getEditsForRefactor' request failed with error.
Error processing request. Debug Failure. False expression.
Error: Debug Failure. False expression.
at getPos (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:72799:22)
at assignPositionsToNodeArray (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:73238:29)
at Object.visitEachChild (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:43037:104)
at assignPositionsToNode (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:73226:30)
at Object.visitNodes (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:42752:48)
at assignPositionsToNodeArray (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:73233:30)
at Object.visitEachChild (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:42995:49)
at assignPositionsToNode (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:73226:30)
at visitNode (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:42715:23)
at Object.visitEachChild (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:42969:100)
at assignPositionsToNode (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:73226:30)
at Object.visitNodes (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:42752:48)
at assignPositionsToNodeArray (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:73233:30)
at Object.visitEachChild (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:42943:45)
at assignPositionsToNode (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:73226:30)
at visitNode (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:42715:23)
at visitFunctionBody (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:42798:23)
at Object.visitEachChild (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:42837:510)
at assignPositionsToNode (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:73226:30)
at Object.visitNodes (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:42752:48)
at assignPositionsToNodeArray (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:73233:30)
at Object.visitEachChild (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:42983:355)
at assignPositionsToNode (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:73226:30)
at getNonformattedText (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:73202:52)
at ChangeTracker.getFormattedTextOfNode (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:73169:40)
at ChangeTracker.computeNewText (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:73163:33)
at c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:73138:44
at Map.forEach (native)
at ChangeTracker.getChanges (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:73131:32)
at Object.getEditsForAction (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:74917:42)
at Object.getEditsForRefactor (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:73396:41)
at Object.getEditsForRefactor (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:77392:32)
at IOSession.Session.getEditsForRefactor (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:83294:59)
at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:82256:61)
at c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:83470:88
at IOSession.Session.executeWithRequestId (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:83461:28)
at IOSession.Session.executeCommand (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:83470:33)
at IOSession.Session.onMessage (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:83490:35)
at Interface.<anonymous> (c:\GitTF\Aktuell\WebDispo\node_modules\typescript\lib\tsserver.js:84621: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)
Note that it works in 2.5.2.
It also works in nightly if you add any statement after case 0:
.