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

Avoid duplicate binding import-source-binding-name.js #4121

Merged
merged 5 commits into from
Jun 28, 2024

Conversation

nicolo-ribaudo
Copy link
Member

The current test contained a parser error due to the duplicate binding. This splits the test in two files, so that we actually successfully parse the file.

cc @legendecas

Ref babel/babel#16596

@nicolo-ribaudo nicolo-ribaudo requested a review from a team as a code owner June 28, 2024 13:02
Copy link
Member

@legendecas legendecas left a comment

Choose a reason for hiding this comment

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

Ahh, thanks!

Copy link
Member

@legendecas legendecas left a comment

Choose a reason for hiding this comment

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

thanks!

@Ms2ger Ms2ger merged commit 03852c9 into main Jun 28, 2024
8 checks passed
@Ms2ger Ms2ger deleted the nicolo-ribaudo-patch-2 branch June 28, 2024 13:14
@woess
Copy link
Contributor

woess commented Aug 13, 2024

@nicolo-ribaudo I thought the whole point of these tests was that the ImportBinding may be source and from, so why do they expect a SyntaxError then? Isn't this a bug?

@nicolo-ribaudo
Copy link
Member Author

It's ensure-linking-error_FIXTURE.js that causes the syntax error. The key bit here is that the error happens in the "resolution" (i.e. linking) phase, and not in the parse phase.

@woess
Copy link
Contributor

woess commented Aug 13, 2024

@nicolo-ribaudo My bad, I missed that part; thanks for the clarification.

Although I still think there's a problem with these tests since AFAIK, the correct evaluation order would be to try to load '<do not resolve>' first before linking ensure-linking-error_FIXTURE.js, so you wouldn't even get to the syntax error. This is also the behavior I see from node, btw:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '<do not resolve>' imported from …/language/module-code/source-phase-import/import-source-binding-name.js

So I think the tests should be changed to point to an existing file, so that the resolution phase will throw the expected SyntaxError.

edit I've opened #4193 to track this issue.

@legendecas
Copy link
Member

Yes, I found the trick didn't work in my V8 CL as well: https://chromium-review.googlesource.com/c/v8/v8/+/5783137. The failure to read the file happens before the linking failure, which leads to a host defined error, instead of SyntaxError.

@legendecas
Copy link
Member

legendecas commented Aug 13, 2024

The <do not resolve> notation at #3980 (comment) was not documented in INTERPRETING.md, only <module source> was documented. I will add a note in the doc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants