track comptime types
Adds some tracking of comptime types.
changes formatting for comptime structs, e.g. HashMap(...) -> HashMap(i32,void). maybe just a preference of mine? but i like seeing it. could easily change the formatter back to ....
fixes:
- repeated use of the same comptime function #1841
- nested generic structs e.g. #1392
sorry for the false start. saw something while reading the diff and made a small change last second without re-building :( new version is passing tests again!
Thanks for the review. Finally had some time to try out your suggestions and got the two big ones working:
-
bound_type_paramsis removed -
bound_paramsmoved fromBoundScopetoScopeWithHandle
I'm not terribly fond of my change to DeclWithHandle nor pushing and popping comptime_state from completions.zig. Would be down to iterate again there if you have any suggestions. The two-pass collectDeclarationsOfContainer then declToCompletion for each decl collected does make some sense to draw a nice line between analysis.zig and completions.zig so I wasn't sure how to keep comptime_state discovered during collectDeclarationsOfContainer available to declToCompletion...
@mfield Do you plan to apply the suggested changes anytime soon? If not, I'd be happy to apply them myself. This PR is a very nice improvement that would be unfortunate to miss out on.
Hi, so sorry, completely lost track of this.
I tried your approach to moving bound_type_params out of completions and into analysis. The usingnamespace case is problematic enough I've backed out of it as well. The difficulty, as I see it, is that resolving the type of a function is too shallow. The Type that comes back doesn't describe the types of the parameters or the return type. So you have to remember to apply the same bound_type_params context to any operations that involve the function type, e.g. firstParamIs.
I think I've applied all the other suggestions. Please let me know if I've missed any.