Bug 212887

Summary: Invalid escape sequence with a non-octal-eight
Product: WebKit Reporter: Jefferson Junior <junior.jefferson>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED MOVED    
Severity: Normal CC: ross.kirsling
Priority: P2    
Version: Other   
Hardware: PC   
OS: Linux   

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.