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

Incorrect left-to-right order of operations #4

Closed
mrfigg opened this issue Feb 28, 2019 · 4 comments
Closed

Incorrect left-to-right order of operations #4

mrfigg opened this issue Feb 28, 2019 · 4 comments
Labels

Comments

@mrfigg
Copy link
Contributor

mrfigg commented Feb 28, 2019

I ran a couple of basic order of operations tests with version 2.0.0-rc.2 and got some illogical results.

Input: 2+8-2+8
Expected output: 16
Generated output: 0

Input: 1-(1+1)+1
Expected output: 0
Generated output: -2

Both tests seem to be going outside-in instead of left-to-right.

@Morgul
Copy link
Owner

Morgul commented Feb 28, 2019

I think you're right, evaluation is outside-in, due to how we're generating the AST. It's a little surprising that in the years of my using this, I've never caught that. I'll have to give this some thought; I'd like to find a solution that doesn't involve too drastic a change.

Out of curiosity, could you test in v1.3.0? I'll bet it's just as broken. If it isn't, then the problem's likely the fix to #1.

@Morgul Morgul added the bug label Feb 28, 2019
@mrfigg
Copy link
Contributor Author

mrfigg commented Feb 28, 2019

Yep, same results in version 1.3.0.

@mrfigg
Copy link
Contributor Author

mrfigg commented Mar 1, 2019

@Morgul
Copy link
Owner

Morgul commented Mar 8, 2019

closed by 6e6851d.

@Morgul Morgul closed this as completed Mar 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants