Skip to content

runtime: Generator/AsyncGenerator prototype method descriptors + brand checks #4141

Description

@proggeramlug

Summary

%GeneratorPrototype% and %AsyncGeneratorPrototype% are missing their method
property descriptors and method brand checks. A fresh parity sweep (2026-06-02,
after #3664 wired the generator intrinsics) shows 53 runtime failures still
concentrated here — the prototype methods layer wasn't covered by #3664.

Evidence

Descriptor conformance on the prototype methods (next/return/throw/
constructor) — should be configurable:true:

  • GeneratorPrototype/prop-desc.js, AsyncGeneratorPrototype/prop-desc.js
    — "next/return/throw descriptor should be configurable"
  • AsyncGeneratorPrototype/{constructor,length,name}.js
    — "… descriptor should be configurable"

Method brand check / dispatch:

  • AsyncGeneratorPrototype/this-val-not-async-generator.js
    TypeError: then is not a function (should throw a TypeError brand error
    when next/return/throw is called with a non-async-generator this)

(Plus a few async-driver edge cases: "Detected unsettled top-level await",
"request-queue-order" — likely a separate async-generator resumption gap.)

Repro

function* g() {}
const proto = Object.getPrototypeOf(g.prototype);
console.log(Object.getOwnPropertyDescriptor(proto, 'next').configurable); // expect true

const GenProto = Object.getPrototypeOf(Object.getPrototypeOf((function*(){})()));
GenProto.next.call({});   // expect TypeError (this is not a generator)

Suggested scope

Install the generator/async-generator prototype methods with spec-correct
descriptors and add the this-brand check to next/return/throw. The
descriptor half overlaps the builtin-descriptor issue; the brand-check half
overlaps the arg-validation work (#3146) but is specific to the generator
prototypes.


Filed from the parity-gap radar, 2026-06-02 re-sweep. Cluster: 53
Generator/AsyncGeneratorPrototype runtime failures. Follow-on to closed #3664.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions