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: Fix return-type of TemplateString[s] #3115

Merged
merged 1 commit into from
Jul 7, 2023

Conversation

jmdyck
Copy link
Collaborator

@jmdyck jmdyck commented Jul 6, 2023

In a tagged TemplateLiteral, NotEscapeSequence is allowed.
The TV of TemplateCharacter :: \ NotEscapeSequence is *undefined*.
This will then propagate up to TemplateString and TemplateStrings (when _raw_ is *false*).

This PR fixes the return-type of TemplateString[s] accordingly.

@michaelficarra
Copy link
Member

Can you add an assertion after step 4 of GetTemplateObject? Maybe also a sentence in TemplateStrings that describes this invariant.

@michaelficarra michaelficarra added the ready to merge Editors believe this PR needs no further reviews, and is ready to land. label Jul 7, 2023
@jmdyck
Copy link
Collaborator Author

jmdyck commented Jul 7, 2023

Done. (I put the invariant in TemplateString rather than TemplateStrings because that seemed the best place.)

@jmdyck
Copy link
Collaborator Author

jmdyck commented Jul 7, 2023

(force-pushed to squash down to one commit)

In a tagged TemplateLiteral, NotEscapeSequence is allowed.
The TV of `TemplateCharacter :: \ NotEscapeSequence` is `*undefined*`.
This will then propagate up to TemplateString and TemplateStrings
(when `_raw_` is `*false*`).

This PR fixes the return-type of TemplateString[s] accordingly.

It also adds a Note about return values in TemplateString,
and an assertion in GetTemplateObject.
@ljharb ljharb merged commit f3f2e25 into tc39:main Jul 7, 2023
6 checks passed
@jmdyck jmdyck deleted the TemplateStrings_return branch July 8, 2023 02:41
zhangenming pushed a commit to zhangenming/ecma262 that referenced this pull request Dec 22, 2023
In a tagged TemplateLiteral, NotEscapeSequence is allowed.
The TV of `TemplateCharacter :: \ NotEscapeSequence` is `*undefined*`.
This will then propagate up to TemplateString and TemplateStrings
(when `_raw_` is `*false*`).

This PR fixes the return-type of TemplateString[s] accordingly.

It also adds a Note about return values in TemplateString,
and an assertion in GetTemplateObject.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editorial change ready to merge Editors believe this PR needs no further reviews, and is ready to land. spec bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants