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

ES2015 Issue with Template Literal Object > string substitution #1406

Open
p-bakker opened this issue Oct 31, 2023 · 0 comments
Open

ES2015 Issue with Template Literal Object > string substitution #1406

p-bakker opened this issue Oct 31, 2023 · 0 comments
Labels
Ecma Incompatibility Issues about Rhino being incompatible with the EcmaScript spec
Milestone

Comments

@p-bakker
Copy link
Collaborator

This test fails, as Template Literal uses the Token.ADD operation to stringify o, whereas it should be using the ToString operations (see last alinea of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String#string_coercion)

var o = {toString: () => "foo", valueOf: () => "bar"};
`${o}` === "foo"

The code that makes it use the ADD operation is located at

pn = createBinary(Token.ADD, pn, transform(elem));
. Not sure how to best tackle this codewise

@p-bakker p-bakker added the Ecma Incompatibility Issues about Rhino being incompatible with the EcmaScript spec label Oct 31, 2023
@p-bakker p-bakker added this to the ES2015 milestone Oct 31, 2023
@p-bakker p-bakker changed the title ES??? Issue with Template Literal Object > string substitution ES2015 Issue with Template Literal Object > string substitution Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ecma Incompatibility Issues about Rhino being incompatible with the EcmaScript spec
Projects
None yet
Development

No branches or pull requests

1 participant