Skip to content

Validation errors when assigning from built in as void function/method #1360

@markwpearce

Description

@markwpearce

Built in Brightscript functions that are as void do not return invalid like developer created functions.

When you call built-in as void functions that are on the native roku objects, they return uninitialized. When you call developer-written as void functions, they return invalid.
So the runtime behavior is different even though you'd expect as void to behave the same regardless of where they're defined.
And since uninitialized causes runtime crashes when you try to read them and have slightly different rules than invalid, it's important to know when you're using uninitialized vs invalid.

To fix in V1 -- we could just make the doc scraper build a correct TypedFunctionType that returns UninitializedType when the return is as void
And then validate against uninitialized RHS of assignment statements.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions