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

AsyncGenerator: does not implement [Symbol.asyncIterator] #820

Closed
1 task done
mfulton26 opened this issue Sep 22, 2022 · 4 comments
Closed
1 task done

AsyncGenerator: does not implement [Symbol.asyncIterator] #820

mfulton26 opened this issue Sep 22, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@mfulton26
Copy link

mfulton26 commented Sep 22, 2022

Bug Description

AsyncGenerator instances in Hermes do not conform to the async iterable protocol as they do not implement [Symbol.asyncIterator]

  • I have run gradle clean and confirmed this bug does not occur with JSC

Hermes version: (How do I look this up? I'm using whatever version I would have after follow these instructions. 0.70.1?)
React Native version (if any): 0.70.1
OS version (if any):
Platform (most likely one of arm64-v8a, armeabi-v7a, x86, x86_64):

Steps To Reproduce

console.log(Symbol.asyncIterator in (async function* () {})());
console.log(Symbol.iterator in (function* () {})());

The Expected Behavior

 LOG  true
 LOG  true

The Actual Behavior

 LOG  false
 LOG  true
@mfulton26 mfulton26 added the bug Something isn't working label Sep 22, 2022
@tmikov
Copy link
Contributor

tmikov commented Sep 22, 2022

Hi,
Thank you for reporting this. Hermes doesn't support async generators, which were introduced in ES2018. If I try to compile your example, I get:

bug.js:1:38: error: async generators are unsupported
console.log(Symbol.asyncIterator in (async function* () {})());
                                     ^~~~~~~~~~~~~~~~~~~~~

We will add them to Hermes, but at this time we don't have a concrete timeline.

@tmikov tmikov added enhancement New feature or request and removed bug Something isn't working labels Sep 22, 2022
@mfulton26
Copy link
Author

I did not realize that async generators were introduced after generators; thank you for providing that clarity

I didn't see any compilation errors in my React Native project (at build time nor at run time); that might be a separate issue in and of itself

thank you

@tmikov
Copy link
Contributor

tmikov commented Sep 22, 2022

There is probably a Babel pass for async generators that runs first, so Hermes doesn't see them at all. It is possible that the Babel transform is not fully spec compliant, but still usable?

@tmikov
Copy link
Contributor

tmikov commented May 16, 2023

This will be implemented when we transition to support the corresponding version of EcmaScript.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants