Skip to content

Const variable in quantum state after error in assigment function call #37558

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

Closed
DiogoJunqueiraGeraldo opened this issue Mar 1, 2021 · 1 comment

Comments

@DiogoJunqueiraGeraldo
Copy link

  • Version: v12.18.4.
  • Platform: Darwin MacInBoxs-MacBook-Pro.local 19.5.0 Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64 x86_64
  • Subsystem: Unkown

What steps will reproduce the bug?

In node console execute:

// Assigment function who will throw the error 
function throwError() {
    throw new Error();
}

// throws an error as expected (can't create a const variable without value)
const foo; 

// functions throws an error as expected
const foo = throwError(); 

// Throws an ReferenceError of variable not defined
foo; 

// Throws an TypeError of Assigment to const variable
foo = 1; 

How often does it reproduce? Is there a required condition?

Always there is an error while assigning to a const variable

What is the expected behavior?

Not create the const variable

What do you see instead?

Const variable created without value

Additional information

image

@devsnek
Copy link
Member

devsnek commented Mar 1, 2021

Duplicate of #8309

@devsnek devsnek marked this as a duplicate of #8309 Mar 1, 2021
@devsnek devsnek closed this as completed Mar 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants