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

Wrong precedence for negative sign in front of a value on a expression #662

Open
lvcabral opened this issue Jun 17, 2021 · 2 comments
Open

Comments

@lvcabral
Copy link
Contributor

Try the code below:

Sub Main() 
    x = 96
    y = 56
    w = 1088
    h = 608
    Offset(-x + 96, -y + 56, -w + 1088, -h + 608)
End Sub
Sub Offset(x, y, w, h)
    print x, y, w, h
End Sub

This should print:
0 0 0 0
instead it prints:
-192 -112 -2176 -1216

@lvcabral
Copy link
Contributor Author

lvcabral commented Jun 17, 2021

This was introduced recently, the root cause was this pull request: #443

@lvcabral lvcabral changed the title Wrong precedence for negative sign in front of a variable on a parameter expression Wrong precedence for negative sign in front of a value on a expression Jun 17, 2021
@lvcabral
Copy link
Contributor Author

It is wrong for any case with negative number first, like the example below:

Off-Roku BrightScript interpreter [Version 0.44.0]

brs> print -1000 + 1000
-2000
brs> print +1000 - 1000
0

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

1 participant