We are now at just about 80% of expressions in RA itself having a complete type inferred :tada: :
Database loaded, 21 roots Crates in this dir: 27 Total modules found: 230 Total declarations: 3760 Total functions: 2480 Total expressions: 49160 Expressions of unknown type: 8156 (16%) Expressions of partially unknown type: 2432 (4%)
Of course there'll be some that are wrong (I can think of a few things), but I think it's nice progress :) For rustc, we're at 69%.
That means that one doesn't need traits 80% of the time, right? :)
Seems that way ;)
(Though there's quite a few things in the code model API that we should probably put into traits...)
oh yeah. We have like a dozen of
fn module(&self) :D
We do use quite a bit of traits for ast though
Hey! I'm currently working on rust-analyzer#887 to add Const / Static inference. I've gotten to a point where the inference works when the const is defined in the module scope (outside
fn test()) but failing when the const is defined inside the function. I noticed that https://github.com/rust-analyzer/rust-analyzer/blob/7ffff9c74caae108db53366e3b90857b7c405c6c/crates/ra_hir/src/expr.rs#L931-L938 has TODO regarding consts etc. Can I attempt to add support for block defined consts together with rust-analyzer#887 or should that be done in a separate PR ?
I would keep that separate, it's almost completely independent of constants: Block-level items need to be handled during import resolution (in
nameres.rs). The TODO you're linking to is about handling the bodies of constants, i.e. what I wrote at the end of rust-analyzer#887 :)
Ah yes, thanks!