Skip to content

release blocker: object-literal shape path overwrites generator lexical this #9155

Description

@proggeramlug

Release v0.5.1519 Full CI run 33305504723 failed cargo-test-perry (5/8) on exact commit 7b57bbd70f021bd199cdbd53dcbb91a697967b0d.

Failure:

generator_using_own_char_at_in_switch_loop_terminates
TypeError: charAt is not a function

Job: https://github.com/PerryTS/perry/actions/runs/33305504723/job/99241270651

The failure reproduces deterministically on the dedicated Linux server with:

cargo test -p perry --test issue_6065_class_method_shadows_string_char_access generator_using_own_char_at_in_switch_loop_terminates -- --exact --nocapture

Root cause: #9122 added post-build this patching for captures_this closures on the object-literal shape-cache path. Synthesized generator iterator objects are the { next, return, throw } closure literal recognized by is_generator_iterator_object_literal; their step closures already capture the generator invocation's lexical this. The new generic patch loop overwrites that reserved capture with the iterator object itself. Inside a class generator, this.charAt(0) therefore dispatches against { next, return, throw } and throws.

Acceptance:

  • Generator iterator object literals do not overwrite their step closures' lexical this capture.
  • Ordinary object-literal methods using dynamic this still receive the completed object on both shape and by-name paths.
  • issue_6065_class_method_shadows_string_char_access passes in full.
  • Existing object-literal codegen unit tests and formatting pass.
  • Release Full CI passes on the resulting exact release commit.

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