diff --git a/crates/hir-analysis/src/lib.rs b/crates/hir-analysis/src/lib.rs index fe8bf37ee..5886c7bf6 100644 --- a/crates/hir-analysis/src/lib.rs +++ b/crates/hir-analysis/src/lib.rs @@ -67,7 +67,7 @@ pub struct Jar( ty::diagnostics::ImplTraitDefDiagAccumulator, ty::diagnostics::ImplDefDiagAccumulator, ty::diagnostics::FuncDefDiagAccumulator, - ty::diagnostics::RecursiveAdtConstituentAccumulator, + ty::diagnostics::AdtRecursionConstituentAccumulator, ); pub trait HirAnalysisDb: salsa::DbWithJar + HirDb { diff --git a/crates/hir-analysis/src/ty/def_analysis.rs b/crates/hir-analysis/src/ty/def_analysis.rs index 95d32d5a9..b9442d921 100644 --- a/crates/hir-analysis/src/ty/def_analysis.rs +++ b/crates/hir-analysis/src/ty/def_analysis.rs @@ -47,7 +47,7 @@ use super::{ }, visitor::{walk_ty, TyVisitor}, }; -use crate::ty::diagnostics::RecursiveAdtConstituentAccumulator; +use crate::ty::diagnostics::AdtRecursionConstituentAccumulator; /// This function implements analysis for the ADT definition. /// The analysis includes the following: @@ -69,7 +69,7 @@ pub fn analyze_adt(db: &dyn HirAnalysisDb, adt_ref: AdtRefId) { } if let Some(constituent) = check_recursive_adt(db, adt_ref) { - RecursiveAdtConstituentAccumulator::push(db, constituent); + AdtRecursionConstituentAccumulator::push(db, constituent); } } diff --git a/crates/hir-analysis/src/ty/diagnostics.rs b/crates/hir-analysis/src/ty/diagnostics.rs index 3f384541e..4e0c0e302 100644 --- a/crates/hir-analysis/src/ty/diagnostics.rs +++ b/crates/hir-analysis/src/ty/diagnostics.rs @@ -33,7 +33,7 @@ pub struct FuncDefDiagAccumulator(pub(super) TyDiagCollection); #[salsa::accumulator] pub struct TypeAliasDefDiagAccumulator(pub(super) TyDiagCollection); #[salsa::accumulator] -pub struct RecursiveAdtConstituentAccumulator(pub(super) AdtRecursionConstituent); +pub struct AdtRecursionConstituentAccumulator(pub(super) AdtRecursionConstituent); #[derive(Debug, PartialEq, Eq, Hash, Clone, derive_more::From)] pub enum TyDiagCollection { @@ -58,7 +58,7 @@ impl TyDiagCollection { pub enum TyLowerDiag { NotFullyAppliedType(DynLazySpan), InvalidTypeArgKind(DynLazySpan, String), - RecursiveType(Vec), + AdtRecursion(Vec), UnboundTypeAliasParam { span: DynLazySpan, @@ -117,8 +117,8 @@ impl TyLowerDiag { Self::InvalidTypeArgKind(span, msg) } - pub(super) fn recursive_type(constituents: Vec) -> Self { - Self::RecursiveType(constituents) + pub(super) fn adt_recursion(constituents: Vec) -> Self { + Self::AdtRecursion(constituents) } pub(super) fn unbound_type_alias_param( @@ -181,7 +181,7 @@ impl TyLowerDiag { match self { Self::NotFullyAppliedType(_) => 0, Self::InvalidTypeArgKind(_, _) => 1, - Self::RecursiveType { .. } => 2, + Self::AdtRecursion { .. } => 2, Self::UnboundTypeAliasParam { .. } => 3, Self::TypeAliasCycle { .. } => 4, Self::InconsistentKindBound(_, _) => 5, @@ -196,7 +196,7 @@ impl TyLowerDiag { match self { Self::NotFullyAppliedType(_) => "expected fully applied type".to_string(), Self::InvalidTypeArgKind(_, _) => "invalid type argument kind".to_string(), - Self::RecursiveType { .. } => "recursive type is not allowed".to_string(), + Self::AdtRecursion { .. } => "recursive type is not allowed".to_string(), Self::UnboundTypeAliasParam { .. } => { "all type parameters of type alias must be given".to_string() @@ -232,7 +232,7 @@ impl TyLowerDiag { span.resolve(db), )], - Self::RecursiveType(constituents) => { + Self::AdtRecursion(constituents) => { let mut diags = vec![]; for AdtRecursionConstituent { from, to } in constituents { @@ -1109,7 +1109,7 @@ pub fn adt_recursion_diags(constituents: &[AdtRecursionConstituent]) -> Vec Vec Vec ModuleAnalysisPass for TypeDefAnalysisPass<'db> { .map(|adt| { ( analyze_adt::accumulated::(self.db, adt), - analyze_adt::accumulated::(self.db, adt), + analyze_adt::accumulated::(self.db, adt), ) }) .unzip(); diff --git a/crates/uitest/fixtures/ty/def/recursive_type.fe b/crates/uitest/fixtures/ty/def/recursive_type.fe index c8c8592c9..0a750cca7 100644 --- a/crates/uitest/fixtures/ty/def/recursive_type.fe +++ b/crates/uitest/fixtures/ty/def/recursive_type.fe @@ -21,4 +21,4 @@ pub struct S5 { pub struct S6 { s: S5 -} +} \ No newline at end of file