Skip to content

Assertion violation in "move to new file" #58806

@DanielRosenwasser

Description

@DanielRosenwasser

Related to #58801, but this one has a leading comment at the top. Found by @burkeholland.

[|// this file extends the string prototype

interface String {
    reverse(): string;
}

String.prototype.reverse = function (): string {
    return this.split("").reverse().join("");
}|]
  1. Select the provided range.
  2. Request the "move to a new file" refactoring.

This currently triggers the following assertion violation:

Error: Debug Failure. False expression: Changes overlap
Verbose Debug Information: {"pos":0,"end":233} and {"pos":84,"end":84}
    at .../typescript.js:175225:15
    at mapDefined (.../typescript.js:2708:22)
    at Object.getTextChangesFromChanges (.../typescript.js:175221:12)
    at _ChangeTracker.getChanges (.../typescript.js:175118:35)
    at _ChangeTracker.with (.../typescript.js:174600:20)
    at Object.getRefactorEditsToMoveToNewFile [as getEditsForAction] (.../typescript.js:144707:60)
    at Object.getEditsForRefactor (.../typescript.js:142843:31)
    at Object.getEditsForRefactor2 [as getEditsForRefactor] (.../typescript.js:150169:32)
    at IpcIOSession.getEditsForRefactor (.../typescript.js:191385:49)
    at getEditsForRefactor (.../typescript.js:189603:43)
    at .../typescript.js:191789:69
    at IpcIOSession.executeWithRequestId (.../typescript.js:191781:14)
    at IpcIOSession.executeCommand (.../typescript.js:191789:29)
    at IpcIOSession.onMessage (.../typescript.js:191831:51)
    at process.<anonymous> (.../tsserver.js:523:14)
    at process.emit (node:events:514:28)
    at emit (node:internal/child_process:951:14)
    at process.processTicksAndRejections (node:internal/process/task_queues:83:21)

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: LS: Refactoringse.g. extract to constant or function, rename symbolEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Help WantedYou can do thisRescheduledThis issue was previously scheduled to an earlier milestone

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions