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
The code below exemplifies the issue, when
invalid
is used on the left side of the test it is not boxed inroInvalid
so is not correctly compared with the parameter (that was boxed because of theobject
type on the argument).The code was supposed to print
param invalid
in two consecutive lines, instead it shows the error below, because the comparison cannot sayinvalid
is not different thanroInvalid
: