Skip to content

Compiled class declaration static blocks call the original function after reassignment #3653

Open

Description

@nickna
function value(): number { return 1; }
class Holder {
    static {
        value = () => 2;
        console.log(value());
    }
}

Interpretation with --no-tsconfig --noLib prints 2. A saved assembly built with --no-tsconfig --noLib --compile source.ts --verify passes IL verification but prints 1.

This remains after the pending #3651 fix makes class-expression static-block calls honor their class-definition capture's current value. The class-declaration call/storage path still calls the original source function. Its direct-call/captured-function handling needs a separate correction that preserves typed parameter conversions.

Found while testing declaration/anonymous-expression/named-expression controls for #3651 in PR #3650. The separate outer-binding propagation issue for class expressions is tracked in #3652.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions