jonnyboyC / kos-language-server

A language server for the Kerboscript (kOS) a language for Kerbal Space Program
MIT License
25 stars 6 forks source link

[Feature] Type Coercion #91

Closed jonnyboyC closed 5 years ago

jonnyboyC commented 5 years ago

Is your feature request related to a problem? Please describe. Currently the language server support has limited type coercion in the form of subtype -> supertype. kOS has many cases of C# implicit conversion operator from one type to another

Describe the solution you'd like Overall, I believe the types can hold an additional property for allowable conversion. Similar to the current subclasses approach we can check at each super class for a conversion to the target type.

For example, likely the most common conversion is from structures to strings internally using kOS's :toString() suffix. With this approach if the type isn't a string eventually we'll search the inheritance chain to find structure which has a valid coercion from itself to a string