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

Syntax error on octal escape in tagged template string #7540

Closed
kieran-osgood opened this issue Dec 8, 2023 · 6 comments
Closed

Syntax error on octal escape in tagged template string #7540

kieran-osgood opened this issue Dec 8, 2023 · 6 comments
Assignees
Labels
bug Something isn't working transpiler parser || printer

Comments

@kieran-osgood
Copy link

kieran-osgood commented Dec 8, 2023

What version of Bun is running?

1.0.15+b3bdf22eb

What platform is your computer?

Darwin 23.1.0 arm64 arm

What steps can reproduce the bug?

     // index.cjs / index.js
     const assert = require("assert")
     assert.equal(String.raw`/\1`.length, 3);

Then run it with bun index.cjs

What is the expected behavior?

Syntax is valid

➜ node index.cjs

What do you see instead?

➜ bun index.cjs
5 | assert.equal(String.raw`/\1`.length, 3);
                           ^
error: Syntax Error!!

Additional information

No response

@kieran-osgood kieran-osgood added the bug Something isn't working label Dec 8, 2023
@paperclover
Copy link
Member

image when it is not a template, it seems this is meant to be an error

obviously when it is a template, this is allowed, but it seems the parser is not aware of this.

cc @dylan-conway

@paperclover paperclover changed the title String.raw - Syntax Error Syntax error on octal escape in tagged template string Dec 8, 2023
@paperclover
Copy link
Member

reduced reproduction, run bun build demo.ts

a`\1`

@alexop1000
Copy link

Bump, causes issues in NextJS when importing a client-rendered component from a server-rendered one.

@TechnologicNick
Copy link

Also fails on invalid \u0000 with less than 4 hexadecimals and \x00 with less than 2 hexadecimals.

@devunt
Copy link

devunt commented Nov 17, 2024

This issue blocks usage of shiki in bun.

@Jarred-Sumner
Copy link
Collaborator

Jarred-Sumner commented Nov 17, 2024

Fixed by @pfgithub in Bun v1.1.35

pfgithub added a commit that referenced this issue Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working transpiler parser || printer
Projects
None yet
Development

No branches or pull requests

7 participants