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

Invalid check when on the left side does not work (boxing issue) #680

Open
lvcabral opened this issue Feb 7, 2023 · 0 comments
Open

Invalid check when on the left side does not work (boxing issue) #680

lvcabral opened this issue Feb 7, 2023 · 0 comments

Comments

@lvcabral
Copy link
Contributor

lvcabral commented Feb 7, 2023

The code below exemplifies the issue, when invalid is used on the left side of the test it is not boxed in roInvalid so is not correctly compared with the parameter (that was boxed because of the object type on the argument).

sub main()
  myVar = invalid
  RightInvalid(myVar)
  LeftInvalid(myVar)
end sub

sub RightInvalid(param1 as object)
  if param1 <> invalid
     param1.id = 1
  else
     print "param invalid"
  end if
end sub

sub LeftInvalid(param1 as object)
  if invalid <> param1
     param1.id = 1
  else
     print "param invalid"
  end if
end sub

The code was supposed to print param invalid in two consecutive lines, instead it shows the error below, because the comparison cannot say invalid is not different than roInvalid:

param invalid
left-invalid-error.brs(17,12-14): Attempting to set property on non-iterable value
    left: Object
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