Skip to content

Conversation

@G-Lee1031
Copy link
Contributor

Hello.
This PR covers the abrupt completion returning case of Array.prototype.flatMap(mapperFunction [ , thisArg]) step 5.

Specifically in this PR, I have set mapperFunction as x => {throw new Test262Error}, so that FlattenIntoArray returns an abrupt completion in step 4.c.ii.1 where mapperFunction is called.

@G-Lee1031 G-Lee1031 requested a review from a team as a code owner January 28, 2026 07:10
Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

do we really not already have a test for this?

@ptomato
Copy link
Contributor

ptomato commented Jan 28, 2026

do we really not already have a test for this?

I also found that hard to believe! But we really don't 😄

Copy link
Contributor

@ptomato ptomato left a comment

Choose a reason for hiding this comment

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

Works for me, but maybe an additional line in the test to check that [].flatMap(() => { throw new Test262Error(); }) does not throw?

@G-Lee1031
Copy link
Contributor Author

That's a great idea. I've added the test case for the empty array as suggested :)

@ptomato ptomato force-pushed the mapperfunction-throws branch from 2f1090d to 22e73e5 Compare January 30, 2026 17:55
@ptomato ptomato merged commit dd6138f into tc39:main Jan 30, 2026
14 checks passed
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.

3 participants