Conversation
a090594 to
372fdae
Compare
crates/hir/src/core/hir_def/item.rs
Outdated
| // TODO: Add semantic view for FuncParamListId and restrict visibility | ||
| pub params: Partial<FuncParamListId<'db>>, |
There was a problem hiding this comment.
This TODO is partially addressed by Func::param_views, could be completed
There was a problem hiding this comment.
Should this be outside of hir::core, so that it can't use the hir-core-only fields? It seems like it should only rely on public accessors, not (semi-)private fields.
|
|
||
| // Where-clause diagnostics (trait bounds and kind checks on where predicates) | ||
| { | ||
| let clause = WhereClauseView { |
There was a problem hiding this comment.
Ugly pattern sneaking in because this file is inside hir::core. self.where_clause() should return a WhereClauseView.
| type Diagnostic = TyDiagCollection<'db>; | ||
|
|
||
| fn diags(self, db: &'db dyn HirAnalysisDb) -> Vec<Self::Diagnostic> { | ||
| let mut out = self.analyze(db); |
There was a problem hiding this comment.
I think we should just inline these analyze() functions and eliminate them; they're only called once, and it adds another jump to find the actual logic.
| pub(crate) fn diags_method_conformance( | ||
| self, | ||
| db: &'db dyn HirAnalysisDb, | ||
| implementor: Binder<ImplementorId<'db>>, | ||
| ) -> Vec<TyDiagCollection<'db>> { | ||
| implementor.skip_binder().diags_method_conformance(db) | ||
| } |
8e384dc to
752b32b
Compare
752b32b to
edf91ff
Compare
sbillig
left a comment
There was a problem hiding this comment.
🥳
I think there's more cleanup we could do, but I'd be happy for this to be merged now.
a306907 to
4108521
Compare
4108521 to
4380f23
Compare
This is a start at flipping the internal API of the hir/hir-analysis crates inside-out, so that our hir analysis queries and program traversal logic can be nicely reused without requiring developers to have an intricate understanding of how to use each query, and without duplicating visitor logic.
The goal is support followups on language server features, code transformations, and hopefully even codegen for graph-based IRs.
It's sort of like a "virtually materialized HIR interface", since our middle layer is query based we don't have a concrete materialization of the HIR, so this is kind of like an in-between solution.
There's a bunch of stuff in here:
coremodule keeps syntactic hir accessors contained from analysis logicDiagnosabletrait provides proof of concept for a pull-based diagnostic gathering pattern (which could be a really good model in designing interfaces to collect info for debugging/language server/graph output features)Needs to be rebased due to rapid developments elsewhere in the codebase!
Will update this later today or tomorrow with more info.
Built from hard lessons learned in #1163 #1131 #1112