Skip to content
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

Error: Debug Failure. False expression: Unexpected node. #11933

Closed
ghost opened this issue Oct 29, 2016 · 21 comments
Closed

Error: Debug Failure. False expression: Unexpected node. #11933

ghost opened this issue Oct 29, 2016 · 21 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@ghost
Copy link

ghost commented Oct 29, 2016

TypeScript Version: nightly (2.1.0-dev.20161028)

I'm not sure what code is causing this issue, as I have a few dozen code files and no particular file seems to be called out in the error.

Error: Debug Failure. False expression: Unexpected node.
Verbose Debug Information: Node 136 was unexpected.
    at Object.assert (C:\Users\error\Documents\src\working\r3-repro\node_modules\typescript\lib\tsc.js:1711:23)
    at Object.Debug.failBadSyntaxKind (C:\Users\error\Documents\src\working\r3-repro\node_modules\typescript\lib\tsc.js:35627:55)
    at serializeTypeNode (C:\Users\error\Documents\src\working\r3-repro\node_modules\typescript\lib\tsc.js:36745:30)
    at serializeTypeNode (C:\Users\error\Documents\src\working\r3-repro\node_modules\typescript\lib\tsc.js:36721:56)
    at serializeTypeOfNode (C:\Users\error\Documents\src\working\r3-repro\node_modules\typescript\lib\tsc.js:36616:28)
    at addOldTypeMetadata (C:\Users\error\Documents\src\working\r3-repro\node_modules\typescript\lib\tsc.js:36566:120)
    at addTypeMetadata (C:\Users\error\Documents\src\working\r3-repro\node_modules\typescript\lib\tsc.js:36560:17)
    at transformAllDecoratorsOfDeclaration (C:\Users\error\Documents\src\working\r3-repro\node_modules\typescript\lib\tsc.js:36479:13)
    at generateClassElementDecorationExpression (C:\Users\error\Documents\src\working\r3-repro\node_modules\typescript\lib\tsc.js:36504:40)
    at generateClassElementDecorationExpressions (C:\Users\error\Documents\src\working\r3-repro\node_modules\typescript\lib\tsc.js:36490:34)                      

Here is the tsconfig:

{
    "compilerOptions": {
        "target": "es2015",
        "outDir": "js",
        "module": "system",
        "moduleResolution": "node",
        "lib": [ "dom", "es2017" ],
        "rootDirs": [ "ts", "../ts" ],
        "types": [ "systemjs", "mathjs" ],
        "allowSyntheticDefaultImports": false,
        "experimentalDecorators": true,
        "emitDecoratorMetadata": true,
        "strictNullChecks": false
    },
    "include": [
        "ts/**/*",
        "../ts/**/*"
    ]
}
@ghost
Copy link
Author

ghost commented Oct 29, 2016

I am going to attempt to isolate the issue by removing code until the issue goes away.

@ghost
Copy link
Author

ghost commented Oct 29, 2016

Actually, the issue seems to be resolved in (2.1.0-dev.20161029)

@ghost ghost closed this as completed Oct 29, 2016
@ghost
Copy link
Author

ghost commented Oct 31, 2016

Issue seems to be related to Node 7. Not resolved.

@ghost ghost reopened this Oct 31, 2016
@ghost
Copy link
Author

ghost commented Oct 31, 2016

Issue seems to be with

import { Component, ViewChild, Input, Output, EventEmitter } from '@angular/core';
import { ModalDirective } from 'ng2-bootstrap';

@Component( {
    selector: 'modal-choose',
    templateUrl: 'templates/modal/choose.html'
} )
export class ModalChooseComponent {
    @ViewChild('chooseModal')
    protected chooseModal: ModalDirective;

    @Output()
    public onChoose = new EventEmitter<string>();

    @Input()
    public title = '';

    @Input()
    public prompt = '';

    @Input()
    public buttons = [] as string[];

    @Input( 'default-button' )

public defaultButton: string|undefined;

    protected dismiss() {
        const { defaultButton } = this;
        if( defaultButton ) {
            this.choose( defaultButton );
        } else {
            this.hide();
        }
    }

    protected choose( button: string ) {
        this.onChoose.next( button );
        this.hide();
    }

    public show() {
        const { chooseModal } = this;
        chooseModal.show();
    }

    public hide() {
        const { chooseModal } = this;
        chooseModal.hide();
    }
}

@mhegazy
Copy link
Contributor

mhegazy commented Oct 31, 2016

I can ont get the error to reproduce locally. can you share more context?

@mhegazy mhegazy added Needs More Info The issue still hasn't been fully clarified Bug A bug in TypeScript labels Oct 31, 2016
@ghost
Copy link
Author

ghost commented Oct 31, 2016

git clone https://github.com/errorx666/r3 --branch repro-11933
cd r3
npm install
node node_modules/typescript/bin/tsc -p client/tsconfig.json

@mhegazy
Copy link
Contributor

mhegazy commented Oct 31, 2016

this is what i am seeing following these steps:

c:\test\11933\r3>node node_modules/typescript/bin/tsc -p client/tsconfig.json
client/ts/components/board.ts(3,28): error TS2307: Cannot find module 'rxjs/Rx'.
client/ts/components/board.ts(5,79): error TS2307: Cannot find module '@angular/core'.
client/ts/components/chat.ts(1,28): error TS2307: Cannot find module 'rxjs/Rx'.
client/ts/components/chat.ts(2,56): error TS2307: Cannot find module '@angular/core'.
client/ts/components/game.ts(6,45): error TS2307: Cannot find module 'rxjs/Rx'.
client/ts/components/game.ts(8,34): error TS2307: Cannot find module '@angular/core'.
client/ts/components/lobby.ts(1,38): error TS2307: Cannot find module '@angular/core'.
client/ts/components/modal/choose.ts(1,67): error TS2307: Cannot find module '@angular/core'.
client/ts/components/modal/choose.ts(2,32): error TS2307: Cannot find module 'ng2-bootstrap'.
client/ts/components/modal/create-room.ts(1,38): error TS2307: Cannot find module '@angular/core'.
client/ts/components/modal/create-room.ts(3,32): error TS2307: Cannot find module 'ng2-bootstrap'.
client/ts/components/r3.ts(1,45): error TS2307: Cannot find module '@angular/core'.
client/ts/components/room.ts(1,27): error TS2307: Cannot find module '@angular/core'.
client/ts/default.ts(3,40): error TS2307: Cannot find module '@angular/platform-browser-dynamic'.
client/ts/modules/app.ts(1,26): error TS2307: Cannot find module '@angular/core'.
client/ts/modules/app.ts(2,31): error TS2307: Cannot find module '@angular/platform-browser'.
client/ts/modules/app.ts(3,30): error TS2307: Cannot find module '@angular/common'.
client/ts/modules/app.ts(4,29): error TS2307: Cannot find module '@angular/forms'.
client/ts/modules/app.ts(5,28): error TS2307: Cannot find module '@angular/http'.
client/ts/modules/modal.ts(1,26): error TS2307: Cannot find module '@angular/core'.
client/ts/modules/modal.ts(2,30): error TS2307: Cannot find module '@angular/common'.
client/ts/modules/modal.ts(3,29): error TS2307: Cannot find module '@angular/forms'.
client/ts/modules/modal.ts(5,47): error TS2307: Cannot find module 'ng2-bootstrap'.
client/ts/services/game.ts(1,36): error TS2307: Cannot find module '@angular/core'.
client/ts/services/room.ts(1,60): error TS2307: Cannot find module 'rxjs/Rx'.
client/ts/services/room.ts(2,36): error TS2307: Cannot find module '@angular/core'.
client/ts/services/session.ts(1,43): error TS2307: Cannot find module 'rxjs/Rx'.
client/ts/services/session.ts(2,28): error TS2307: Cannot find module '@angular/core'.
ts/fsm.ts(1,28): error TS2307: Cannot find module 'rxjs/Observable'.
ts/fsm.ts(2,33): error TS2307: Cannot find module 'rxjs/BehaviorSubject'.
ts/fsm.ts(3,33): error TS2307: Cannot find module 'rxjs/observable/ArrayObservable'.

@ghost
Copy link
Author

ghost commented Oct 31, 2016

@mhegazy Sounds like you need to npm install both dev and production dependencies. My mistake.

@mhegazy
Copy link
Contributor

mhegazy commented Oct 31, 2016

no luck still:

c:\test\11933\r3>node node_modules/typescript/bin/tsc -p client/tsconfig.json

c:\test\11933\r3>echo %ERRORLEVEL%
0

@ghost
Copy link
Author

ghost commented Oct 31, 2016

I've repro'd this on 4 different machines now. 2 are Windows 10 x64, 1 is Windows 7 x64, one is Linux x64. Node v6.9.1 and Node v7.

image

@Strate
Copy link

Strate commented Nov 30, 2016

Almost same issue with typescript@2.2.0-dev.20161130 and typescript@2.1.1 (rc):

Error: Debug Failure. False expression: Unexpected node.
Verbose Debug Information: Node 94 (NullKeyword) was unexpected.
    at Object.assert (/devel/src/hotfix/megaplan/front/node_modules/typescript/lib/typescript.js:3164:23)
    at Object.Debug.failBadSyntaxKind (/devel/src/hotfix/megaplan/front/node_modules/typescript/lib/typescript.js:44736:55)
    at serializeTypeNode (/devel/src/hotfix/megaplan/front/node_modules/typescript/lib/typescript.js:46685:30)
    at serializeTypeNode (/devel/src/hotfix/megaplan/front/node_modules/typescript/lib/typescript.js:46653:56)
    at serializeTypeOfNode (/devel/src/hotfix/megaplan/front/node_modules/typescript/lib/typescript.js:46514:28)
    at addOldTypeMetadata (/devel/src/hotfix/megaplan/front/node_modules/typescript/lib/typescript.js:46438:92)
    at addTypeMetadata (/devel/src/hotfix/megaplan/front/node_modules/typescript/lib/typescript.js:46432:17)
    at transformAllDecoratorsOfDeclaration (/devel/src/hotfix/megaplan/front/node_modules/typescript/lib/typescript.js:46271:13)
    at generateClassElementDecorationExpression (/devel/src/hotfix/megaplan/front/node_modules/typescript/lib/typescript.js:46318:40)
    at generateClassElementDecorationExpressions (/devel/src/hotfix/megaplan/front/node_modules/typescript/lib/typescript.js:46298:34)

But happens only with ts-loader or awesome-typescript-loader.

UPD.

happens if emitDecoratorMetadata & experimentalDecorators and property has a decorator like

class BLabla {
  @inject private member: Member | null = null;
}

then:

  1. metadata emitted as Object, not as Member (this might be a breaking change!)
  2. Exception described above is raised.

@mhegazy
Copy link
Contributor

mhegazy commented Nov 30, 2016

metadata emitted as Object, not as Member (this might be a breaking change!)

Object is what i expect. union types in general are represented as Object.

Exception described above is raised.

Can you share more context. i can not get this to repro locally:

c:\test>type a.ts
class Member { }

class BLabla {
  @inject private member: Member | null = null;
}

c:\test>tsc --v
Version 2.2.0-dev.20161130

c:\test>tsc a.ts --emitDecoratorMetadata --experimentalDecorators
a.ts(4,4): error TS2304: Cannot find name 'inject'.

@zhouweiming
Copy link

zhouweiming commented Dec 6, 2016

@mhegazy @Strate Hi, i get almost same errors in my project and more detail here:

http://stackoverflow.com/questions/40990736/error-debug-failure-false-expression-unexpected-node-when-typescript-upgrade

I think the issue should be caused by typescript@2.1 or awesome-typescript-loader, but I haven't solved it yet.

I get the same errors with typescript@2.2.0-dev.20161206.

@ghost
Copy link
Author

ghost commented Dec 6, 2016

I never pinpointed the issue, but I was not using awesome-typescript-loader (or webpack), so I do not think that is related.

@mhegazy
Copy link
Contributor

mhegazy commented Dec 6, 2016

A repro project would be appreciated.

@mhegazy mhegazy added this to the TypeScript 2.2 milestone Dec 6, 2016
@sheetalkamat
Copy link
Member

@errorx666 I tried repro steps in #11933 (comment) and just like @mhegazy I haven't been able to repro this. Need a repro to be able to look into this. Thanks.

@aluanhaddad
Copy link
Contributor

For the related issue, #12684 I was able to repro immediately using the instructions in #12684 (comment)

@sheetalkamat
Copy link
Member

I am not sure what kind of interactions with the plugins going there in the repro. But if I did below steps I don't repro the issue:

>node tsc --v
Version 2.2.0

>node tsc -p c:\repro\tsissuedemo\src

>echo %ERRORLEVEL%
0

@mhegazy mhegazy added Fixed A PR has been merged for this issue and removed Needs More Info The issue still hasn't been fully clarified labels Dec 20, 2016
@mhegazy mhegazy closed this as completed Dec 21, 2016
@ASHISH060792
Copy link

Any solution

ERROR in ./node_modules/crypto-js/core.js
Module build failed: Error: Debug Failure. False expression.
at getJSDocTags (G:\Projects\Angular_Projects\Live_Projects\Git\dataguruWebApp\node_modules@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:13173:22)
at getFirstJSDocTag (G:\Projects\Angular_Projects\Live_Projects\Git\dataguruWebApp\node_modules@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:13181:24)
at Object.getJSDocTypeTag (G:\Projects\Angular_Projects\Live_Projects\Git\dataguruWebApp\node_modules@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:13130:19)
at checkParenthesizedExpression (G:\Projects\Angular_Projects\Live_Projects\Git\dataguruWebApp\node_modules@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:45552:56)
at checkExpressionWorker (G:\Projects\Angular_Projects\Live_Projects\Git\dataguruWebApp\node_modules@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:45600:28)
at checkExpression (G:\Projects\Angular_Projects\Live_Projects\Git\dataguruWebApp\node_modules@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:45533:42)
at checkBinaryLikeExpression (G:\Projects\Angular_Projects\Live_Projects\Git\dataguruWebApp\node_modules@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:45082:29)
at checkBinaryExpression (G:\Projects\Angular_Projects\Live_Projects\Git\dataguruWebApp\node_modules@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:45074:20)
at checkExpressionWorker (G:\Projects\Angular_Projects\Live_Projects\Git\dataguruWebApp\node_modules@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:45626:28)
at checkExpression (G:\Projects\Angular_Projects\Live_Projects\Git\dataguruWebApp\node_modules@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:45533:42)
at checkExpressionCached (G:\Projects\Angular_Projects\Live_Projects\Git\dataguruWebApp\node_modules@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:45384:38)
at getTypeOfExpression (G:\Projects\Angular_Projects\Live_Projects\Git\dataguruWebApp\node_modules@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:45504:28)
at checkDeclarationInitializer (G:\Projects\Angular_Projects\Live_Projects\Git\dataguruWebApp\node_modules@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:45396:24)
at getTypeForVariableLikeDeclaration (G:\Projects\Angular_Projects\Live_Projects\Git\dataguruWebApp\node_modules@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:30667:28)
at getWidenedTypeForVariableLikeDeclaration (G:\Projects\Angular_Projects\Live_Projects\Git\dataguruWebApp\node_modules@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:30890:24)
at getTypeOfVariableOrParameterOrProperty (G:\Projects\Angular_Projects\Live_Projects\Git\dataguruWebApp\node_modules@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:30991:28)

@mhegazy
Copy link
Contributor

mhegazy commented Jun 7, 2018

@ASHISH060792 this is almost 2 years old issue with some 8 releases in between.

Please file a new issue, and give us some repro steps, or sample project to be able to help you out.

@jindalrohit
Copy link

@ASHISH060792 Did you get any solution for this? I am also facing the same issue.

@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 Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

7 participants