Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editorial: Narrow return type of CreateBuiltinFunction #3437

Merged
merged 1 commit into from
Oct 16, 2024

Conversation

kimjg1119
Copy link
Contributor

The return type of CreateBuiltinFunction is a function object. However, as indicated by its name, the return type should more specifically be identified as a built-in function object.

This distinction clarifies an operation in ClassDefinitionEvaluation, where MakeConstructor requires either an ECMAScript function object or a built-in function object.

14.b. Let F be CreateBuiltinFunction(defaultConstructor, 0, className, « [[ConstructorKind]], [[SourceText]] », the current Realm Record, constructorParent).
...
16. Perform MakeConstructor(F, false, proto).

cf. It also resolves some ESMeta errors.

ESMeta logs

[ParamTypeMismatch] Call[14206] argument assignment to first parameter _F_ when Call[14181] function call from ClassTail[0,0].ClassDefinitionEvaluation (step 16, 59:20-58) to MakeConstructor
- expected: Record[BuiltinFunctionObject | ECMAScriptFunctionObject]
- actual  : Record[FunctionObject]

[ParamTypeMismatch] Call[14391] argument assignment to first parameter _F_ when Call[14361] function call from ClassTail[0,1].ClassDefinitionEvaluation (step 16, 59:20-58) to MakeConstructor
- expected: Record[BuiltinFunctionObject | ECMAScriptFunctionObject]
- actual  : Record[FunctionObject]

[ParamTypeMismatch] Call[14576] argument assignment to first parameter _F_ when Call[14541] function call from ClassTail[0,2].ClassDefinitionEvaluation (step 16, 59:20-58) to MakeConstructor
- expected: Record[BuiltinFunctionObject | ECMAScriptFunctionObject]
- actual  : Record[FunctionObject]

[ParamTypeMismatch] Call[14761] argument assignment to first parameter _F_ when Call[14721] function call from ClassTail[0,3].ClassDefinitionEvaluation (step 16, 59:20-58) to MakeConstructor
- expected: Record[BuiltinFunctionObject | ECMAScriptFunctionObject]
- actual  : Record[FunctionObject]

@michaelficarra michaelficarra added the editor call to be discussed in the next editor call label Oct 6, 2024
@michaelficarra michaelficarra added ready to merge Editors believe this PR needs no further reviews, and is ready to land. and removed editor call to be discussed in the next editor call labels Oct 16, 2024
@ljharb ljharb force-pushed the create-builtin-object branch from 72ea10f to 70a6dd1 Compare October 16, 2024 22:13
@ljharb ljharb merged commit 70a6dd1 into tc39:main Oct 16, 2024
8 checks passed
@kimjg1119 kimjg1119 deleted the create-builtin-object branch October 24, 2024 05:59
kimjg1119 added a commit to kimjg1119/ecma262 that referenced this pull request Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

4 participants