Bug 212887 - Invalid escape sequence with a non-octal-eight
Summary: Invalid escape sequence with a non-octal-eight
Status: RESOLVED MOVED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: Other
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-07 20:14 PDT by Jefferson Junior
Modified: 2020-06-08 14:21 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jefferson Junior 2020-06-07 20:14:54 PDT
Hi everyone,
maybe is a case of an invalid numeric escape (non-octal-eight) in strict mode, but the same occurs using the strict mode and without it. Is this an expected behavior of JavaScriptCore? (implementation-dependent)

version: 262693
OS: Linux Ubuntu 19.10 x64

Steps to reproduce:

print(`\8`);
Actual results:

SyntaxError: untagged template literal contains invalid escape sequence
Expected results:

8
The same occurs in strict mode

"use strict";
print(`\8`);
V8, SpiderMonkey, Chakra works as expected.

cinfuzz
Comment 1 Ross Kirsling 2020-06-08 13:39:59 PDT
Based on the spec:
https://tc39.es/ecma262/#sec-literals-string-literals
https://tc39.es/ecma262/#sec-additional-syntax-string-literals
https://tc39.es/ecma262/#sec-template-literal-lexical-components
https://tc39.es/ecma262/#sec-static-semantics-template-early-errors

It would appear that our behavior is correct -- namely, it's only non-template strings that should support numeric escapes other than '\0'.

If so, then the thing to do here would be to add test262 cases for the other engines to fix.
Comment 2 Ross Kirsling 2020-06-08 13:40:45 PDT
(In reply to Ross Kirsling from comment #1)
> It would appear that our behavior is correct -- namely, it's only
> non-template strings that should support numeric escapes other than '\0'.

Oops, I ended my sentence too early. Should be "... in sloppy mode."
Comment 3 Ross Kirsling 2020-06-08 14:21:18 PDT
Closing here but opened https://github.com/tc39/test262/issues/2653 for the remaining work.