use std::sync::Arc;
use cairo_lang_defs::db::DefsGroup;
use cairo_lang_defs::diagnostic_utils::StableLocation;
use cairo_lang_defs::ids::{
ConstantId, EnumId, ExternFunctionId, ExternTypeId, FreeFunctionId, FunctionTitleId,
FunctionWithBodyId, GenericParamId, GenericTypeId, ImplAliasId, ImplConstantDefId, ImplDefId,
ImplFunctionId, ImplImplDefId, ImplItemId, ImplTypeDefId, LanguageElementId, LookupItemId,
ModuleId, ModuleItemId, ModuleTypeAliasId, StructId, TraitConstantId, TraitFunctionId, TraitId,
TraitImplId, TraitItemId, TraitTypeId, UseId, VariantId,
};
use cairo_lang_diagnostics::{Diagnostics, DiagnosticsBuilder, Maybe};
use cairo_lang_filesystem::db::{AsFilesGroupMut, FilesGroup};
use cairo_lang_filesystem::ids::{CrateId, FileId, FileLongId};
use cairo_lang_parser::db::ParserGroup;
use cairo_lang_syntax::attribute::structured::Attribute;
use cairo_lang_syntax::node::{TypedStablePtr, ast};
use cairo_lang_utils::ordered_hash_map::OrderedHashMap;
use cairo_lang_utils::ordered_hash_set::OrderedHashSet;
use cairo_lang_utils::{LookupIntern, Upcast, require};
use smol_str::SmolStr;
use crate::diagnostic::SemanticDiagnosticKind;
use crate::expr::inference::{self, ImplVar, ImplVarId};
use crate::items::constant::{ConstValueId, Constant, ImplConstantId};
use crate::items::function_with_body::FunctionBody;
use crate::items::functions::{ImplicitPrecedence, InlineConfiguration};
use crate::items::generics::{GenericParam, GenericParamData, GenericParamsData};
use crate::items::imp::{
ImplId, ImplImplId, ImplLookupContext, ImplicitImplImplData, UninferredImpl,
};
use crate::items::module::{ModuleItemInfo, ModuleSemanticData};
use crate::items::trt::{
ConcreteTraitGenericFunctionId, ConcreteTraitId, TraitItemConstantData, TraitItemImplData,
TraitItemTypeData,
};
use crate::items::us::SemanticUseEx;
use crate::items::visibility::Visibility;
use crate::plugin::AnalyzerPlugin;
use crate::resolve::{ResolvedConcreteItem, ResolvedGenericItem, ResolverData};
use crate::substitution::GenericSubstitution;
use crate::types::{ImplTypeId, TypeSizeInformation};
use crate::{
FunctionId, Parameter, SemanticDiagnostic, TypeId, corelib, items, lsp_helpers, semantic, types,
};
pub trait Elongate {
fn elongate(&self) -> &(dyn SemanticGroup + 'static);
}
#[salsa::query_group(SemanticDatabase)]
pub trait SemanticGroup:
DefsGroup
+ Upcast<dyn DefsGroup>
+ Upcast<dyn ParserGroup>
+ Upcast<dyn FilesGroup>
+ AsFilesGroupMut
+ Elongate
{
#[salsa::interned]
fn intern_function(&self, id: items::functions::FunctionLongId) -> semantic::FunctionId;
#[salsa::interned]
fn intern_concrete_function_with_body(
&self,
id: items::functions::ConcreteFunctionWithBody,
) -> semantic::ConcreteFunctionWithBodyId;
#[salsa::interned]
fn intern_concrete_struct(&self, id: types::ConcreteStructLongId) -> types::ConcreteStructId;
#[salsa::interned]
fn intern_concrete_enum(&self, id: types::ConcreteEnumLongId) -> types::ConcreteEnumId;
#[salsa::interned]
fn intern_concrete_extern_type(
&self,
id: types::ConcreteExternTypeLongId,
) -> types::ConcreteExternTypeId;
#[salsa::interned]
fn intern_concrete_trait(
&self,
id: items::trt::ConcreteTraitLongId,
) -> items::trt::ConcreteTraitId;
#[salsa::interned]
fn intern_concrete_trait_function(
&self,
id: items::trt::ConcreteTraitGenericFunctionLongId,
) -> items::trt::ConcreteTraitGenericFunctionId;
#[salsa::interned]
fn intern_concrete_trait_type(
&self,
id: items::trt::ConcreteTraitTypeLongId,
) -> items::trt::ConcreteTraitTypeId;
#[salsa::interned]
fn intern_concrete_trait_constant(
&self,
id: items::trt::ConcreteTraitConstantLongId,
) -> items::trt::ConcreteTraitConstantId;
#[salsa::interned]
fn intern_concrete_impl(
&self,
id: items::imp::ConcreteImplLongId,
) -> items::imp::ConcreteImplId;
#[salsa::interned]
fn intern_concrete_trait_impl(
&self,
id: items::trt::ConcreteTraitImplLongId,
) -> items::trt::ConcreteTraitImplId;
#[salsa::interned]
fn intern_type(&self, id: types::TypeLongId) -> semantic::TypeId;
#[salsa::interned]
fn intern_const_value(&self, id: items::constant::ConstValue) -> items::constant::ConstValueId;
#[salsa::interned]
fn intern_impl(&self, id: items::imp::ImplLongId) -> items::imp::ImplId;
#[salsa::interned]
fn intern_impl_var(&self, id: ImplVar) -> ImplVarId;
#[salsa::interned]
fn intern_generated_impl(
&self,
id: items::imp::GeneratedImplLongId,
) -> items::imp::GeneratedImplId;
#[salsa::interned]
fn intern_uninferred_generated_impl(
&self,
id: items::imp::UninferredGeneratedImplLongId,
) -> items::imp::UninferredGeneratedImplId;
#[salsa::invoke(items::constant::priv_constant_semantic_data)]
#[salsa::cycle(items::constant::priv_constant_semantic_data_cycle)]
fn priv_constant_semantic_data(
&self,
const_id: ConstantId,
in_cycle: bool,
) -> Maybe<items::constant::ConstantData>;
#[salsa::invoke(items::constant::constant_semantic_diagnostics)]
fn constant_semantic_diagnostics(
&self,
const_id: ConstantId,
) -> Diagnostics<SemanticDiagnostic>;
#[salsa::invoke(items::constant::constant_semantic_data)]
#[salsa::cycle(items::constant::constant_semantic_data_cycle)]
fn constant_semantic_data(&self, use_id: ConstantId) -> Maybe<Constant>;
#[salsa::invoke(items::constant::constant_resolver_data)]
#[salsa::cycle(items::constant::constant_resolver_data_cycle)]
fn constant_resolver_data(&self, use_id: ConstantId) -> Maybe<Arc<ResolverData>>;
#[salsa::invoke(items::constant::constant_const_value)]
#[salsa::cycle(items::constant::constant_const_value_cycle)]
fn constant_const_value(&self, const_id: ConstantId) -> Maybe<ConstValueId>;
#[salsa::invoke(items::constant::constant_const_type)]
#[salsa::cycle(items::constant::constant_const_type_cycle)]
fn constant_const_type(&self, const_id: ConstantId) -> Maybe<TypeId>;
#[salsa::invoke(items::us::priv_use_semantic_data)]
#[salsa::cycle(items::us::priv_use_semantic_data_cycle)]
fn priv_use_semantic_data(&self, use_id: UseId) -> Maybe<items::us::UseData>;
#[salsa::invoke(items::us::use_semantic_diagnostics)]
fn use_semantic_diagnostics(&self, use_id: UseId) -> Diagnostics<SemanticDiagnostic>;
#[salsa::invoke(items::us::use_resolver_data)]
#[salsa::cycle(items::us::use_resolver_data_cycle)]
fn use_resolver_data(&self, use_id: UseId) -> Maybe<Arc<ResolverData>>;
#[salsa::invoke(items::module::priv_module_semantic_data)]
fn priv_module_semantic_data(&self, module_id: ModuleId) -> Maybe<Arc<ModuleSemanticData>>;
#[salsa::invoke(items::module::module_item_by_name)]
fn module_item_by_name(
&self,
module_id: ModuleId,
name: SmolStr,
) -> Maybe<Option<ModuleItemId>>;
#[salsa::invoke(items::module::module_item_info_by_name)]
fn module_item_info_by_name(
&self,
module_id: ModuleId,
name: SmolStr,
) -> Maybe<Option<ModuleItemInfo>>;
#[salsa::invoke(items::module::module_all_used_items)]
fn module_all_used_items(
&self,
module_id: ModuleId,
) -> Maybe<Arc<OrderedHashSet<LookupItemId>>>;
#[salsa::invoke(items::module::module_attributes)]
fn module_attributes(&self, module_id: ModuleId) -> Maybe<Vec<Attribute>>;
#[salsa::invoke(items::module::module_usable_trait_ids)]
fn module_usable_trait_ids(
&self,
module_id: ModuleId,
) -> Maybe<Arc<OrderedHashMap<TraitId, LookupItemId>>>;
#[salsa::invoke(items::structure::priv_struct_declaration_data)]
fn priv_struct_declaration_data(
&self,
struct_id: StructId,
) -> Maybe<items::structure::StructDeclarationData>;
#[salsa::invoke(items::structure::struct_declaration_diagnostics)]
fn struct_declaration_diagnostics(
&self,
struct_id: StructId,
) -> Diagnostics<SemanticDiagnostic>;
#[salsa::invoke(items::structure::struct_attributes)]
fn struct_attributes(&self, struct_id: StructId) -> Maybe<Vec<Attribute>>;
#[salsa::invoke(items::structure::struct_generic_params)]
fn struct_generic_params(&self, struct_id: StructId) -> Maybe<Vec<GenericParam>>;
#[salsa::invoke(items::structure::struct_generic_params_data)]
fn struct_generic_params_data(&self, struct_id: StructId) -> Maybe<GenericParamsData>;
#[salsa::invoke(items::structure::struct_declaration_resolver_data)]
fn struct_declaration_resolver_data(&self, structure_id: StructId) -> Maybe<Arc<ResolverData>>;
#[salsa::invoke(items::structure::priv_struct_definition_data)]
fn priv_struct_definition_data(
&self,
struct_id: StructId,
) -> Maybe<items::structure::StructDefinitionData>;
#[salsa::invoke(items::structure::struct_definition_diagnostics)]
fn struct_definition_diagnostics(&self, struct_id: StructId)
-> Diagnostics<SemanticDiagnostic>;
#[salsa::invoke(items::structure::struct_members)]
fn struct_members(
&self,
struct_id: StructId,
) -> Maybe<Arc<OrderedHashMap<SmolStr, semantic::Member>>>;
#[salsa::invoke(items::structure::struct_definition_resolver_data)]
fn struct_definition_resolver_data(&self, structure_id: StructId) -> Maybe<Arc<ResolverData>>;
#[salsa::invoke(items::structure::concrete_struct_members)]
fn concrete_struct_members(
&self,
concrete_struct_id: types::ConcreteStructId,
) -> Maybe<Arc<OrderedHashMap<SmolStr, semantic::Member>>>;
#[salsa::invoke(items::enm::priv_enum_declaration_data)]
fn priv_enum_declaration_data(&self, enum_id: EnumId)
-> Maybe<items::enm::EnumDeclarationData>;
#[salsa::invoke(items::enm::enum_declaration_diagnostics)]
fn enum_declaration_diagnostics(&self, enum_id: EnumId) -> Diagnostics<SemanticDiagnostic>;
#[salsa::invoke(items::enm::enum_generic_params)]
fn enum_generic_params(&self, enum_id: EnumId) -> Maybe<Vec<GenericParam>>;
#[salsa::invoke(items::enm::enum_generic_params_data)]
fn enum_generic_params_data(&self, enum_id: EnumId) -> Maybe<GenericParamsData>;
#[salsa::invoke(items::enm::enum_attributes)]
fn enum_attributes(&self, enum_id: EnumId) -> Maybe<Vec<Attribute>>;
#[salsa::invoke(items::enm::enum_declaration_resolver_data)]
fn enum_declaration_resolver_data(&self, enum_id: EnumId) -> Maybe<Arc<ResolverData>>;
#[salsa::invoke(items::enm::priv_enum_definition_data)]
fn priv_enum_definition_data(&self, enum_id: EnumId) -> Maybe<items::enm::EnumDefinitionData>;
#[salsa::invoke(items::enm::enum_definition_diagnostics)]
fn enum_definition_diagnostics(&self, enum_id: EnumId) -> Diagnostics<SemanticDiagnostic>;
#[salsa::invoke(items::enm::enum_variants)]
fn enum_variants(&self, enum_id: EnumId) -> Maybe<OrderedHashMap<SmolStr, VariantId>>;
#[salsa::invoke(items::enm::variant_semantic)]
fn variant_semantic(&self, enum_id: EnumId, variant_id: VariantId) -> Maybe<semantic::Variant>;
#[salsa::invoke(items::enm::enum_definition_resolver_data)]
fn enum_definition_resolver_data(&self, enum_id: EnumId) -> Maybe<Arc<ResolverData>>;
#[salsa::invoke(items::module_type_alias::module_type_alias_semantic_diagnostics)]
fn module_type_alias_semantic_diagnostics(
&self,
module_type_alias_id: ModuleTypeAliasId,
) -> Diagnostics<SemanticDiagnostic>;
#[salsa::invoke(items::module_type_alias::module_type_alias_resolved_type)]
#[salsa::cycle(items::module_type_alias::module_type_alias_resolved_type_cycle)]
fn module_type_alias_resolved_type(
&self,
module_type_alias_id: ModuleTypeAliasId,
) -> Maybe<TypeId>;
#[salsa::invoke(items::module_type_alias::module_type_alias_generic_params)]
fn module_type_alias_generic_params(
&self,
enum_id: ModuleTypeAliasId,
) -> Maybe<Vec<GenericParam>>;
#[salsa::invoke(items::module_type_alias::module_type_alias_resolver_data)]
#[salsa::cycle(items::module_type_alias::module_type_alias_resolver_data_cycle)]
fn module_type_alias_resolver_data(
&self,
module_type_alias_id: ModuleTypeAliasId,
) -> Maybe<Arc<ResolverData>>;
#[salsa::invoke(items::module_type_alias::priv_module_type_alias_generic_params_data)]
fn priv_module_type_alias_generic_params_data(
&self,
enum_id: ModuleTypeAliasId,
) -> Maybe<GenericParamsData>;
#[salsa::invoke(items::module_type_alias::priv_module_type_alias_semantic_data)]
#[salsa::cycle(items::module_type_alias::priv_module_type_alias_semantic_data_cycle)]
fn priv_module_type_alias_semantic_data(
&self,
module_type_alias_id: ModuleTypeAliasId,
in_cycle: bool,
) -> Maybe<items::module_type_alias::ModuleTypeAliasData>;
#[salsa::invoke(items::impl_alias::impl_alias_impl_def)]
#[salsa::cycle(items::impl_alias::impl_alias_impl_def_cycle)]
fn impl_alias_impl_def(&self, impl_alias_id: ImplAliasId) -> Maybe<ImplDefId>;
#[salsa::invoke(items::impl_alias::priv_impl_alias_semantic_data)]
#[salsa::cycle(items::impl_alias::priv_impl_alias_semantic_data_cycle)]
fn priv_impl_alias_semantic_data(
&self,
impl_alias_id: ImplAliasId,
in_cycle: bool,
) -> Maybe<items::impl_alias::ImplAliasData>;
#[salsa::invoke(items::impl_alias::impl_alias_semantic_diagnostics)]
fn impl_alias_semantic_diagnostics(
&self,
impl_alias_id: ImplAliasId,
) -> Diagnostics<SemanticDiagnostic>;
#[salsa::invoke(items::impl_alias::impl_alias_resolved_impl)]
#[salsa::cycle(items::impl_alias::impl_alias_resolved_impl_cycle)]
fn impl_alias_resolved_impl(&self, impl_alias_id: ImplAliasId) -> Maybe<ImplId>;
#[salsa::invoke(items::impl_alias::impl_alias_generic_params)]
fn impl_alias_generic_params(&self, impl_alias_id: ImplAliasId) -> Maybe<Vec<GenericParam>>;
#[salsa::invoke(items::impl_alias::impl_alias_generic_params_data)]
fn impl_alias_generic_params_data(
&self,
impl_alias_id: ImplAliasId,
) -> Maybe<GenericParamsData>;
#[salsa::invoke(items::impl_alias::impl_alias_resolver_data)]
#[salsa::cycle(items::impl_alias::impl_alias_resolver_data_cycle)]
fn impl_alias_resolver_data(&self, impl_alias_id: ImplAliasId) -> Maybe<Arc<ResolverData>>;
#[salsa::invoke(items::impl_alias::impl_alias_attributes)]
fn impl_alias_attributes(&self, impl_def_id: ImplAliasId) -> Maybe<Vec<Attribute>>;
#[salsa::invoke(items::trt::trait_semantic_declaration_diagnostics)]
fn trait_semantic_declaration_diagnostics(
&self,
trait_id: TraitId,
) -> Diagnostics<SemanticDiagnostic>;
#[salsa::invoke(items::trt::trait_generic_params)]
#[salsa::cycle(items::trt::trait_generic_params_cycle)]
fn trait_generic_params(&self, trait_id: TraitId) -> Maybe<Vec<GenericParam>>;
#[salsa::invoke(items::trt::trait_generic_params_data)]
#[salsa::cycle(items::trt::trait_generic_params_data_cycle)]
fn trait_generic_params_data(
&self,
trait_id: TraitId,
in_cycle: bool,
) -> Maybe<GenericParamsData>;
#[salsa::invoke(items::trt::trait_attributes)]
fn trait_attributes(&self, trait_id: TraitId) -> Maybe<Vec<Attribute>>;
#[salsa::invoke(items::trt::trait_resolver_data)]
fn trait_resolver_data(&self, trait_id: TraitId) -> Maybe<Arc<ResolverData>>;
#[salsa::invoke(items::trt::priv_trait_declaration_data)]
fn priv_trait_declaration_data(
&self,
trait_id: TraitId,
) -> Maybe<items::trt::TraitDeclarationData>;
#[salsa::invoke(items::trt::trait_semantic_definition_diagnostics)]
fn trait_semantic_definition_diagnostics(
&self,
trait_id: TraitId,
) -> Diagnostics<SemanticDiagnostic>;
#[salsa::invoke(items::trt::trait_required_item_names)]
fn trait_required_item_names(&self, trait_id: TraitId) -> Maybe<OrderedHashSet<SmolStr>>;
#[salsa::invoke(items::trt::trait_item_by_name)]
fn trait_item_by_name(&self, trait_id: TraitId, name: SmolStr) -> Maybe<Option<TraitItemId>>;
#[salsa::invoke(items::trt::trait_all_used_items)]
fn trait_all_used_items(&self, trait_id: TraitId) -> Maybe<Arc<OrderedHashSet<LookupItemId>>>;
#[salsa::invoke(items::trt::trait_functions)]
fn trait_functions(&self, trait_id: TraitId)
-> Maybe<OrderedHashMap<SmolStr, TraitFunctionId>>;
#[salsa::invoke(items::trt::trait_function_by_name)]
fn trait_function_by_name(
&self,
trait_id: TraitId,
name: SmolStr,
) -> Maybe<Option<TraitFunctionId>>;
#[salsa::invoke(items::trt::trait_types)]
fn trait_types(&self, trait_id: TraitId) -> Maybe<OrderedHashMap<SmolStr, TraitTypeId>>;
#[salsa::invoke(items::trt::trait_type_by_name)]
fn trait_type_by_name(&self, trait_id: TraitId, name: SmolStr) -> Maybe<Option<TraitTypeId>>;
#[salsa::invoke(items::trt::trait_constants)]
fn trait_constants(&self, trait_id: TraitId)
-> Maybe<OrderedHashMap<SmolStr, TraitConstantId>>;
#[salsa::invoke(items::trt::trait_constant_by_name)]
fn trait_constant_by_name(
&self,
trait_id: TraitId,
name: SmolStr,
) -> Maybe<Option<TraitConstantId>>;
#[salsa::invoke(items::trt::trait_impls)]
fn trait_impls(&self, trait_id: TraitId) -> Maybe<OrderedHashMap<SmolStr, TraitImplId>>;
#[salsa::invoke(items::trt::trait_impl_by_name)]
fn trait_impl_by_name(&self, trait_id: TraitId, name: SmolStr) -> Maybe<Option<TraitImplId>>;
#[salsa::invoke(items::trt::priv_trait_definition_data)]
fn priv_trait_definition_data(
&self,
trait_id: TraitId,
) -> Maybe<items::trt::TraitDefinitionData>;
#[salsa::invoke(items::trt::trait_type_diagnostics)]
fn trait_type_diagnostics(&self, trait_type_id: TraitTypeId)
-> Diagnostics<SemanticDiagnostic>;
#[salsa::invoke(items::trt::trait_type_generic_params)]
fn trait_type_generic_params(&self, trait_type_id: TraitTypeId) -> Maybe<Vec<GenericParam>>;
#[salsa::invoke(items::trt::trait_type_attributes)]
fn trait_type_attributes(&self, trait_type_id: TraitTypeId) -> Maybe<Vec<Attribute>>;
#[salsa::invoke(items::trt::trait_type_resolver_data)]
fn trait_type_resolver_data(&self, trait_type_id: TraitTypeId) -> Maybe<Arc<ResolverData>>;
#[salsa::invoke(items::trt::priv_trait_type_generic_params_data)]
fn priv_trait_type_generic_params_data(
&self,
trait_type_id: TraitTypeId,
) -> Maybe<GenericParamsData>;
#[salsa::invoke(items::trt::priv_trait_type_data)]
fn priv_trait_type_data(&self, type_id: TraitTypeId) -> Maybe<TraitItemTypeData>;
#[salsa::invoke(items::trt::trait_constant_diagnostics)]
fn trait_constant_diagnostics(
&self,
trait_constant: TraitConstantId,
) -> Diagnostics<SemanticDiagnostic>;
#[salsa::invoke(items::trt::trait_constant_attributes)]
fn trait_constant_attributes(&self, trait_constant: TraitConstantId) -> Maybe<Vec<Attribute>>;
#[salsa::invoke(items::trt::trait_constant_type)]
fn trait_constant_type(&self, trait_type_id: TraitConstantId) -> Maybe<TypeId>;
#[salsa::invoke(items::trt::trait_constant_resolver_data)]
fn trait_constant_resolver_data(
&self,
trait_constant: TraitConstantId,
) -> Maybe<Arc<ResolverData>>;
#[salsa::invoke(items::trt::priv_trait_constant_data)]
fn priv_trait_constant_data(
&self,
trait_constant: TraitConstantId,
) -> Maybe<TraitItemConstantData>;
#[salsa::invoke(items::trt::concrete_trait_constant_type)]
fn concrete_trait_constant_type(
&self,
concrete_trait_constant_id: items::trt::ConcreteTraitConstantId,
) -> Maybe<TypeId>;
#[salsa::invoke(items::trt::trait_impl_diagnostics)]
fn trait_impl_diagnostics(&self, trait_impl: TraitImplId) -> Diagnostics<SemanticDiagnostic>;
#[salsa::invoke(items::trt::trait_impl_attributes)]
fn trait_impl_attributes(&self, trait_impl: TraitImplId) -> Maybe<Vec<Attribute>>;
#[salsa::invoke(items::trt::trait_impl_concrete_trait)]
fn trait_impl_concrete_trait(&self, trait_impl_id: TraitImplId) -> Maybe<ConcreteTraitId>;
#[salsa::invoke(items::trt::trait_impl_resolver_data)]
fn trait_impl_resolver_data(&self, trait_impl: TraitImplId) -> Maybe<Arc<ResolverData>>;
#[salsa::invoke(items::trt::priv_trait_impl_data)]
fn priv_trait_impl_data(&self, trait_impl: TraitImplId) -> Maybe<TraitItemImplData>;
#[salsa::invoke(items::trt::concrete_trait_impl_concrete_trait)]
fn concrete_trait_impl_concrete_trait(
&self,
concrete_trait_impl_id: items::trt::ConcreteTraitImplId,
) -> Maybe<ConcreteTraitId>;
#[salsa::invoke(items::trt::trait_function_declaration_diagnostics)]
fn trait_function_declaration_diagnostics(
&self,
trait_function_id: TraitFunctionId,
) -> Diagnostics<SemanticDiagnostic>;
#[salsa::invoke(items::trt::trait_function_signature)]
fn trait_function_signature(
&self,
trait_function_id: TraitFunctionId,
) -> Maybe<semantic::Signature>;
#[salsa::invoke(items::trt::trait_function_generic_params)]
fn trait_function_generic_params(
&self,
trait_function_id: TraitFunctionId,
) -> Maybe<Vec<GenericParam>>;
#[salsa::invoke(items::trt::priv_trait_function_generic_params_data)]
fn priv_trait_function_generic_params_data(
&self,
trait_function_id: TraitFunctionId,
) -> Maybe<GenericParamsData>;
#[salsa::invoke(items::trt::trait_function_attributes)]
fn trait_function_attributes(
&self,
trait_function_id: TraitFunctionId,
) -> Maybe<Vec<Attribute>>;
#[salsa::invoke(items::trt::trait_function_resolver_data)]
fn trait_function_resolver_data(
&self,
trait_function_id: TraitFunctionId,
) -> Maybe<Arc<ResolverData>>;
#[salsa::invoke(items::trt::trait_function_declaration_inline_config)]
fn trait_function_declaration_inline_config(
&self,
trait_function_id: TraitFunctionId,
) -> Maybe<InlineConfiguration>;
#[salsa::invoke(items::trt::trait_function_declaration_implicit_precedence)]
fn trait_function_declaration_implicit_precedence(
&self,
trait_function_id: TraitFunctionId,
) -> Maybe<ImplicitPrecedence>;
#[salsa::invoke(items::trt::trait_function_declaration_implicits)]
fn trait_function_declaration_implicits(
&self,
trait_function_id: TraitFunctionId,
) -> Maybe<Vec<TypeId>>;
#[salsa::invoke(items::trt::priv_trait_function_declaration_data)]
fn priv_trait_function_declaration_data(
&self,
function_id: TraitFunctionId,
) -> Maybe<items::functions::FunctionDeclarationData>;
#[salsa::invoke(items::trt::trait_function_body_diagnostics)]
fn trait_function_body_diagnostics(
&self,
trait_function_id: TraitFunctionId,
) -> Diagnostics<SemanticDiagnostic>;
#[salsa::invoke(items::trt::trait_function_body)]
fn trait_function_body(
&self,
trait_function_id: TraitFunctionId,
) -> Maybe<Option<Arc<FunctionBody>>>;
#[salsa::invoke(items::trt::priv_trait_function_body_data)]
fn priv_trait_function_body_data(
&self,
trait_function_id: TraitFunctionId,
) -> Maybe<Option<items::function_with_body::FunctionBodyData>>;
#[salsa::invoke(items::trt::concrete_trait_function_generic_params)]
fn concrete_trait_function_generic_params(
&self,
concrete_trait_function_id: ConcreteTraitGenericFunctionId,
) -> Maybe<Vec<GenericParam>>;
#[salsa::invoke(items::trt::concrete_trait_function_signature)]
fn concrete_trait_function_signature(
&self,
concrete_trait_function_id: ConcreteTraitGenericFunctionId,
) -> Maybe<semantic::Signature>;
#[salsa::invoke(items::imp::module_impl_ids_for_trait_filter)]
#[salsa::cycle(items::imp::module_impl_ids_for_trait_filter_cycle)]
fn module_impl_ids_for_trait_filter(
&self,
module_id: ModuleId,
trait_lookup_constraint: items::imp::TraitFilter,
) -> Maybe<Vec<UninferredImpl>>;
#[salsa::invoke(items::imp::impl_impl_ids_for_trait_filter)]
#[salsa::cycle(items::imp::impl_impl_ids_for_trait_filter_cycle)]
fn impl_impl_ids_for_trait_filter(
&self,
impl_id: ImplId,
trait_lookup_constraint: items::imp::TraitFilter,
) -> Maybe<Vec<UninferredImpl>>;
#[salsa::invoke(inference::solver::canonic_trait_solutions)]
#[salsa::cycle(inference::solver::canonic_trait_solutions_cycle)]
fn canonic_trait_solutions(
&self,
canonical_trait: inference::canonic::CanonicalTrait,
lookup_context: ImplLookupContext,
) -> Result<
inference::solver::SolutionSet<inference::canonic::CanonicalImpl>,
inference::InferenceError,
>;
#[salsa::invoke(items::imp::impl_semantic_declaration_diagnostics)]
fn impl_semantic_declaration_diagnostics(
&self,
impl_def_id: ImplDefId,
) -> Diagnostics<SemanticDiagnostic>;
#[salsa::invoke(items::imp::impl_def_generic_params_data)]
fn impl_def_generic_params_data(&self, impl_def_id: ImplDefId) -> Maybe<GenericParamsData>;
#[salsa::invoke(items::imp::impl_def_generic_params)]
fn impl_def_generic_params(&self, impl_def_id: ImplDefId) -> Maybe<Vec<GenericParam>>;
#[salsa::invoke(items::imp::impl_def_resolver_data)]
#[salsa::cycle(items::imp::impl_def_resolver_data_cycle)]
fn impl_def_resolver_data(&self, impl_def_id: ImplDefId) -> Maybe<Arc<ResolverData>>;
#[salsa::invoke(items::imp::impl_def_concrete_trait)]
#[salsa::cycle(items::imp::impl_def_concrete_trait_cycle)]
fn impl_def_concrete_trait(&self, impl_def_id: ImplDefId) -> Maybe<ConcreteTraitId>;
#[salsa::invoke(items::imp::impl_def_substitution)]
fn impl_def_substitution(&self, impl_def_id: ImplDefId) -> Maybe<Arc<GenericSubstitution>>;
#[salsa::invoke(items::imp::impl_def_attributes)]
fn impl_def_attributes(&self, impl_def_id: ImplDefId) -> Maybe<Vec<Attribute>>;
#[salsa::invoke(items::imp::impl_concrete_trait)]
fn impl_concrete_trait(&self, impl_id: ImplId) -> Maybe<ConcreteTraitId>;
#[salsa::invoke(items::imp::impl_def_trait)]
fn impl_def_trait(&self, impl_def_id: ImplDefId) -> Maybe<TraitId>;
#[salsa::invoke(items::imp::priv_impl_declaration_data)]
#[salsa::cycle(items::imp::priv_impl_declaration_data_cycle)]
fn priv_impl_declaration_data(
&self,
impl_def_id: ImplDefId,
) -> Maybe<items::imp::ImplDeclarationData>;
#[salsa::invoke(items::imp::impl_semantic_definition_diagnostics)]
fn impl_semantic_definition_diagnostics(
&self,
impl_def_id: ImplDefId,
) -> Diagnostics<SemanticDiagnostic>;
#[salsa::invoke(items::imp::impl_item_by_name)]
fn impl_item_by_name(&self, impl_def_id: ImplDefId, name: SmolStr)
-> Maybe<Option<ImplItemId>>;
#[salsa::invoke(items::imp::impl_implicit_impl_by_name)]
fn impl_implicit_impl_by_name(
&self,
impl_def_id: ImplDefId,
name: SmolStr,
) -> Maybe<Option<TraitImplId>>;
#[salsa::invoke(items::imp::impl_all_used_items)]
fn impl_all_used_items(
&self,
impl_def_id: ImplDefId,
) -> Maybe<Arc<OrderedHashSet<LookupItemId>>>;
#[salsa::invoke(items::imp::impl_types)]
fn impl_types(
&self,
impl_def_id: ImplDefId,
) -> Maybe<Arc<OrderedHashMap<ImplTypeDefId, ast::ItemTypeAlias>>>;
#[salsa::invoke(items::imp::impl_type_ids)]
fn impl_type_ids(&self, impl_def_id: ImplDefId) -> Maybe<Arc<[ImplTypeDefId]>>;
#[salsa::invoke(items::imp::impl_type_by_id)]
fn impl_type_by_id(&self, impl_type_id: ImplTypeDefId) -> Maybe<Option<ast::ItemTypeAlias>>;
#[salsa::invoke(items::imp::impl_type_by_trait_type)]
fn impl_type_by_trait_type(
&self,
impl_def_id: ImplDefId,
trait_type_id: TraitTypeId,
) -> Maybe<ImplTypeDefId>;
#[salsa::invoke(items::imp::impl_constants)]
fn impl_constants(
&self,
impl_def_id: ImplDefId,
) -> Maybe<Arc<OrderedHashMap<ImplConstantDefId, ast::ItemConstant>>>;
#[salsa::invoke(items::imp::impl_impls)]
fn impl_impls(
&self,
impl_def_id: ImplDefId,
) -> Maybe<Arc<OrderedHashMap<ImplImplDefId, ast::ItemImplAlias>>>;
#[salsa::invoke(items::imp::impl_impl_ids)]
fn impl_impl_ids(&self, impl_def_id: ImplDefId) -> Maybe<Arc<[ImplImplDefId]>>;
#[salsa::invoke(items::imp::impl_impl_by_id)]
fn impl_impl_by_id(&self, impl_impl_id: ImplImplDefId) -> Maybe<Option<ast::ItemImplAlias>>;
#[salsa::invoke(items::imp::impl_impl_by_trait_impl)]
fn impl_impl_by_trait_impl(
&self,
impl_def_id: ImplDefId,
trait_impl_id: TraitImplId,
) -> Maybe<ImplImplDefId>;
#[salsa::invoke(items::imp::is_implicit_impl_impl)]
fn is_implicit_impl_impl(
&self,
impl_def_id: ImplDefId,
trait_impl_id: TraitImplId,
) -> Maybe<bool>;
#[salsa::invoke(items::imp::impl_constant_by_trait_constant)]
fn impl_constant_by_trait_constant(
&self,
impl_def_id: ImplDefId,
trait_constant_id: TraitConstantId,
) -> Maybe<ImplConstantDefId>;
#[salsa::invoke(items::imp::impl_functions)]
fn impl_functions(
&self,
impl_def_id: ImplDefId,
) -> Maybe<OrderedHashMap<SmolStr, ImplFunctionId>>;
#[salsa::invoke(items::imp::impl_function_by_trait_function)]
fn impl_function_by_trait_function(
&self,
impl_def_id: ImplDefId,
trait_function_id: TraitFunctionId,
) -> Maybe<Option<ImplFunctionId>>;
#[salsa::invoke(items::imp::priv_impl_definition_data)]
fn priv_impl_definition_data(
&self,
impl_def_id: ImplDefId,
) -> Maybe<items::imp::ImplDefinitionData>;
#[salsa::invoke(items::imp::priv_impl_is_fully_concrete)]
fn priv_impl_is_fully_concrete(&self, impl_id: ImplId) -> bool;
#[salsa::invoke(items::imp::priv_impl_is_var_free)]
fn priv_impl_is_var_free(&self, impl_id: ImplId) -> bool;
#[salsa::invoke(items::imp::impl_type_def_semantic_diagnostics)]
fn impl_type_def_semantic_diagnostics(
&self,
impl_type_def_id: ImplTypeDefId,
) -> Diagnostics<SemanticDiagnostic>;
#[salsa::invoke(items::imp::impl_type_def_resolved_type)]
#[salsa::cycle(items::imp::impl_type_def_resolved_type_cycle)]
fn impl_type_def_resolved_type(&self, impl_type_def_id: ImplTypeDefId) -> Maybe<TypeId>;
#[salsa::invoke(items::imp::impl_type_def_generic_params)]
fn impl_type_def_generic_params(
&self,
impl_type_def_id: ImplTypeDefId,
) -> Maybe<Vec<GenericParam>>;
#[salsa::invoke(items::imp::impl_type_def_attributes)]
fn impl_type_def_attributes(&self, impl_type_def_id: ImplTypeDefId) -> Maybe<Vec<Attribute>>;
#[salsa::invoke(items::imp::impl_type_def_resolver_data)]
fn impl_type_def_resolver_data(
&self,
impl_type_def_id: ImplTypeDefId,
) -> Maybe<Arc<ResolverData>>;
#[salsa::invoke(items::imp::impl_type_def_trait_type)]
fn impl_type_def_trait_type(&self, impl_type_def_id: ImplTypeDefId) -> Maybe<TraitTypeId>;
#[salsa::invoke(items::imp::priv_impl_type_semantic_data)]
#[salsa::cycle(items::imp::priv_impl_type_semantic_data_cycle)]
fn priv_impl_type_semantic_data(
&self,
impl_type_def_id: ImplTypeDefId,
in_cycle: bool,
) -> Maybe<items::imp::ImplItemTypeData>;
#[salsa::invoke(items::imp::priv_impl_type_def_generic_params_data)]
fn priv_impl_type_def_generic_params_data(
&self,
impl_type_def_id: ImplTypeDefId,
) -> Maybe<GenericParamsData>;
#[salsa::invoke(items::imp::impl_type_concrete_implized)]
#[salsa::cycle(items::imp::impl_type_concrete_implized_cycle)]
fn impl_type_concrete_implized(&self, impl_type_def_id: ImplTypeId) -> Maybe<TypeId>;
#[salsa::invoke(items::imp::impl_constant_def_semantic_diagnostics)]
fn impl_constant_def_semantic_diagnostics(
&self,
impl_constant_def_id: ImplConstantDefId,
) -> Diagnostics<SemanticDiagnostic>;
#[salsa::invoke(items::imp::impl_constant_def_value)]
#[salsa::cycle(items::imp::impl_constant_def_value_cycle)]
fn impl_constant_def_value(
&self,
impl_constant_def_id: ImplConstantDefId,
) -> Maybe<ConstValueId>;
#[salsa::invoke(items::imp::impl_constant_def_resolver_data)]
fn impl_constant_def_resolver_data(
&self,
impl_constant_def_id: ImplConstantDefId,
) -> Maybe<Arc<ResolverData>>;
#[salsa::invoke(items::imp::impl_constant_def_trait_constant)]
fn impl_constant_def_trait_constant(
&self,
impl_constant_def_id: ImplConstantDefId,
) -> Maybe<TraitConstantId>;
#[salsa::invoke(items::imp::priv_impl_constant_semantic_data)]
#[salsa::cycle(items::imp::priv_impl_constant_semantic_data_cycle)]
fn priv_impl_constant_semantic_data(
&self,
impl_constant_def_id: ImplConstantDefId,
in_cycle: bool,
) -> Maybe<items::imp::ImplItemConstantData>;
#[salsa::invoke(items::imp::impl_constant_implized_by_context)]
#[salsa::cycle(items::imp::impl_constant_implized_by_context_cycle)]
fn impl_constant_implized_by_context(
&self,
impl_constant_id: ImplConstantId,
impl_def_id: ImplDefId,
) -> Maybe<ConstValueId>;
#[salsa::invoke(items::imp::impl_constant_concrete_implized_value)]
#[salsa::cycle(items::imp::impl_constant_concrete_implized_value_cycle)]
fn impl_constant_concrete_implized_value(
&self,
impl_constant_id: ImplConstantId,
) -> Maybe<ConstValueId>;
#[salsa::invoke(items::imp::impl_constant_concrete_implized_type)]
#[salsa::cycle(items::imp::impl_constant_concrete_implized_type_cycle)]
fn impl_constant_concrete_implized_type(
&self,
impl_constant_id: ImplConstantId,
) -> Maybe<TypeId>;
#[salsa::invoke(items::imp::impl_impl_def_semantic_diagnostics)]
fn impl_impl_def_semantic_diagnostics(
&self,
impl_impl_def_id: ImplImplDefId,
) -> Diagnostics<SemanticDiagnostic>;
#[salsa::invoke(items::imp::impl_impl_def_resolver_data)]
fn impl_impl_def_resolver_data(
&self,
impl_impl_def_id: ImplImplDefId,
) -> Maybe<Arc<ResolverData>>;
#[salsa::invoke(items::imp::impl_impl_def_trait_impl)]
fn impl_impl_def_trait_impl(&self, impl_impl_def_id: ImplImplDefId) -> Maybe<TraitImplId>;
#[salsa::invoke(items::imp::impl_impl_def_impl)]
#[salsa::cycle(items::imp::impl_impl_def_impl_cycle)]
fn impl_impl_def_impl(&self, impl_impl_def_id: ImplImplDefId, in_cycle: bool) -> Maybe<ImplId>;
#[salsa::invoke(items::imp::priv_impl_impl_semantic_data)]
#[salsa::cycle(items::imp::priv_impl_impl_semantic_data_cycle)]
fn priv_impl_impl_semantic_data(
&self,
impl_impl_def_id: ImplImplDefId,
in_cycle: bool,
) -> Maybe<items::imp::ImplItemImplData>;
#[salsa::invoke(items::imp::priv_impl_impl_def_generic_params_data)]
fn priv_impl_impl_def_generic_params_data(
&self,
impl_impl_def_id: ImplImplDefId,
) -> Maybe<GenericParamsData>;
#[salsa::invoke(items::imp::implicit_impl_impl_semantic_diagnostics)]
fn implicit_impl_impl_semantic_diagnostics(
&self,
impl_def_id: ImplDefId,
trait_impl_id: TraitImplId,
) -> Diagnostics<SemanticDiagnostic>;
#[salsa::invoke(items::imp::implicit_impl_impl_impl)]
#[salsa::cycle(items::imp::implicit_impl_impl_impl_cycle)]
fn implicit_impl_impl_impl(
&self,
impl_def_id: ImplDefId,
trait_impl_id: TraitImplId,
in_cycle: bool,
) -> Maybe<ImplId>;
#[salsa::invoke(items::imp::priv_implicit_impl_impl_semantic_data)]
#[salsa::cycle(items::imp::priv_implicit_impl_impl_semantic_data_cycle)]
fn priv_implicit_impl_impl_semantic_data(
&self,
impl_def_id: ImplDefId,
trait_impl_id: TraitImplId,
in_cycle: bool,
) -> Maybe<ImplicitImplImplData>;
#[salsa::invoke(items::imp::impl_impl_implized_by_context)]
#[salsa::cycle(items::imp::impl_impl_implized_by_context_cycle)]
fn impl_impl_implized_by_context(
&self,
impl_impl_id: ImplImplId,
impl_def_id: ImplDefId,
in_cycle: bool,
) -> Maybe<ImplId>;
#[salsa::invoke(items::imp::impl_impl_concrete_implized)]
#[salsa::cycle(items::imp::impl_impl_concrete_implized_cycle)]
fn impl_impl_concrete_implized(&self, impl_impl_id: ImplImplId) -> Maybe<ImplId>;
#[salsa::invoke(items::imp::impl_impl_concrete_trait)]
fn impl_impl_concrete_trait(&self, impl_impl_id: ImplImplId) -> Maybe<ConcreteTraitId>;
#[salsa::invoke(items::imp::impl_function_declaration_diagnostics)]
fn impl_function_declaration_diagnostics(
&self,
impl_function_id: ImplFunctionId,
) -> Diagnostics<SemanticDiagnostic>;
#[salsa::invoke(items::imp::impl_function_signature)]
fn impl_function_signature(
&self,
impl_function_id: ImplFunctionId,
) -> Maybe<semantic::Signature>;
#[salsa::invoke(items::imp::impl_function_generic_params)]
fn impl_function_generic_params(
&self,
impl_function_id: ImplFunctionId,
) -> Maybe<Vec<GenericParam>>;
#[salsa::invoke(items::imp::priv_impl_function_generic_params_data)]
fn priv_impl_function_generic_params_data(
&self,
impl_function_id: ImplFunctionId,
) -> Maybe<GenericParamsData>;
#[salsa::invoke(items::imp::impl_function_attributes)]
fn impl_function_attributes(&self, impl_function_id: ImplFunctionId) -> Maybe<Vec<Attribute>>;
#[salsa::invoke(items::imp::impl_function_resolver_data)]
fn impl_function_resolver_data(
&self,
impl_function_id: ImplFunctionId,
) -> Maybe<Arc<ResolverData>>;
#[salsa::invoke(items::imp::impl_function_declaration_inline_config)]
fn impl_function_declaration_inline_config(
&self,
impl_function_id: ImplFunctionId,
) -> Maybe<InlineConfiguration>;
#[salsa::invoke(items::imp::impl_function_declaration_implicit_precedence)]
fn impl_function_declaration_implicit_precedence(
&self,
impl_function_id: ImplFunctionId,
) -> Maybe<ImplicitPrecedence>;
#[salsa::invoke(items::imp::impl_function_declaration_implicits)]
fn impl_function_declaration_implicits(
&self,
impl_function_id: ImplFunctionId,
) -> Maybe<Vec<TypeId>>;
#[salsa::invoke(items::imp::impl_function_trait_function)]
fn impl_function_trait_function(
&self,
impl_function_id: ImplFunctionId,
) -> Maybe<TraitFunctionId>;
#[salsa::invoke(items::imp::priv_impl_function_declaration_data)]
fn priv_impl_function_declaration_data(
&self,
impl_function_id: ImplFunctionId,
) -> Maybe<items::imp::ImplFunctionDeclarationData>;
#[salsa::invoke(items::imp::impl_function_body_diagnostics)]
fn impl_function_body_diagnostics(
&self,
impl_function_id: ImplFunctionId,
) -> Diagnostics<SemanticDiagnostic>;
#[salsa::invoke(items::imp::impl_function_body)]
fn impl_function_body(&self, impl_function_id: ImplFunctionId) -> Maybe<Arc<FunctionBody>>;
#[salsa::invoke(items::imp::impl_function_body_resolver_data)]
fn impl_function_body_resolver_data(
&self,
impl_function_id: ImplFunctionId,
) -> Maybe<Arc<ResolverData>>;
#[salsa::invoke(items::imp::priv_impl_function_body_data)]
fn priv_impl_function_body_data(
&self,
impl_function_id: ImplFunctionId,
) -> Maybe<items::function_with_body::FunctionBodyData>;
#[salsa::invoke(items::implization::trait_type_implized_by_context)]
#[salsa::cycle(items::implization::trait_type_implized_by_context_cycle)]
fn trait_type_implized_by_context(
&self,
trait_type_def_id: TraitTypeId,
impl_def_id: ImplDefId,
) -> Maybe<TypeId>;
#[salsa::invoke(items::free_function::free_function_declaration_diagnostics)]
fn free_function_declaration_diagnostics(
&self,
free_function_id: FreeFunctionId,
) -> Diagnostics<SemanticDiagnostic>;
#[salsa::invoke(items::free_function::free_function_signature)]
fn free_function_signature(
&self,
free_function_id: FreeFunctionId,
) -> Maybe<semantic::Signature>;
#[salsa::invoke(items::free_function::free_function_declaration_implicits)]
fn free_function_declaration_implicits(
&self,
free_function_id: FreeFunctionId,
) -> Maybe<Vec<TypeId>>;
#[salsa::invoke(items::free_function::free_function_declaration_implicit_precedence)]
fn free_function_declaration_implicit_precedence(
&self,
free_function_id: FreeFunctionId,
) -> Maybe<ImplicitPrecedence>;
#[salsa::invoke(items::free_function::free_function_generic_params)]
fn free_function_generic_params(
&self,
free_function_id: FreeFunctionId,
) -> Maybe<Vec<GenericParam>>;
#[salsa::invoke(items::free_function::free_function_generic_params_data)]
fn free_function_generic_params_data(
&self,
free_function_id: FreeFunctionId,
) -> Maybe<GenericParamsData>;
#[salsa::invoke(items::free_function::free_function_declaration_resolver_data)]
fn free_function_declaration_resolver_data(
&self,
free_function_id: FreeFunctionId,
) -> Maybe<Arc<ResolverData>>;
#[salsa::invoke(items::free_function::free_function_declaration_inline_config)]
fn free_function_declaration_inline_config(
&self,
free_function_id: FreeFunctionId,
) -> Maybe<InlineConfiguration>;
#[salsa::invoke(items::free_function::priv_free_function_declaration_data)]
fn priv_free_function_declaration_data(
&self,
function_id: FreeFunctionId,
) -> Maybe<items::functions::FunctionDeclarationData>;
#[salsa::invoke(items::free_function::free_function_body_diagnostics)]
fn free_function_body_diagnostics(
&self,
free_function_id: FreeFunctionId,
) -> Diagnostics<SemanticDiagnostic>;
#[salsa::invoke(items::free_function::free_function_body_resolver_data)]
fn free_function_body_resolver_data(
&self,
free_function_id: FreeFunctionId,
) -> Maybe<Arc<ResolverData>>;
#[salsa::invoke(items::free_function::priv_free_function_body_data)]
fn priv_free_function_body_data(
&self,
free_function_id: FreeFunctionId,
) -> Maybe<items::function_with_body::FunctionBodyData>;
#[salsa::invoke(items::function_with_body::function_declaration_diagnostics)]
fn function_declaration_diagnostics(
&self,
function_id: FunctionWithBodyId,
) -> Diagnostics<SemanticDiagnostic>;
#[salsa::invoke(items::function_with_body::function_declaration_inline_config)]
fn function_declaration_inline_config(
&self,
function_id: FunctionWithBodyId,
) -> Maybe<InlineConfiguration>;
#[salsa::invoke(items::function_with_body::function_declaration_implicit_precedence)]
fn function_declaration_implicit_precedence(
&self,
function_id: FunctionWithBodyId,
) -> Maybe<ImplicitPrecedence>;
#[salsa::invoke(items::function_with_body::function_with_body_signature)]
fn function_with_body_signature(
&self,
function_id: FunctionWithBodyId,
) -> Maybe<semantic::Signature>;
#[salsa::invoke(items::function_with_body::function_with_body_generic_params)]
fn function_with_body_generic_params(
&self,
function_id: FunctionWithBodyId,
) -> Maybe<Vec<GenericParam>>;
#[salsa::invoke(items::function_with_body::function_with_body_attributes)]
fn function_with_body_attributes(
&self,
function_id: FunctionWithBodyId,
) -> Maybe<Vec<Attribute>>;
#[salsa::invoke(items::function_with_body::function_body_diagnostics)]
fn function_body_diagnostics(
&self,
function_id: FunctionWithBodyId,
) -> Diagnostics<SemanticDiagnostic>;
#[salsa::invoke(items::function_with_body::function_body_expr)]
fn function_body_expr(&self, function_id: FunctionWithBodyId) -> Maybe<semantic::ExprId>;
#[salsa::invoke(items::function_with_body::function_body)]
fn function_body(&self, function_id: FunctionWithBodyId) -> Maybe<Arc<FunctionBody>>;
#[salsa::invoke(items::extern_function::priv_extern_function_declaration_data)]
fn priv_extern_function_declaration_data(
&self,
function_id: ExternFunctionId,
) -> Maybe<items::functions::FunctionDeclarationData>;
#[salsa::invoke(items::extern_function::extern_function_declaration_inline_config)]
fn extern_function_declaration_inline_config(
&self,
extern_function_id: ExternFunctionId,
) -> Maybe<InlineConfiguration>;
#[salsa::invoke(items::extern_function::extern_function_declaration_diagnostics)]
fn extern_function_declaration_diagnostics(
&self,
extern_function_id: ExternFunctionId,
) -> Diagnostics<SemanticDiagnostic>;
#[salsa::invoke(items::extern_function::extern_function_signature)]
fn extern_function_signature(
&self,
extern_function_id: ExternFunctionId,
) -> Maybe<semantic::Signature>;
#[salsa::invoke(items::extern_function::extern_function_declaration_generic_params)]
fn extern_function_declaration_generic_params(
&self,
extern_function_id: ExternFunctionId,
) -> Maybe<Vec<GenericParam>>;
#[salsa::invoke(items::extern_function::extern_function_declaration_generic_params_data)]
fn extern_function_declaration_generic_params_data(
&self,
extern_function_id: ExternFunctionId,
) -> Maybe<GenericParamsData>;
#[salsa::invoke(items::extern_function::extern_function_declaration_implicits)]
fn extern_function_declaration_implicits(
&self,
extern_function_id: ExternFunctionId,
) -> Maybe<Vec<TypeId>>;
#[salsa::invoke(items::extern_function::extern_function_declaration_refs)]
fn extern_function_declaration_refs(
&self,
extern_function_id: ExternFunctionId,
) -> Maybe<Vec<Parameter>>;
#[salsa::invoke(items::extern_function::extern_function_declaration_resolver_data)]
fn extern_function_declaration_resolver_data(
&self,
extern_function_id: ExternFunctionId,
) -> Maybe<Arc<ResolverData>>;
#[salsa::invoke(items::extern_type::priv_extern_type_declaration_data)]
fn priv_extern_type_declaration_data(
&self,
type_id: ExternTypeId,
) -> Maybe<items::extern_type::ExternTypeDeclarationData>;
#[salsa::invoke(items::extern_type::extern_type_declaration_diagnostics)]
fn extern_type_declaration_diagnostics(
&self,
extern_type_id: ExternTypeId,
) -> Diagnostics<SemanticDiagnostic>;
#[salsa::invoke(items::extern_type::extern_type_declaration_generic_params)]
fn extern_type_declaration_generic_params(
&self,
extern_type_id: ExternTypeId,
) -> Maybe<Vec<GenericParam>>;
#[salsa::invoke(items::extern_type::extern_type_declaration_generic_params_data)]
fn extern_type_declaration_generic_params_data(
&self,
extern_type_id: ExternTypeId,
) -> Maybe<GenericParamsData>;
#[salsa::invoke(items::extern_type::extern_type_attributes)]
fn extern_type_attributes(&self, extern_type_id: ExternTypeId) -> Maybe<Vec<Attribute>>;
#[salsa::invoke(items::functions::function_title_signature)]
fn function_title_signature(
&self,
function_title_id: FunctionTitleId,
) -> Maybe<semantic::Signature>;
#[salsa::invoke(items::functions::function_title_generic_params)]
fn function_title_generic_params(
&self,
function_title_id: FunctionTitleId,
) -> Maybe<Vec<GenericParam>>;
#[salsa::invoke(items::functions::concrete_function_signature)]
fn concrete_function_signature(&self, function_id: FunctionId) -> Maybe<semantic::Signature>;
#[salsa::invoke(types::generic_type_generic_params)]
fn generic_type_generic_params(&self, generic_type: GenericTypeId) -> Maybe<Vec<GenericParam>>;
#[salsa::invoke(items::generics::generic_param_semantic)]
fn generic_param_semantic(&self, generic_param: GenericParamId) -> Maybe<GenericParam>;
#[salsa::invoke(items::generics::generic_param_diagnostics)]
fn generic_param_diagnostics(
&self,
generic_param: GenericParamId,
) -> Diagnostics<SemanticDiagnostic>;
#[salsa::invoke(items::generics::generic_param_resolver_data)]
fn generic_param_resolver_data(
&self,
generic_param: GenericParamId,
) -> Maybe<Arc<ResolverData>>;
#[salsa::invoke(items::generics::generic_impl_param_trait)]
fn generic_impl_param_trait(&self, generic_param_id: GenericParamId) -> Maybe<TraitId>;
#[salsa::invoke(items::generics::priv_generic_param_data)]
#[salsa::cycle(items::generics::priv_generic_param_data_cycle)]
fn priv_generic_param_data(
&self,
generic_param: GenericParamId,
in_cycle: bool,
) -> Maybe<GenericParamData>;
#[salsa::invoke(types::single_value_type)]
fn single_value_type(&self, ty: types::TypeId) -> Maybe<bool>;
#[salsa::invoke(types::type_size_info)]
#[salsa::cycle(types::type_size_info_cycle)]
fn type_size_info(&self, ty: types::TypeId) -> Maybe<TypeSizeInformation>;
#[salsa::invoke(types::type_info)]
fn type_info(
&self,
lookup_context: ImplLookupContext,
ty: types::TypeId,
) -> Maybe<types::TypeInfo>;
#[salsa::invoke(types::priv_type_is_fully_concrete)]
fn priv_type_is_fully_concrete(&self, ty: types::TypeId) -> bool;
#[salsa::invoke(types::priv_type_is_var_free)]
fn priv_type_is_var_free(&self, ty: types::TypeId) -> bool;
#[salsa::invoke(items::function_with_body::expr_semantic)]
fn expr_semantic(
&self,
function_id: FunctionWithBodyId,
id: semantic::ExprId,
) -> semantic::Expr;
#[salsa::invoke(items::function_with_body::pattern_semantic)]
fn pattern_semantic(
&self,
function_id: FunctionWithBodyId,
id: semantic::PatternId,
) -> semantic::Pattern;
#[salsa::invoke(items::function_with_body::statement_semantic)]
fn statement_semantic(
&self,
function_id: FunctionWithBodyId,
id: semantic::StatementId,
) -> semantic::Statement;
fn lookup_resolved_generic_item_by_ptr(
&self,
id: LookupItemId,
ptr: ast::TerminalIdentifierPtr,
) -> Option<ResolvedGenericItem>;
fn lookup_resolved_concrete_item_by_ptr(
&self,
id: LookupItemId,
ptr: ast::TerminalIdentifierPtr,
) -> Option<ResolvedConcreteItem>;
fn module_semantic_diagnostics(
&self,
module_id: ModuleId,
) -> Maybe<Diagnostics<SemanticDiagnostic>>;
fn file_semantic_diagnostics(&self, file_id: FileId) -> Maybe<Diagnostics<SemanticDiagnostic>>;
#[salsa::invoke(corelib::core_crate)]
fn core_crate(&self) -> CrateId;
#[salsa::invoke(corelib::core_module)]
fn core_module(&self) -> ModuleId;
#[salsa::invoke(corelib::core_felt252_ty)]
fn core_felt252_ty(&self) -> semantic::TypeId;
#[salsa::input]
fn analyzer_plugins(&self) -> Vec<Arc<dyn AnalyzerPlugin>>;
fn declared_allows(&self) -> Arc<OrderedHashSet<String>>;
#[salsa::invoke(lsp_helpers::methods_in_module)]
fn methods_in_module(
&self,
module_id: ModuleId,
type_filter: lsp_helpers::TypeFilter,
) -> Arc<[TraitFunctionId]>;
#[salsa::invoke(lsp_helpers::methods_in_crate)]
fn methods_in_crate(
&self,
crate_id: CrateId,
type_filter: lsp_helpers::TypeFilter,
) -> Arc<[TraitFunctionId]>;
#[salsa::invoke(lsp_helpers::visible_traits_from_module)]
fn visible_traits_from_module(
&self,
module_id: ModuleId,
) -> Option<Arc<OrderedHashMap<TraitId, String>>>;
#[salsa::invoke(lsp_helpers::visible_traits_in_module)]
fn visible_traits_in_module(
&self,
module_id: ModuleId,
user_module_id: ModuleId,
include_parent: bool,
) -> Arc<[(TraitId, String)]>;
#[salsa::invoke(lsp_helpers::visible_traits_in_crate)]
fn visible_traits_in_crate(
&self,
crate_id: CrateId,
user_module_id: ModuleId,
) -> Arc<[(TraitId, String)]>;
}
impl<T: Upcast<dyn SemanticGroup + 'static>> Elongate for T {
fn elongate(&self) -> &(dyn SemanticGroup + 'static) {
self.upcast()
}
}
fn module_semantic_diagnostics(
db: &dyn SemanticGroup,
module_id: ModuleId,
) -> Maybe<Diagnostics<SemanticDiagnostic>> {
let mut diagnostics = DiagnosticsBuilder::default();
for (_module_file_id, plugin_diag) in db.module_plugin_diagnostics(module_id)?.iter().cloned() {
diagnostics.add(SemanticDiagnostic::new(
StableLocation::new(plugin_diag.stable_ptr),
SemanticDiagnosticKind::PluginDiagnostic(plugin_diag),
));
}
let data = db.priv_module_semantic_data(module_id)?;
diagnostics.extend(data.diagnostics.clone());
for item in db.module_items(module_id)?.iter() {
match item {
ModuleItemId::Constant(const_id) => {
diagnostics.extend(db.constant_semantic_diagnostics(*const_id));
}
ModuleItemId::Use(use_id) => {
diagnostics.extend(db.use_semantic_diagnostics(*use_id));
}
ModuleItemId::FreeFunction(free_function) => {
diagnostics.extend(db.free_function_declaration_diagnostics(*free_function));
diagnostics.extend(db.free_function_body_diagnostics(*free_function));
}
ModuleItemId::Struct(struct_id) => {
diagnostics.extend(db.struct_declaration_diagnostics(*struct_id));
diagnostics.extend(db.struct_definition_diagnostics(*struct_id));
}
ModuleItemId::Enum(enum_id) => {
diagnostics.extend(db.enum_definition_diagnostics(*enum_id));
diagnostics.extend(db.enum_declaration_diagnostics(*enum_id));
}
ModuleItemId::Trait(trait_id) => {
diagnostics.extend(db.trait_semantic_declaration_diagnostics(*trait_id));
diagnostics.extend(db.trait_semantic_definition_diagnostics(*trait_id));
}
ModuleItemId::Impl(impl_def_id) => {
diagnostics.extend(db.impl_semantic_declaration_diagnostics(*impl_def_id));
diagnostics.extend(db.impl_semantic_definition_diagnostics(*impl_def_id));
}
ModuleItemId::Submodule(submodule_id) => {
if let Ok(file_id) = db.module_main_file(ModuleId::Submodule(*submodule_id)) {
if db.file_content(file_id).is_none() {
let path = match file_id.lookup_intern(db) {
FileLongId::OnDisk(path) => path.display().to_string(),
FileLongId::Virtual(_) | FileLongId::External(_) => {
panic!("Expected OnDisk file.")
}
};
let stable_location =
StableLocation::new(submodule_id.stable_ptr(db.upcast()).untyped());
diagnostics.add(SemanticDiagnostic::new(
stable_location,
SemanticDiagnosticKind::ModuleFileNotFound(path),
));
}
}
}
ModuleItemId::ExternType(extern_type) => {
diagnostics.extend(db.extern_type_declaration_diagnostics(*extern_type));
}
ModuleItemId::ExternFunction(extern_function) => {
diagnostics.extend(db.extern_function_declaration_diagnostics(*extern_function));
}
ModuleItemId::TypeAlias(type_alias) => {
diagnostics.extend(db.module_type_alias_semantic_diagnostics(*type_alias));
}
ModuleItemId::ImplAlias(type_alias) => {
diagnostics.extend(db.impl_alias_semantic_diagnostics(*type_alias));
}
}
}
add_unused_item_diagnostics(db, module_id, &data, &mut diagnostics);
for analyzer_plugin in db.analyzer_plugins().iter() {
for diag in analyzer_plugin.diagnostics(db, module_id) {
diagnostics.add(SemanticDiagnostic::new(
StableLocation::new(diag.stable_ptr),
SemanticDiagnosticKind::PluginDiagnostic(diag),
));
}
}
Ok(diagnostics.build())
}
fn declared_allows(db: &dyn SemanticGroup) -> Arc<OrderedHashSet<String>> {
Arc::new(OrderedHashSet::from_iter(
db.analyzer_plugins().into_iter().flat_map(|plugin| plugin.declared_allows()),
))
}
fn add_unused_item_diagnostics(
db: &dyn SemanticGroup,
module_id: ModuleId,
data: &ModuleSemanticData,
diagnostics: &mut DiagnosticsBuilder<SemanticDiagnostic>,
) {
let Ok(all_used_items) = db.module_all_used_items(module_id) else {
return;
};
for info in data.items.values() {
if info.visibility == Visibility::Public {
continue;
}
if let ModuleItemId::Use(use_id) = info.item_id {
add_unused_import_diagnostics(db, &all_used_items, use_id, diagnostics);
};
}
}
fn add_unused_import_diagnostics(
db: &dyn SemanticGroup,
all_used_items: &OrderedHashSet<LookupItemId>,
use_id: UseId,
diagnostics: &mut DiagnosticsBuilder<SemanticDiagnostic>,
) {
let _iife = (|| {
let item = db.use_resolved_item(use_id).ok()?;
require(!matches!(
item,
ResolvedGenericItem::Impl(_) | ResolvedGenericItem::GenericImplAlias(_)
))?;
require(!all_used_items.contains(&LookupItemId::ModuleItem(ModuleItemId::Use(use_id))))?;
let resolver_data = db.use_resolver_data(use_id).ok()?;
require(!resolver_data.feature_config.allow_unused_imports)?;
Some(diagnostics.add(SemanticDiagnostic::new(
StableLocation::new(use_id.untyped_stable_ptr(db.upcast())),
SemanticDiagnosticKind::UnusedImport(use_id),
)))
})();
}
fn file_semantic_diagnostics(
db: &dyn SemanticGroup,
file_id: FileId,
) -> Maybe<Diagnostics<SemanticDiagnostic>> {
let mut diagnostics = DiagnosticsBuilder::default();
for module_id in db.file_modules(file_id)?.iter().copied() {
if let Ok(module_diagnostics) = db.module_semantic_diagnostics(module_id) {
diagnostics.extend(module_diagnostics)
}
}
Ok(diagnostics.build())
}
pub fn lookup_resolved_generic_item_by_ptr(
db: &dyn SemanticGroup,
id: LookupItemId,
ptr: ast::TerminalIdentifierPtr,
) -> Option<ResolvedGenericItem> {
get_resolver_data_options(id, db)
.into_iter()
.find_map(|resolver_data| resolver_data.resolved_items.generic.get(&ptr).cloned())
}
pub fn lookup_resolved_concrete_item_by_ptr(
db: &dyn SemanticGroup,
id: LookupItemId,
ptr: ast::TerminalIdentifierPtr,
) -> Option<ResolvedConcreteItem> {
get_resolver_data_options(id, db)
.into_iter()
.find_map(|resolver_data| resolver_data.resolved_items.concrete.get(&ptr).cloned())
}
pub fn get_resolver_data_options(
id: LookupItemId,
db: &dyn SemanticGroup,
) -> Vec<Arc<ResolverData>> {
match id {
LookupItemId::ModuleItem(module_item) => match module_item {
ModuleItemId::Constant(id) => vec![db.constant_resolver_data(id)],
ModuleItemId::Submodule(_) => vec![],
ModuleItemId::Use(id) => vec![db.use_resolver_data(id)],
ModuleItemId::FreeFunction(id) => vec![
db.free_function_declaration_resolver_data(id),
db.free_function_body_resolver_data(id),
],
ModuleItemId::Struct(id) => vec![
db.struct_declaration_resolver_data(id),
db.struct_definition_resolver_data(id),
],
ModuleItemId::Enum(id) => {
vec![db.enum_definition_resolver_data(id), db.enum_declaration_resolver_data(id)]
}
ModuleItemId::TypeAlias(id) => vec![db.module_type_alias_resolver_data(id)],
ModuleItemId::ImplAlias(id) => vec![db.impl_alias_resolver_data(id)],
ModuleItemId::Trait(_) => vec![],
ModuleItemId::Impl(id) => vec![db.impl_def_resolver_data(id)],
ModuleItemId::ExternType(_) => vec![],
ModuleItemId::ExternFunction(id) => {
vec![db.extern_function_declaration_resolver_data(id)]
}
},
LookupItemId::TraitItem(id) => match id {
cairo_lang_defs::ids::TraitItemId::Function(id) => {
let mut res = vec![db.trait_function_resolver_data(id)];
if let Ok(Some(body)) = db.priv_trait_function_body_data(id) {
res.push(Ok(body.resolver_data));
}
res
}
cairo_lang_defs::ids::TraitItemId::Type(id) => vec![db.trait_type_resolver_data(id)],
cairo_lang_defs::ids::TraitItemId::Constant(id) => {
vec![db.trait_constant_resolver_data(id)]
}
cairo_lang_defs::ids::TraitItemId::Impl(id) => vec![db.trait_impl_resolver_data(id)],
},
LookupItemId::ImplItem(id) => match id {
cairo_lang_defs::ids::ImplItemId::Function(id) => {
vec![db.impl_function_resolver_data(id), db.impl_function_body_resolver_data(id)]
}
cairo_lang_defs::ids::ImplItemId::Type(id) => vec![db.impl_type_def_resolver_data(id)],
cairo_lang_defs::ids::ImplItemId::Constant(id) => {
vec![db.impl_constant_def_resolver_data(id)]
}
cairo_lang_defs::ids::ImplItemId::Impl(id) => vec![db.impl_impl_def_resolver_data(id)],
},
}
.into_iter()
.flatten()
.collect()
}