Skip to content

ESM module-init code is lowered with is_strict_fn: false — top-level strictness is wrong for some lowerings #9423

Description

@proggeramlug

Module-init code is lowered with is_strict_fn: false even for an ESM, which is always strict (crates/perry-codegen/src/codegen/entry.rs:825 and :1537; deliberate per entry_outline.rs:677).

It happens not to bite #9394 because a[i] = v lowers to Expr::PutValueSet, which carries the real ctx.current_strict. But any Expr::IndexSet produced by a different lowering — for heads, destructuring — reads the wrong strictness at module top level, so a rejected write there will silently no-op in code that is specified to throw.

No end-to-end reproducer yet; this is a latent correctness hazard found by reading the strictness plumbing while fixing #9394, and it is filed so the next person touching module-init lowering knows the flag is not trustworthy there.

Worth pairing with #(the strict ordinary-object write issue filed alongside this one), since both are about strictness not reaching a store site.

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