pub struct TypeState {
pub owned: OwnedTypeState,
pub shared: Arc<SharedTypeState>,
}Fields§
§owned: OwnedTypeStateImplementations§
Source§impl TypeState
impl TypeState
pub fn visit_identifier( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, ) -> Result<()>
pub fn visit_type_level_integer( &mut self, expression: &Loc<Expression>, generic_list: &GenericListToken, ctx: &Context<'_>, ) -> Result<()>
pub fn visit_pipeline_ref( &mut self, expression: &Loc<Expression>, generic_list: &GenericListToken, ctx: &Context<'_>, ) -> Result<()>
pub fn visit_int_literal( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, ) -> Result<()>
pub fn visit_bool_literal( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, ) -> Result<()>
pub fn visit_tri_literal( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, ) -> Result<()>
pub fn visit_tuple_literal( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>
pub fn visit_tuple_index( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>
pub fn visit_field_access( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>
pub fn visit_method_call( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>
pub fn visit_array_literal( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>
pub fn visit_array_shorthand_literal( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>
pub fn visit_create_ports( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, _generic_list: &GenericListToken, ) -> Result<()>
pub fn visit_index( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>
pub fn visit_range_index( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>
pub fn visit_block_expr( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>
pub fn visit_if( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>
pub fn visit_match( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>
pub fn visit_binary_operator( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>
pub fn visit_unary_operator( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>
Source§impl TypeState
impl TypeState
pub fn t_int(&mut self, loc: Loc<()>, symtab: &SymbolTable) -> TypeVarID
pub fn t_uint(&mut self, loc: Loc<()>, symtab: &SymbolTable) -> TypeVarID
pub fn t_tri(&mut self, loc: Loc<()>, symtab: &SymbolTable) -> TypeVarID
pub fn t_bool(&mut self, loc: Loc<()>, symtab: &SymbolTable) -> TypeVarID
pub fn t_clock(&mut self, loc: Loc<()>, symtab: &SymbolTable) -> TypeVarID
pub fn t_err(&mut self, loc: Loc<()>) -> TypeVarID
Source§impl TypeState
impl TypeState
pub fn type_decl_to_concrete( decl: &TypeDeclaration, type_list: &TypeList, params: Vec<ConcreteType>, invert: bool, ) -> ConcreteType
pub fn type_expr_to_concrete( expr: &TypeExpression, type_list: &TypeList, generic_substitutions: &HashMap<NameID, &ConcreteType>, invert: bool, ) -> ConcreteType
pub fn type_spec_to_concrete( spec: &TypeSpec, type_list: &TypeList, generic_substitutions: &HashMap<NameID, &ConcreteType>, invert: bool, ) -> ConcreteType
pub fn inner_ungenerify_type( &self, var: &TypeVarID, symtab: &SymbolTable, type_list: &TypeList, invert: bool, ) -> Option<ConcreteType>
Sourcepub fn ungenerify_type(
&self,
var: &TypeVarID,
symtab: &SymbolTable,
type_list: &TypeList,
) -> Option<ConcreteType>
pub fn ungenerify_type( &self, var: &TypeVarID, symtab: &SymbolTable, type_list: &TypeList, ) -> Option<ConcreteType>
Converts the specified type to a concrete type, returning None if it fails
Sourcepub fn concrete_type_of_infallible(
&self,
id: ExprID,
symtab: &SymbolTable,
type_list: &TypeList,
) -> ConcreteType
pub fn concrete_type_of_infallible( &self, id: ExprID, symtab: &SymbolTable, type_list: &TypeList, ) -> ConcreteType
Returns the type of the specified expression ID as a concrete type. If the type is not known, or the type is Generic, panics
Sourcepub fn concrete_type_of(
&self,
id: impl HasConcreteType,
symtab: &SymbolTable,
types: &TypeList,
) -> Result<ConcreteType, Diagnostic>
pub fn concrete_type_of( &self, id: impl HasConcreteType, symtab: &SymbolTable, types: &TypeList, ) -> Result<ConcreteType, Diagnostic>
Returns the concrete type of anything that might have a concrete type. Errors if the type is not fully known.
Sourcepub fn concrete_type_of_name(
&self,
name: &Loc<NameID>,
symtab: &SymbolTable,
types: &TypeList,
) -> Result<ConcreteType, Diagnostic>
pub fn concrete_type_of_name( &self, name: &Loc<NameID>, symtab: &SymbolTable, types: &TypeList, ) -> Result<ConcreteType, Diagnostic>
Like concrete_type_of but reports an error message that mentions names
instead of an expression
Source§impl TypeState
impl TypeState
pub fn fresh(shared: Arc<SharedTypeState>) -> Self
pub fn create_child(&self) -> Self
pub fn add_type_var(&mut self, var: TypeVar) -> TypeVarID
pub fn get_equations(&self) -> &TypeEquations
pub fn get_constraints(&self) -> &TypeConstraints
pub fn get_generic_list( &self, generic_list_token: &GenericListToken, ) -> Option<GenericHashMap<NameID, TypeVarID, FxBuildHasher, DefaultSharedPtr>>
pub fn type_var_from_hir<'a>( &'a mut self, loc: Loc<()>, hir_type: &TypeSpec, generic_list_token: &GenericListToken, ) -> Result<TypeVarID>
Sourcepub fn type_of(&self, expr: &TypedExpression) -> TypeVarID
pub fn type_of(&self, expr: &TypedExpression) -> TypeVarID
Returns the type of the expression with the specified id. Error if no equation for the specified expression exists
pub fn maybe_type_of(&self, expr: &TypedExpression) -> Option<&TypeVarID>
pub fn new_generic_int(&mut self, loc: Loc<()>, symtab: &SymbolTable) -> TypeVar
pub fn new_concrete_int(&mut self, size: BigUint, loc: Loc<()>) -> TypeVarID
Sourcepub fn new_split_generic_int(
&mut self,
loc: Loc<()>,
symtab: &SymbolTable,
) -> (TypeVarID, TypeVarID)
pub fn new_split_generic_int( &mut self, loc: Loc<()>, symtab: &SymbolTable, ) -> (TypeVarID, TypeVarID)
Return a new generic int. The first returned value is int
pub fn new_split_generic_uint( &mut self, loc: Loc<()>, symtab: &SymbolTable, ) -> (TypeVarID, TypeVarID)
pub fn new_generic_with_meta( &mut self, loc: Loc<()>, meta: MetaType, ) -> TypeVarID
pub fn new_generic_type(&mut self, loc: Loc<()>) -> TypeVarID
pub fn new_generic_any(&mut self) -> TypeVarID
pub fn new_generic_tlbool(&mut self, loc: Loc<()>) -> TypeVarID
pub fn new_generic_tlstr(&mut self, loc: Loc<()>) -> TypeVarID
pub fn new_generic_tluint(&mut self, loc: Loc<()>) -> TypeVarID
pub fn new_generic_tlint(&mut self, loc: Loc<()>) -> TypeVarID
pub fn new_generic_tlnumber(&mut self, loc: Loc<()>) -> TypeVarID
pub fn new_generic_number( &mut self, loc: Loc<()>, ctx: &Context<'_>, ) -> (TypeVarID, TypeVarID)
pub fn new_generic_with_traits( &mut self, loc: Loc<()>, traits: TraitList, ) -> TypeVarID
Sourcepub fn get_pipeline_state<T>(
&self,
access_loc: &Loc<T>,
) -> Result<&PipelineState>
pub fn get_pipeline_state<T>( &self, access_loc: &Loc<T>, ) -> Result<&PipelineState>
Returns the current pipeline state. access_loc is not used to specify where to get the
state from, it is only used for the Diagnostic::bug that gets emitted if there is no
pipeline state
Sourcepub fn visit_unit_with_preprocessing(
&mut self,
entity: &Loc<Unit>,
pp: impl FnOnce(&mut TypeState, &Loc<Unit>, &GenericListToken, &Context<'_>) -> Result<()>,
ctx: &Context<'_>,
) -> Result<()>
pub fn visit_unit_with_preprocessing( &mut self, entity: &Loc<Unit>, pp: impl FnOnce(&mut TypeState, &Loc<Unit>, &GenericListToken, &Context<'_>) -> Result<()>, ctx: &Context<'_>, ) -> Result<()>
Visit a unit but before doing any preprocessing run the pp function.
pub fn visit_unit( &mut self, entity: &Loc<Unit>, ctx: &Context<'_>, ) -> Result<()>
pub fn visit_expression_result( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, generic_list: &GenericListToken, new_type: TypeVarID, ) -> Result<()>
pub fn visit_expression( &mut self, expression: &Loc<Expression>, ctx: &Context<'_>, generic_list: &GenericListToken, )
pub fn handle_concat( &mut self, expression_id: Loc<ExprID>, source_lhs_ty: TypeVarID, source_rhs_ty: TypeVarID, source_result_ty: TypeVarID, args: &[Argument<'_, Expression, TypeSpec>], ctx: &Context<'_>, ) -> Result<()>
pub fn handle_trunc( &mut self, expression_id: Loc<ExprID>, source_in_ty: TypeVarID, source_result_ty: TypeVarID, args: &[Argument<'_, Expression, TypeSpec>], ctx: &Context<'_>, ) -> Result<()>
pub fn handle_comb_mod_or_div( &mut self, n_ty: TypeVarID, args: &[Argument<'_, Expression, TypeSpec>], ctx: &Context<'_>, ) -> Result<()>
pub fn handle_clocked_memory( &mut self, num_elements: TypeVarID, addr_size_arg: TypeVarID, args: &[Argument<'_, Expression, TypeSpec>], ctx: &Context<'_>, ) -> Result<()>
pub fn handle_read_memory( &mut self, num_elements: TypeVarID, addr_size_arg: TypeVarID, args: &[Argument<'_, Expression, TypeSpec>], ctx: &Context<'_>, ) -> Result<()>
pub fn create_generic_list( &mut self, source: GenericListSource<'_>, type_params: &[Loc<TypeParam>], scope_type_params: &[Loc<TypeParam>], turbofish: Option<TurbofishCtx<'_>>, where_clauses: &[Loc<WhereClause>], ) -> Result<GenericListToken>
Sourcepub fn add_mapped_generic_list(
&mut self,
source: GenericListSource<'_>,
mapping: GenericHashMap<NameID, TypeVarID, FxBuildHasher, DefaultSharedPtr>,
) -> GenericListToken
pub fn add_mapped_generic_list( &mut self, source: GenericListSource<'_>, mapping: GenericHashMap<NameID, TypeVarID, FxBuildHasher, DefaultSharedPtr>, ) -> GenericListToken
Adds a generic list with parameters already mapped to types
pub fn visit_block( &mut self, block: &Block, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>
pub fn visit_impl_blocks(&mut self, item_list: &ItemList) -> TraitImplList
pub fn visit_pattern( &mut self, pattern: &Loc<Pattern>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>
pub fn visit_wal_trace( &mut self, trace: &Loc<WalTrace>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>
pub fn visit_statement_error( &mut self, stmt: &Loc<Statement>, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>
pub fn visit_statement( &mut self, stmt: &Loc<Statement>, ctx: &Context<'_>, generic_list: &GenericListToken, )
pub fn visit_register( &mut self, reg: &Register, ctx: &Context<'_>, generic_list: &GenericListToken, ) -> Result<()>
pub fn visit_trait_spec( &mut self, trait_spec: &Loc<TraitSpec>, generic_list: &GenericListToken, ) -> Result<Loc<TraitReq>>
pub fn visit_trait_bounds( &mut self, target: &Loc<NameID>, traits: &[Loc<TraitSpec>], generic_list_tok: &GenericListToken, ) -> Result<()>
pub fn visit_const_generic_with_id( &mut self, gen: &Loc<ConstGenericWithId>, generic_list_token: &GenericListToken, constraint_source: ConstraintSource, ctx: &Context<'_>, ) -> Result<TypeVarID>
pub fn visit_const_generic( &self, constraint: &ConstGeneric, generic_list: &GenericListToken, ) -> Result<ConstraintExpr>
Source§impl TypeState
impl TypeState
pub fn add_equation(&mut self, expression: TypedExpression, var: TypeVarID)
pub fn can_unify( &mut self, e1: &impl HasType, e2: &impl HasType, ctx: &Context<'_>, ) -> bool
pub fn unify( &mut self, e1: &impl HasType, e2: &impl HasType, ctx: &Context<'_>, ) -> Result<TypeVarID, UnificationError>
pub fn unify_expression_generic_error( &mut self, expr: &Loc<Expression>, other: &impl HasType, ctx: &Context<'_>, ) -> Result<TypeVarID>
pub fn check_requirements( &mut self, is_final_check: bool, ctx: &Context<'_>, ) -> Result<()>
pub fn get_replacement(&self, var: &TypeVarID) -> TypeVarID
pub fn do_and_restore<T, E>( &mut self, inner: impl Fn(&mut Self) -> Result<T, E>, ) -> Result<T, E>
Source§impl TypeState
impl TypeState
pub fn print_equations(&self)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for TypeState
impl RefUnwindSafe for TypeState
impl Send for TypeState
impl Sync for TypeState
impl Unpin for TypeState
impl UnwindSafe for TypeState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more