Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

can't compile angular with tsickle 0.1.4 #151

Closed
alexeagle opened this issue Jun 8, 2016 · 9 comments
Closed

can't compile angular with tsickle 0.1.4 #151

alexeagle opened this issue Jun 8, 2016 · 9 comments
Assignees

Comments

@alexeagle
Copy link
Contributor

I added a bit of debug info. We blow up here:
https://github.com/angular/angular/blob/7aa1790874b76db122a93316d9324029f766c9f3/modules/%40angular/common/src/pipes/async_pipe.ts#L81

when attempting to this.typeChecker.getTypeAtLocation(param.type) of the ChangeDetectorRef-typed parameter.

get type of  NodeObject {
  kind: 141,
  pos: 2749,
  end: 2772,
  flags: 0,
  parent:
   NodeObject {
     kind: 147,
     pos: 2733,
     end: 2795,
     flags: 0,
     parent:
      NodeObject {
        kind: 220,
        pos: 1281,
        end: 4497,
        flags: 1,
        parent: [Object],
        decorators: [Object],
        modifiers: [Object],
        name: [Object],
        typeParameters: undefined,
        heritageClauses: [Object],
        members: [Object],
        _children: [Object] },
     decorators: undefined,
     typeParameters: undefined,
     parameters: [ [Circular], pos: 2749, end: 2772 ],
     body:
      NodeObject {
        kind: 198,
        pos: 2773,
        end: 2795,
        flags: 0,
        parent: [Circular],
        statements: [Object] } },
  decorators: undefined,
  dotDotDotToken: undefined,
  name:
   NodeObject {
     kind: 69,
     pos: 2749,
     end: 2753,
     flags: 0,
     parent: [Circular],
     text: '_ref' },
  questionToken: undefined,
  type:
   NodeObject {
     kind: 154,
     pos: 2754,
     end: 2772,
     flags: 0,
     parent: [Circular],
     typeName:
      NodeObject {
        kind: 69,
        pos: 2754,
        end: 2772,
        flags: 0,
        parent: [Circular],
        text: 'ChangeDetectorRef' } },
  initializer: undefined }
Unable to convert  /Users/alexeagle/Projects/angular/modules/@angular/common/src/pipes/async_pipe.ts
TypeError: Cannot read property 'members' of undefined
    at resolveName (/Users/alexeagle/Projects/angular/node_modules/typescript/lib/typescript.js:15593:73)
    at resolveEntityName (/Users/alexeagle/Projects/angular/node_modules/typescript/lib/typescript.js:16013:26)
    at getTypeFromTypeReference (/Users/alexeagle/Projects/angular/node_modules/typescript/lib/typescript.js:19262:54)
    at getTypeFromTypeNode (/Users/alexeagle/Projects/angular/node_modules/typescript/lib/typescript.js:19594:28)
    at Object.getTypeOfNode [as getTypeAtLocation] (/Users/alexeagle/Projects/angular/node_modules/typescript/lib/typescript.js:29896:24)
    at ClassRewriter.gatherConstructor (/Users/alexeagle/Projects/angular/node_modules/tsickle/build/src/decorator-annotator.js:63:44)
    at ClassRewriter.maybeProcess (/Users/alexeagle/Projects/angular/node_modules/tsickle/build/src/decorator-annotator.js:112:22)
    at ClassRewriter.Rewriter.visit (/Users/alexeagle/Projects/angular/node_modules/tsickle/build/src/rewriter.js:32:19)
    at ClassRewriter.Rewriter.writeNode (/Users/alexeagle/Projects/angular/node_modules/tsickle/build/src/rewriter.js:64:18)
    at ClassRewriter.Rewriter.visit (/Users/alexeagle/Projects/angular/node_modules/tsickle/build/src/rewriter.js:33:18)
Compilation failed

fyi @martine

@alexeagle alexeagle self-assigned this Jun 8, 2016
@evmar
Copy link
Contributor

evmar commented Jun 8, 2016

The stacktrace points at this:

        let sym = this.typeChecker.getTypeAtLocation(param.type).getSymbol();

Maybe try getTypeAtLocation on param.name instead?

@alexeagle
Copy link
Contributor Author

getTypeAtLocation(param.name) returns undefined.

I thought that the different typescript version was the likely problem, but upgrading [email protected] I still can't reproduce this issue in tsickle's unit test.

@evmar
Copy link
Contributor

evmar commented Jun 8, 2016

microsoft/TypeScript#8136 seems like the same stack. Regardless of using the API right, mhegazy observes that it shouldn't crash.

@alexeagle
Copy link
Contributor Author

I agree, there's surely a repro for this we could add in TS somewhere but it would be daunting to find the right spot...

Interesting that it can repro with 1.8 and 1.9-dev

@alexeagle
Copy link
Contributor Author

oops, that fix broke the build, trying again...

@alexeagle alexeagle reopened this Jun 8, 2016
@vicb
Copy link

vicb commented Jun 9, 2016

/subscribe

@alexeagle
Copy link
Contributor Author

after great debugging, this turned out to be simple: the source file being passed to tsickle wasn't type-checked so it had no symbol table references. Was a bug in my tsickle update PR.
Thanks @martine...

@mprobst
Copy link
Contributor

mprobst commented Jun 9, 2016

Oh dear. Well, good that we finally figured it out.

@vicb
Copy link

vicb commented Jun 10, 2016

👍

On Thu, Jun 9, 2016 at 3:58 PM, Martin Probst [email protected]
wrote:

Oh dear. Well, good that we finally figured it out.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#151 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAPL8vHz5p1PDdjkEawJoiAywh5O_DsHks5qKJqXgaJpZM4Iwh6Y
.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants