Skip to content

Conversation

mobius29
Copy link
Contributor

@mobius29 mobius29 commented Aug 4, 2025

When a class has no explicit constructor, ClassDefinitionEvaluation step 14.b creates the default constructor via CreateBuiltinFunction.
Later, step 14.a.vi calls InitializeInstanceElements(result, F), which expects its second parameter constructor to be an ECMAScript Function Object. However, actual F's type is a Built-in Function Object and this causes type mismatch.

For example:

class A {}
var x = new A();

This PR fixes the inconsistency in two parts

Fixes #3204.

@ljharb ljharb requested a review from a team August 22, 2025 06:00
Copy link
Member

@michaelficarra michaelficarra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Steps 28 and 29 were already attempting to initialise [[PrivateMethods]] and [[Fields]], so this looks complete.

Copy link
Member

@linusg linusg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@michaelficarra michaelficarra requested a review from a team August 27, 2025 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Synthesized constructor in ClassDefinitionEvaluation is missing [[PrivateMethods]] and [[Fields]]
4 participants