sjbarag / brs

An interpreter for the BrightScript language that runs on non-Roku platforms.
MIT License
113 stars 43 forks source link

fix(interp): allow functions to be typed as objects #659

Closed lkipke closed 3 years ago

lkipke commented 3 years ago

Changes

This fixes a bug where if you tried to do:

sub foo(arg as object) : end sub
sub bar() : end sub

foo(bar) ' runtime error

brs would throw an ugly error. RBI allows this type-casting, so we should too!

This error was actually getting thrown a bunch in the sister project, https://github.com/hulu/roca, since brs@0.44.0, because all the describe and it functions use the as object type for functions.

sjbarag commented 3 years ago

This probably would have been caught if I released an RC last week instead of a full version. 🤔 perhaps we should make that part of the release flow?