You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think #1299 needs to be refactored. This function is sub as object, but does not return anything. However, when I print it, it returns 0. So it should not have an error in brighterscript because it does not cause a runtime error.
sub RedLines_AddLine(id, position, coords, node, childMap) asobjectline=CreateObject("roSGNode", "Rectangle")
line.setField("id", id)
end sub
From what I can tell, functions as <something> will return invalid, and the runtime crash happens when it cannot convert invalid to the actual return data type:
as object is fine because it converts invalid to 0
as integer, as longinteger, as float, as double are all fine because they convert invalid to 0
as boolean is fine because it converts invalid to false
So really, #1299 should only show an error when the return type of invalid cannot be coerced into the return type, and that appears to exclusively be the string return type.
I'm thinking that diagnostic should actually be renamed to "Function will return invalid which cannot be coerced into `.
The text was updated successfully, but these errors were encountered:
I think #1299 needs to be refactored. This function is
sub as object
, but does not return anything. However, when I print it, it returns0
. So it should not have an error in brighterscript because it does not cause a runtime error.From what I can tell, functions
as <something>
will returninvalid
, and the runtime crash happens when it cannot convertinvalid
to the actual return data type:as object
is fine because it convertsinvalid
to0
as integer
,as longinteger
,as float
,as double
are all fine because they convertinvalid
to 0as boolean
is fine because it convertsinvalid
tofalse
So really, #1299 should only show an error when the return type of
invalid
cannot be coerced into the return type, and that appears to exclusively be thestring
return type.I'm thinking that diagnostic should actually be renamed to "Function will return
invalid
which cannot be coerced into `.The text was updated successfully, but these errors were encountered: