rokucommunity / brighterscript

A superset of Roku's BrightScript language
MIT License
162 stars 46 forks source link

Some Intrinsic types have overloaded methods: 👀 `roString` #926

Closed markwpearce closed 1 year ago

markwpearce commented 1 year ago

There may be others, but ifStringOps has a few:

Instr(substring as String) as Integer
vs
Instr(start_index as Integer, substring as String) as Integer

This is the worst case, because it doesn't conform to the brightscript function pattern.

Also see:

In these cases, the 2nd param can basically be thought of as optional

markwpearce commented 1 year ago

This is also a problem/issue for ifSGNodeFields with overloaded methods observeField and observeFieldScoped

markwpearce commented 1 year ago

Can probably be mitigated in the ScopeValidator by checking function calls against UnionTypes and validating if the call does not meet either signature...