RESOLVED MOVED 212887
Invalid escape sequence with a non-octal-eight
https://bugs.webkit.org/show_bug.cgi?id=212887
Summary Invalid escape sequence with a non-octal-eight
Jefferson Junior
Reported 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
Attachments
Ross Kirsling
Comment 1 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.
Ross Kirsling
Comment 2 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."
Ross Kirsling
Comment 3 2020-06-08 14:21:18 PDT
Closing here but opened https://github.com/tc39/test262/issues/2653 for the remaining work.
Note You need to log in before you can comment on or make changes to this bug.