crypto icon indicating copy to clipboard operation
crypto copied to clipboard

'and' statement with non-existent property should have runtime error

Open lkipke opened this issue 5 years ago • 0 comments

Summary

brs behaves correctly in the below scenario, where we would expect to see a runtime error:

foo = {}
if true and foo.bar then
  print "yep"
else
  print "nope"
end if

And the runtime error (working as expected):

Attempting to 'and' boolean with non-boolean value
    left: Boolean
    right: Invalid
Attempting to 'and' boolean with non-boolean value
    left: Boolean
    right: Invalid

The same does not occur if it's not an and. For example, the following incorrectly prints nope:

foo = {}
if foo.bar then
  print "yep"
else
  print "nope"
end if

Instead, it should match behavior in RBI, which throws a runtime error.

lkipke avatar Aug 04 '20 20:08 lkipke