Skip to content

Error: Debug Failure. False expression: Changes overlap #27700

@jttoday

Description

@jttoday

TypeScript Version: 3.1.2

Search Terms:
Error: Debug Failure. False expression: Changes overlap
Code

const ts = require("typescript");
const tmpFileName = "/tmp/whatever.tsx";
const source = `
export class A extends B {
    del(id, idx) {
    }

    func() {
        return e => {
            this.del(item.id, idx);
        }
    }
}
`;
const compilerOptions = {
};

const servicesHost = {
    getScriptFileNames: () => [tmpFileName],
    getScriptVersion: fileName => '0',
    getScriptSnapshot: fileName => {
        return ts.ScriptSnapshot.fromString(source);
    },
    getCurrentDirectory: () => process.cwd(),
    getCompilationSettings: () => compilerOptions,
    getDefaultLibFileName: options => ts.getDefaultLibFilePath(options),
};
const languageService = ts.createLanguageService(
    servicesHost,
    ts.createDocumentRegistry()
);

const codeFixes = languageService.getCombinedCodeFix(
    { fileName: tmpFileName, type: "file" },
    "unusedIdentifier_delete",
    {},
    {}
);

Expected behavior:
Get the correct code fixes
Actual behavior:
throw Error

/project/node_modules/_typescript@3.1.2@typescript/lib/typescript.js:1428
            throw e;
            ^

Error: Debug Failure. False expression: Changes overlap
Verbose Debug Information: {"pos":82,"end":134} and {"pos":110,"end":119}
    at _loop_17 (/project/node_modules/_typescript@3.1.2@typescript/lib/typescript.js:106231:34)
    at /project/node_modules/_typescript@3.1.2@typescript/lib/typescript.js:106237:25
    at Array.map (<anonymous>)
    at Object.getTextChangesFromChanges (/project/node_modules/_typescript@3.1.2@typescript/lib/typescript.js:106225:86)
    at ChangeTracker.getChanges (/project/node_modules/_typescript@3.1.2@typescript/lib/typescript.js:106195:45)
    at Function.ChangeTracker.with (/project/node_modules/_typescript@3.1.2@typescript/lib/typescript.js:105759:32)
    at Object.codeFixAll (/project/node_modules/_typescript@3.1.2@typescript/lib/typescript.js:106726:60)
    at Object.getAllCodeActions (/project/node_modules/_typescript@3.1.2@typescript/lib/typescript.js:109480:32)
    at Object.getAllFixes (/project/node_modules/_typescript@3.1.2@typescript/lib/typescript.js:106713:81)
    at Object.getCombinedCodeFix (/project/node_modules/_typescript@3.1.2@typescript/lib/typescript.js:115437:31)

Related Issues:
#27305

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptCrashFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions