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
@bakkot bakkot added the ready to merge Editors believe this PR needs no further reviews, and is ready to land. label Sep 29, 2025
@ljharb ljharb force-pushed the instance-constructor-type branch from 7930b7a to 0008b78 Compare September 30, 2025 04:25
@ljharb ljharb merged commit 0008b78 into tc39:main Sep 30, 2025
8 checks passed
Jack-Works added a commit to engine262/engine262 that referenced this pull request Oct 6, 2025
Jack-Works added a commit to engine262/engine262 that referenced this pull request Oct 23, 2025
jhnaldo pushed a commit to ku-plrg/ecma262 that referenced this pull request Oct 31, 2025
@jhnaldo jhnaldo mentioned this pull request Oct 31, 2025
jhnaldo pushed a commit to ku-plrg/ecma262 that referenced this pull request Oct 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

editorial change ready to merge Editors believe this PR needs no further reviews, and is ready to land.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

6 participants