Skip to content

Crash in writeType when getting codefixes for invalid code #20542

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
RyanCavanaugh opened this issue Dec 7, 2017 · 0 comments
Closed

Crash in writeType when getting codefixes for invalid code #20542

RyanCavanaugh opened this issue Dec 7, 2017 · 0 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@RyanCavanaugh
Copy link
Member

Fourslash test:

/// <reference path="fourslash.ts" />

// @noImplicitAny: true
//// function f(y, z = { p: y[

verify.not.codeFixAvailable([]);

Stack trace:

     TypeError: Cannot read property 'flags' of undefined
      at writeType (src\compiler\checker.ts:3321:29)
      at buildTypeDisplay (src\compiler\checker.ts:3316:24)
      at buildIndexSignatureDisplay (src\compiler\checker.ts:3940:21)
      at writeObjectLiteralType (src\compiler\checker.ts:3664:21)
      at writeLiteralType (src\compiler\checker.ts:3647:21)
      at writeAnonymousType (src\compiler\checker.ts:3542:25)
      at writeType (src\compiler\checker.ts:3359:25)
      at Object.buildTypeDisplay (src\compiler\checker.ts:3316:24)
      at typeToString (src\services\codefixes\inferFromUsage.ts:268:47)
      at src\services\codefixes\inferFromUsage.ts:136:40
      at Object.zipWith (src\compiler\core.ts:220:25)
      at getCodeActionForParameters (src\services\codefixes\inferFromUsage.ts:134:47)
      at Object.getActionsForAddExplicitTypeAnnotation [as getCodeActions] (src\services\codefixes\inferFromUsage.ts:71:24)
      at src\services\codeFixProvider.ts:40:35
      at Object.forEach (src\compiler\core.ts:174:32)
      at Object.getFixes (src\services\codeFixProvider.ts:39:13)
      at src\services\services.ts:1893:32
      at Object.flatMap (src\compiler\core.ts:463:27)
      at Object.getCodeFixesAtPosition (src\services\services.ts:1891:20)
      at Object.proxy.(anonymous function) [as getCodeFixesAtPosition] (src\harness\fourslash.ts:397:66)
      at src\harness\fourslash.ts:2499:45
      at Object.flatMap (src\compiler\core.ts:463:27)
      at TestState.getCodeFixActions (src\harness\fourslash.ts:2494:23)
@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Dec 7, 2017
@RyanCavanaugh RyanCavanaugh self-assigned this Dec 7, 2017
RyanCavanaugh added a commit to RyanCavanaugh/TypeScript that referenced this issue Dec 7, 2017
RyanCavanaugh added a commit to RyanCavanaugh/TypeScript that referenced this issue Dec 7, 2017
@RyanCavanaugh RyanCavanaugh added the Fixed A PR has been merged for this issue label Dec 13, 2017
@mhegazy mhegazy added this to the TypeScript 2.7 milestone Jan 11, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

2 participants