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

Undefined or not initialized variables with strange behavior #1458

Closed
EduFrazao opened this issue Mar 21, 2024 · 9 comments
Closed

Undefined or not initialized variables with strange behavior #1458

EduFrazao opened this issue Mar 21, 2024 · 9 comments
Labels
bug Issues considered a bug Regression

Comments

@EduFrazao
Copy link

EduFrazao commented Mar 21, 2024

Hi. Undefined or not initialized variables presents a strange behavior in version 1.7.14

Like this code:

var x = undefined;

if (!x) {
    // Never enters here
}

Not initialized variables also reports its types as strings

var x;
print(typeof x)

This codes prints: "string"

Is this somehow expected?

Edit note:
With 1.7.13 works fine.

@zozo-yasuda
Copy link

I tested in the current 1.7.15 snapshot, indeed:

var x = undefined;
if(x) print(x)  //yields nothing
if(!x) print(x) //prints "undefined"

I also checked Boolean(undefined). This evaluates to false as it should, so maybe there's something wrong with the if logic.
For the second issue, mine printed undefined so this was probably fixed.

I'll add these as test cases when I familiarize myself more with the repo.

@EduFrazao
Copy link
Author

I tested in the current 1.7.15 snapshot, indeed:

var x = undefined;
if(x) print(x)  //yields nothing
if(!x) print(x) //prints "undefined"

I also checked Boolean(undefined). This evaluates to false as it should, so maybe there's something wrong with the if logic. For the second issue, mine printed undefined so this was probably fixed.

I'll add these as test cases when I familiarize myself more with the repo.

Hi. Thanks for testing.
Did you test the output of "typeof x" after set it as undefined?

@p-bakker
Copy link
Collaborator

@EduFrazao Rhino 1.7.15 had been released.

Could you validate if the issue you had in 1.7.14 is still present our not?

@p-bakker
Copy link
Collaborator

If this issue is still present in 1.7.15, it would be great if you could try it before and after the merging of #979, which is a merged PR that made changes in the area of undefined handling

@p-bakker p-bakker added the bug Issues considered a bug label Jun 24, 2024
@p-bakker
Copy link
Collaborator

@gbrail any chance this regression might be due to the changes you made in #979?

@p-bakker
Copy link
Collaborator

@gbrail quick ping in case this fell off the bottom of the list 🙂

@gbrail
Copy link
Collaborator

gbrail commented Aug 21, 2024 via email

@p-bakker
Copy link
Collaborator

My bad, I misread the second comment in that I thought it confirmed the bug, but it did the opposite

@EduFrazao please provide more details on how to reproduce or at least how you interact with Rhino/execute your JS code, because we cannot reproduce the behaviour your reporting, neither in master not with the 1.7.14 release

Without a way to reproduce the issue, there's not much we can do with this case

@p-bakker
Copy link
Collaborator

p-bakker commented Sep 6, 2024

Am closing this for lack of actionable input. Feel free to reopen with a reproducible example

@p-bakker p-bakker closed this as not planned Won't fix, can't repro, duplicate, stale Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues considered a bug Regression
Projects
None yet
Development

No branches or pull requests

4 participants