Skip to content

Compiler crash when index type not found #12572

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
ovangle opened this issue Nov 30, 2016 · 0 comments
Closed

Compiler crash when index type not found #12572

ovangle opened this issue Nov 30, 2016 · 0 comments
Assignees
Labels
Bug A bug in TypeScript

Comments

@ovangle
Copy link

ovangle commented Nov 30, 2016

TypeScript Version: 2.1.1

Code

Compile the following file, with the compiler flag -d

export interface Test {
   [index: TypeNotFound]: any;
}

Expected behavior:

The following errors get printed to console, (errors copied from compiling without -d flag).

test.ts(3,6): error TS1023: An index signature parameter type must be 'string' or 'number'.
test.ts(3,13): error TS2304: Cannot find name 'TypeNotFound'.

Actual behavior:
The compiler crashes with the following stack trace

Error: Debug Failure. False expression: This is unknown parent for parameter: 154
    at Object.assert (/usr/local/lib/node_modules/typescript/lib/tsc.js:1697:23)
    at Object.fail (/usr/local/lib/node_modules/typescript/lib/tsc.js:1702:19)
    at getParameterDeclarationTypeVisibilityDiagnosticMessage (/usr/local/lib/node_modules/typescript/lib/tsc.js:44696:34)
    at Object.getParameterDeclarationTypeVisibilityError [as getSymbolAccessibilityDiagnostic] (/usr/local/lib/node_modules/typescript/lib/tsc.js:44643:41)
    at handleSymbolAccessibilityError (/usr/local/lib/node_modules/typescript/lib/tsc.js:43565:40)
    at emitEntityName (/usr/local/lib/node_modules/typescript/lib/tsc.js:43699:17)
    at emitTypeReference (/usr/local/lib/node_modules/typescript/lib/tsc.js:43715:17)
    at emitType (/usr/local/lib/node_modules/typescript/lib/tsc.js:43660:28)
    at writeTypeOfDeclaration (/usr/local/lib/node_modules/typescript/lib/tsc.js:43590:17)
    at emitParameterDeclaration (/usr/local/lib/node_modules/typescript/lib/tsc.js:44640:17)
@mhegazy mhegazy added the Bug A bug in TypeScript label Nov 30, 2016
@mhegazy mhegazy added this to the TypeScript 2.2 milestone Nov 30, 2016
@mhegazy mhegazy modified the milestones: TypeScript 2.2, TypeScript 2.1.3 Dec 5, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants