Compiled async generator yield-star skips custom synchronous iterators

Aperta
#3,634 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
csharp, typescript
Ambito
compilers

Direzione di ricerca

Start by reproducing the snippet with the interpreter and with a saved assembly built using --compile --verify, both under --no-tsconfig --noLib. The interpreter prints 7 false and the compiled build prints undefined true, so the gap is in how compiled async-generator yield* falls back to a synchronous Symbol.iterator when Symbol.asyncIterator is absent. Done means the compiled output matches 7 false and still passes verification.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

const iterable: any = {
    [Symbol.iterator]() {
        let done = false;
        return {
            next() {
                if (done) return { done };
                done = true;
                return { done: false, value: 7 };
            }
        };
    }
};
async function* gen() { yield* iterable; }
gen().next().then(result => console.log(result.value, result.done),
    error => console.log(error.name, error.message));

Run with --no-tsconfig --noLib. Node (with the type annotation removed) and the SharpTS interpreter print 7 false. A saved SharpTS assembly built with --compile --verify passes IL verification and prints undefined true.

When Symbol.asyncIterator is absent, async-generator delegation should adapt the guest's synchronous Symbol.iterator. This is the synchronous fallback case discovered while verifying #3616.

Lingua principale
C#
Stelle
156
Fork
4
Merge medio
16h 37m
PR unite (30g)
41

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di nickna/SharpTS

Tutte le issue di nickna/SharpTS

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.