Skip to content

Transpiling an asynchronous generator causes an internal compiler exception #4144

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
weswigham opened this issue Aug 4, 2015 · 4 comments
Closed
Assignees
Labels
Bug A bug in TypeScript Duplicate An existing issue was already created Fixed A PR has been merged for this issue

Comments

@weswigham
Copy link
Member

Attempting to ts.transpile this async generator

async function*(f) { yield f; }

throws

TypeError: Cannot read property 'members' of undefined
    at resolveDeclaredMembers (D:\repos\TypeScript\built\local\typescript.js:15456:65)
    at resolveTypeReferenceMembers (D:\repos\TypeScript\built\local\typescript.js:15486:26)
    at resolveStructuredTypeMembers (D:\repos\TypeScript\built\local\typescript.js:15705:21)
    at getPropertiesOfObjectType (D:\repos\TypeScript\built\local\typescript.js:15713:24)
    at propertiesRelatedTo (D:\repos\TypeScript\built\local\typescript.js:17272:34)
    at objectTypeRelatedTo (D:\repos\TypeScript\built\local\typescript.js:17238:30)
    at isRelatedTo (D:\repos\TypeScript\built\local\typescript.js:17062:34)
    at checkTypeRelatedTo (D:\repos\TypeScript\built\local\typescript.js:16929:26)
    at checkTypeAssignableTo (D:\repos\TypeScript\built\local\typescript.js:16902:20)
    at isTypeAssignableTo (D:\repos\TypeScript\built\local\typescript.js:16896:20)

annotating the generator return value in any way causes the exception to not be thrown. This also only happens when the async generator is anonymous.

I know that async generators aren't technically valid JS, but attempting to transpile one probably shouldn't throw.

@DanielRosenwasser
Copy link
Member

Looks like a duplicate of #3978, I'll let @rbuckton close this since I think it'd be a worthwhile test.

@mhegazy mhegazy added the Bug A bug in TypeScript label Aug 4, 2015
@mhegazy mhegazy added this to the TypeScript 1.6 milestone Aug 4, 2015
@rbuckton
Copy link
Contributor

rbuckton commented Aug 4, 2015

@weswigham: I'm unable to repro this against master, though async generators are not themselves supported in TypeScript. What version of the compiler are you using? Can you try this against our nightly builds? If you are using node, you can run npm install typescript@next to install the most recent nightly build locally in node_modules/.

@weswigham
Copy link
Member Author

This repo'd using the jake build version at 4c7b214.

@rbuckton
Copy link
Contributor

This fails for the same reason as #3978, though asynchronous generators are still not supported.

@rbuckton rbuckton added the Duplicate An existing issue was already created label Aug 28, 2015
@rbuckton rbuckton added the Fixed A PR has been merged for this issue label Aug 28, 2015
@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 Duplicate An existing issue was already created Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

4 participants