Skip to content

Conversation

@nicolo-ribaudo
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo commented Oct 28, 2025

This is a test for the difference described in tc39/ecma262#3710.

TL;DR

  • export { foo } from "mod" and import { foo } from "mod"; export { foo } are equivalent: they both propagate the binding, so when both re-exported with export * from they do not cause ambiguity.
  • export * as foo from "mod" and import * as foo from "mod"; export { foo } are not equivalent: the second one introduces a new binding, causing ambiguity. It would be unambiguous if both were doing export * as foo from "mod". It's still be ambiguous (two bindings) if both were doing import * as foo from "mod"; export { foo }

The first commit just moves the tests related to binding ambiguity to a single folder, so that it's easier to tell what is already tested.

@nicolo-ribaudo nicolo-ribaudo force-pushed the ambiguous-binding branch 4 times, most recently from 3374720 to 74e1d86 Compare October 28, 2025 10:32
@nicolo-ribaudo nicolo-ribaudo force-pushed the ambiguous-binding branch 2 times, most recently from 9769291 to 0ae13c9 Compare October 28, 2025 10:37
@nicolo-ribaudo nicolo-ribaudo marked this pull request as ready for review October 28, 2025 10:41
@nicolo-ribaudo nicolo-ribaudo requested a review from a team as a code owner October 28, 2025 10:41
@nicolo-ribaudo
Copy link
Member Author

SM/JSC pass all the tests, while V8/engine262/XS fail test/language/module-code/ambiguous-export-bindings/namespace-unambiguous-if-export-start-as-from.js

@nicolo-ribaudo
Copy link
Member Author

Marking as draft because I plan to present something related to this in plenary.

@nicolo-ribaudo nicolo-ribaudo marked this pull request as draft October 28, 2025 10:45
@ptomato ptomato added the awaiting consensus This needs committee consensus before it can be eligible to be merged. label Oct 29, 2025
@guybedford
Copy link

guybedford commented Oct 30, 2025

Hmm, what is the value in allowing export * as foo to not be an ambiguous error? Is it not just an oversight that this doesn't throw as an ambiguous case? It doesn't seem to match the expectations for other unambiguous cases to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting consensus This needs committee consensus before it can be eligible to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants