Open ryuukk opened 1 year ago
I think this is a good idea, in the typescript compiler it's similarly done with union types, e.g. return type would be BasicView | MultiView
, but resolving this later takes enormous work in a solver / resolving algorithm, especially when cases get more complex. I think we should first optimize the current data structures we have, since currently we are starting to get RAM leaks and much longer request times again.
For the case of auto as return:
Let's take this example from my project:
Let's pretend i call it this way:
How to guess what type it's gonna use?
The function declaration has
auto
as return type, we could:returns
BasicView
andMultiView
Seems like a simple solution yet very effective!
Could do something like i did for the Templates PR and create a FunctionAutoReturnContext, so the type could be build properly in second.d in case it is a template
Now what about
alias
parameters?We could scan all call references and do the same thing, build a DSymbol and merge all the parts
I got the idea from: https://github.com/zigtools/ zls/pull/1067 (url split on purpose to avoid useless noise on their PR)