BBx-Kitchen / bbj-language-server

BBj Language Server
MIT License
6 stars 6 forks source link

linking-error on CAST statements #89

Closed SebastianAdams closed 4 weeks ago

SebastianAdams commented 1 year ago

Use the CAST function's first parameter to determine the type of the object and offer code completion accordingly.

In the following example, the CAST function is used to cast the first object from the vector into a HashMap, therefore the code assist should offer methods as for a HashMap. Instead, a linking-error is shown:

use java.util.HashMap

declare BBjVector vector!
vector! = new BBjVector()
vector!.add(new HashMap())

rem Could not resolve reference to ClassMember named 'put'.bbj(linking-error)
cast(HashMap, vector!.get(0)).put("Demo")
dhuebner commented 1 year ago

We could introduce a generic type for scalar library function. CAST(param: T, param: object, ERR?:lineref): T ... or just hardcode CAST in type computation.

dhuebner commented 4 weeks ago

Fixed in typefox-dev branch