New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 717925 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Dec 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 3
Type: Feature



Sign in to add a comment

Bug regarding EcmaScript 6 'let' declaration and template literals.

Reported by evil.to...@gmail.com, May 3 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36

Steps to reproduce the problem:
1. Open a new tab in Chrome
2. Open the console
3. Run the following code sequence:

let test = com`Test ${something} apples`;

function com(literals, ...substitutions) { for (let i = 0; i < substitutions.length; i++) console.log(substitutions[i]); return '123'}

let something = {whatever: 3};

test = com`Test ${something} apples`;

let test = com`Test ${something} apples`;

var test = com`Test ${something} apples`;

test

typeof test

What is the expected behavior?
the 'test' variable should hold the value '123', but instead it is undefined and can't be defined. It seems to be stuck into an undefined state.

There seems to be a bug with the JavaScript interpreter in Chrome. This concerns 'let' declaration and template literals in EcmaScript 6.

What went wrong?
This will render the 'test' variable into an unknown state. It will be considered undefined but it will also throw an 'Uncaught SyntaxError: Identifier 'test' has already been declared' when trying to declare wither using let or var. Even the safe typeof operator will throw an 'Uncaught ReferenceError: test is not defined' exception.

Did this work before? N/A 

Chrome version: 58.0.3029.81  Channel: stable
OS Version: 10.0
Flash Version:
 
js_sequence.txt
911 bytes View Download
bug_report.png
48.9 KB View Download
The problem doesn't seem to be related to template literals.
Just by doing:
let test = one + two;

will render test to an unknown state.
The following lines will all throw errors:
test
let test = 123;
var test = 123;
typeof test

The same sequence doesn't create any issues in FireFox.
Running let test = one + two; in Firefox will result in test === undefined being true.
Is there a way to edit the bug report title since it's not related to template literals?
Working as expected:
let test;
test = one + two;
test = 123;

Bug:
let test = one + two;
test = 123; // throws and exception

Cc: hdodda@chromium.org
Labels: Needs-Feedback
@evil.toshz--- Could you please provide us the sample file with the code to be executed for expected and actual bug you are facing .. that would be helpful for us to triage the issue better.

Thanks!

Comment 5 by tkent@chromium.org, May 5 2017

Components: -Blink Blink>JavaScript

Comment 6 by danno@chromium.org, May 7 2017

Owner: adamk@chromium.org
Status: Assigned (was: Unconfirmed)

Comment 7 by adamk@chromium.org, May 8 2017

Cc: gsat...@chromium.org littledan@chromium.org adamk@chromium.org
Components: -Blink>JavaScript Platform>DevTools>JavaScript
Labels: -Type-Bug -Pri-2 -Needs-Feedback Pri-3 Type-Feature
Owner: ----
Status: Available (was: Assigned)
This is as-specced in ES6. What you're seeing in Firefox is special behavior in their JavaScript console to allow this to work. This has long been a feature request in Chrome, so triaging as such. I suspect we already have a bug open somewhere for this that this can be duped against, but I can't find it off the top of my head, so CCing a few other folks who might have that bug handy.
Status: WontFix (was: Available)
As per comment #7.

Sign in to add a comment