Skip to content

Merge conflict tags in *.tsx crash Typescript compiler #12952

Closed
@guncha

Description

@guncha

TypeScript Version: "2.2.0-dev.20161215"

Code

// index.ts
const x = <div>
<<<<<<< HEAD
# command line
tsc index.ts

Expected behavior:

Show errors about malformed tags.

Actual behavior:

Crashes with assertion failure:

/Users/gunca/Code/jsx-bug/node_modules/typescript/lib/tsc.js:49806
                throw e;
                ^

Error: length < 0
    at createTextSpan (/Users/gunca/Code/jsx-bug/node_modules/typescript/lib/tsc.js:8304:19)
    at Object.createTextSpanFromBounds (/Users/gunca/Code/jsx-bug/node_modules/typescript/lib/tsc.js:8310:16)
    at getErrorSpanForNode (/Users/gunca/Code/jsx-bug/node_modules/typescript/lib/tsc.js:5256:19)
    at createDiagnosticForNodeInSourceFile (/Users/gunca/Code/jsx-bug/node_modules/typescript/lib/tsc.js:5187:20)
    at Object.createDiagnosticForNode (/Users/gunca/Code/jsx-bug/node_modules/typescript/lib/tsc.js:5183:16)
    at error (/Users/gunca/Code/jsx-bug/node_modules/typescript/lib/tsc.js:19749:22)
    at checkJsxPreconditions (/Users/gunca/Code/jsx-bug/node_modules/typescript/lib/tsc.js:29072:17)
    at checkJsxOpeningLikeElement (/Users/gunca/Code/jsx-bug/node_modules/typescript/lib/tsc.js:29082:13)
    at checkJsxSelfClosingElement (/Users/gunca/Code/jsx-bug/node_modules/typescript/lib/tsc.js:28781:13)
    at checkJsxElement (/Users/gunca/Code/jsx-bug/node_modules/typescript/lib/tsc.js:28802:25)

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: JSX/TSXRelates to the JSX parser and emitterFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions