Skip to content
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

AbstractInterpreter handles logical operators incorrectly #213

Open
saelo opened this issue Jun 23, 2021 · 4 comments
Open

AbstractInterpreter handles logical operators incorrectly #213

saelo opened this issue Jun 23, 2021 · 4 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@saelo
Copy link
Collaborator

saelo commented Jun 23, 2021

The AbstractInterpreter currently assumes that the result of binary logical operators is a .boolean. While that probably seems intuitive, that's not how JavaScript works:

let a = 0 || "foobar";
print(a);     // "foobar"
let b = "" && 42;
print(b);     // ""

The correct semantics are explained for example here for || and here for &&, but in essence, the operators always yield the value of one of the two input expressions, so probably the resulting type should simply be the union of the two inputs.

@saelo saelo added enhancement New feature or request good first issue Good for newcomers labels Jun 23, 2021
@Dhananjayshukla1
Copy link

@saelo I want to work on this issue, can you assign this to me.

@saelo
Copy link
Collaborator Author

saelo commented Mar 10, 2023

That's great, thanks! We usually don't assign issues, but happy to do so if you like!

@Dhananjayshukla1
Copy link

Sorry sir,
I forgot my github account so i was not able to reply your message and your valuable time.
let a = 0 || "foobar";
console.log(a); // "foobar"
let b = "" && 42;
console.log(b); // ""

@Dhananjayshukla1
Copy link

Dhananjayshukla1 commented May 4, 2023

I'm new to open source contributions but I'm well versed with C++, HTML, CSS, Javascript, React, and Node.js.
could you please tell me how to get started.
thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants