Skip to content

Add tests for division after a template literal - #5169

Open
trackoor wants to merge 1 commit into
tc39:mainfrom
trackoor:template-division
Open

trackoor wants to merge 1 commit into
tc39:mainfrom
trackoor:template-division

Conversation

@trackoor

@trackoor trackoor commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

After a NoSubstitutionTemplate or a TemplateTail, / is a division operator (InputElementDiv goal). I couldn't find a test where a template literal is followed by /.

Engines that got this wrong:

The tests also check the other direction: after a TemplateHead or TemplateMiddle, / starts a regular expression, including inside arrow parameters ((a = `${/[)]/.source}`) => a).

All three files pass (sloppy and strict) on V8 15.9.109, SpiderMonkey 160.0b5, JavaScriptCore (macOS 26.3), engine262 67a6b615, GraalJS 25.5.5, XS 17.9.3 and Boa nightly. Hermes 0.11.0 (the last CLI release, before the fix) fails all three; quickjs-ng e22ce4d and QuickJS 712e8c0 fail arrow-function/dflt-params-template-literal-division.js.

@trackoor
trackoor requested a review from a team as a code owner November 6, 2026 03:43
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

3 new or modified tests were run on 7 engines.

View workflow run

Test Engine262 GraalJS JavaScriptCore QuickJS SpiderMonkey V8 XS
language/expressions/arrow-function/dflt-params-template-literal-division.js ✅ ✅ ✅ ❌ ✅ ✅ ✅
language/expressions/template-literal/division-after-no-substitution-template.js ✅ ✅ ✅ ✅ ✅ ✅ ✅
language/expressions/template-literal/division-after-template-tail.js ✅ ✅ ✅ ✅ ✅ ✅ ✅

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.

1 participant