Skip to main content

ConstraintGenerator

Struct ConstraintGenerator 

Source
pub struct ConstraintGenerator {
Show 36 fields pub scopes: Vec<(Location, ScopePtr)>, pub module: Option<ModulePtr>, pub builtin_types: *mut BuiltinTypes, pub arena: *mut TypeArena, pub root_scope: *mut Scope, pub type_context: TypeContext, pub inferred_bindings: DenseHashMap<Symbol, InferredBinding>, pub constraints: Vec<ConstraintPtr>, pub free_types: TypeIds, pub scope_to_function: DenseHashMap<*mut Scope, TypeId>, pub ast_type_alias_defining_scopes: DenseHashMap<*const AstStatTypeAlias, Option<ScopePtr>>, pub dfg: *const DataFlowGraph, pub refinement_arena: RefinementArena, pub recursion_count: i32, pub errors: Vec<TypeError>, pub normalizer: *mut Normalizer, pub type_function_runtime: *mut TypeFunctionRuntime, pub ast_type_function_environment_scopes: DenseHashMap<*const AstStatTypeFunction, Option<ScopePtr>>, pub module_resolver: *mut ModuleResolver, pub ice: *mut InternalErrorReporter, pub global_scope: Option<ScopePtr>, pub type_function_scope: Option<ScopePtr>, pub prepare_module_scope: Rc<dyn Fn(&ModuleName, &ScopePtr)>, pub require_cycles: Vec<RequireCycle>, pub local_types: DenseHashMap<TypeId, TypeIds>, pub inferred_expr_cache: DenseHashMap<*mut AstExpr, Inference>, pub class_decl_records: DenseHashMap<*mut AstLocal, ClassDeclRecord>, pub logger: *mut DcrLogger, pub recursion_limit_met: bool, pub cgraph: *mut ConstraintGraph, pub interior_free_types: Vec<InteriorFreeTypes>, pub unions_to_simplify: Vec<TypeId>, pub uninitialized_globals: Set<AstName>, pub polarity: Polarity, pub prop_index_pairs_seen: DenseHashMap<(TypeId, String), TypeId>, pub large_table_depth: usize,
}

Fields§

§scopes: Vec<(Location, ScopePtr)>§module: Option<ModulePtr>§builtin_types: *mut BuiltinTypes§arena: *mut TypeArena§root_scope: *mut Scope§type_context: TypeContext§inferred_bindings: DenseHashMap<Symbol, InferredBinding>§constraints: Vec<ConstraintPtr>§free_types: TypeIds§scope_to_function: DenseHashMap<*mut Scope, TypeId>§ast_type_alias_defining_scopes: DenseHashMap<*const AstStatTypeAlias, Option<ScopePtr>>§dfg: *const DataFlowGraph§refinement_arena: RefinementArena§recursion_count: i32§errors: Vec<TypeError>§normalizer: *mut Normalizer§type_function_runtime: *mut TypeFunctionRuntime§ast_type_function_environment_scopes: DenseHashMap<*const AstStatTypeFunction, Option<ScopePtr>>§module_resolver: *mut ModuleResolver§ice: *mut InternalErrorReporter§global_scope: Option<ScopePtr>§type_function_scope: Option<ScopePtr>§prepare_module_scope: Rc<dyn Fn(&ModuleName, &ScopePtr)>§require_cycles: Vec<RequireCycle>§local_types: DenseHashMap<TypeId, TypeIds>§inferred_expr_cache: DenseHashMap<*mut AstExpr, Inference>§class_decl_records: DenseHashMap<*mut AstLocal, ClassDeclRecord>§logger: *mut DcrLogger§recursion_limit_met: bool§cgraph: *mut ConstraintGraph§interior_free_types: Vec<InteriorFreeTypes>§unions_to_simplify: Vec<TypeId>§uninitialized_globals: Set<AstName>§polarity: Polarity§prop_index_pairs_seen: DenseHashMap<(TypeId, String), TypeId>§large_table_depth: usize

Implementations§

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source

pub fn add_type_pack( &mut self, head: Vec<TypeId>, tail: Option<TypePackId>, ) -> TypePackId

Source§

impl ConstraintGenerator

Source

pub fn apply_refinements( &mut self, scope: &ScopePtr, location: Location, refinement: RefinementId, )

Source§

impl ConstraintGenerator

Source

pub fn check_ast_expr_binary( &mut self, scope: &ScopePtr, location: Location, op: AstExprBinaryOp, left: *mut AstExpr, right: *mut AstExpr, expected_type: Option<TypeId>, ) -> Inference

Source§

impl ConstraintGenerator

Source

pub fn check_binary( &mut self, scope: &ScopePtr, op: AstExprBinaryOp, left: *mut AstExpr, right: *mut AstExpr, expected_type: Option<TypeId>, ) -> (TypeId, TypeId, RefinementId)

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source

pub fn check_scope_ptr_ast_expr_constant_bool_optional_type_id_bool( &mut self, scope: &ScopePtr, bool_expr: *mut AstExprConstantBool, expected_type: Option<TypeId>, force_singleton: bool, ) -> Inference

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source

pub fn check_scope_ptr_ast_expr_function_optional_type_id_bool( &mut self, scope: &ScopePtr, func: *mut AstExprFunction, expected_type: Option<TypeId>, generalize: bool, ) -> Inference

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source

pub fn check_scope_ptr_ast_expr_instantiate( &mut self, scope: &ScopePtr, explicit_type_instantiation: *mut AstExprInstantiate, ) -> Inference

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source

pub fn check_scope_ptr_ast_expr( &mut self, scope: &ScopePtr, expr: *mut AstExpr, ) -> Inference

Convenience: check(scope, expr) with all C++ defaults.

Source

pub fn check_scope_ptr_ast_expr_optional_type_id( &mut self, scope: &ScopePtr, expr: *mut AstExpr, expected_type: Option<TypeId>, ) -> Inference

Convenience: check(scope, expr, expectedType).

Source

pub fn check_scope_ptr_ast_expr_optional_type_id_bool( &mut self, scope: &ScopePtr, expr: *mut AstExpr, expected_type: Option<TypeId>, force_singleton: bool, ) -> Inference

Convenience: check(scope, expr, expectedType, forceSingleton).

Source

pub fn check_scope_ptr_ast_expr_optional_type_id_bool_bool( &mut self, scope: &ScopePtr, expr: *mut AstExpr, expected_type: Option<TypeId>, force_singleton: bool, generalize: bool, ) -> Inference

Source§

impl ConstraintGenerator

Source

pub fn check_expr_call( &mut self, scope: &ScopePtr, call: *mut AstExprCall, fn_type: TypeId, func_begin: Checkpoint, func_end: Checkpoint, ) -> InferencePack

Source§

impl ConstraintGenerator

Source

pub fn check_function_body( &mut self, scope: &ScopePtr, fn_expr: &AstExprFunction, )

Source§

impl ConstraintGenerator

Source

pub fn check_function_signature( &mut self, parent: &ScopePtr, enclosing_class: *mut ClassDeclRecord, fn_node: *mut AstExprFunction, expected_type: Option<TypeId>, original_name: Option<Location>, ) -> FunctionSignature

Source§

impl ConstraintGenerator

Source

pub fn check_index_name( &mut self, scope: &ScopePtr, key: *const RefinementKey, indexee: *mut AstExpr, index: &String, index_location: Location, ) -> Inference

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source

pub fn check_pack_scope_ptr_ast_expr_vector_optional_type_id_bool( &mut self, scope: &ScopePtr, expr: *mut AstExpr, expected_types: &Vec<Option<TypeId>>, generalize: bool, ) -> InferencePack

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source

pub fn child_scope(&mut self, node: *mut AstNode, parent: &ScopePtr) -> ScopePtr

Source§

impl ConstraintGenerator

Source

pub fn compute_refinement( &mut self, scope: *mut Scope, location: Location, refinement: RefinementId, refis: *mut RefinementContext, sense: bool, eq: bool, constraints: *mut Vec<ConstraintV>, )

Source§

impl ConstraintGenerator

Source

pub fn constraint_generator( module: ModulePtr, normalizer: NonNull<Normalizer>, type_function_runtime: NonNull<TypeFunctionRuntime>, module_resolver: NonNull<ModuleResolver>, builtin_types: NonNull<BuiltinTypes>, ice: NonNull<InternalErrorReporter>, global_scope: ScopePtr, type_function_scope: ScopePtr, prepare_module_scope: Rc<dyn Fn(&ModuleName, &ScopePtr)>, logger: *mut DcrLogger, dfg: NonNull<DataFlowGraph>, require_cycles: Vec<RequireCycle>, cgraph: *mut ConstraintGraph, ) -> Self

Source§

impl ConstraintGenerator

Source

pub fn create_generic_packs( &mut self, scope: &ScopePtr, generics: AstArray<*mut AstGenericTypePack>, use_cache: bool, add_types: bool, ) -> Vec<(Name, GenericTypePackDefinition)>

Source§

impl ConstraintGenerator

Source

pub fn create_generics( &mut self, scope: &ScopePtr, generics: AstArray<*mut AstGenericType>, use_cache: bool, add_types: bool, ) -> Vec<(Name, GenericTypeDefinition)>

Source§

impl ConstraintGenerator

Source

pub fn create_type_function_instance( &mut self, function: &TypeFunction, type_arguments: Vec<TypeId>, pack_arguments: Vec<TypePackId>, scope: &ScopePtr, location: Location, ) -> TypeId

Source§

impl ConstraintGenerator

Source

pub fn fill_in_inferred_bindings( &mut self, _global_scope: &ScopePtr, _block: *mut AstStatBlock, )

Source§

impl ConstraintGenerator

Source

pub fn flatten_pack( &mut self, scope: &ScopePtr, location: Location, pack: InferencePack, ) -> Inference

Source§

impl ConstraintGenerator

Source

pub fn fresh_type(&mut self, scope: &ScopePtr, polarity: Polarity) -> TypeId

Source§

impl ConstraintGenerator

Source

pub fn fresh_type_pack( &mut self, scope: &ScopePtr, polarity: Polarity, ) -> TypePackId

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source

pub fn inherit_shared_refinements( &mut self, scope: &ScopePtr, location: Location, left_scope: &ScopePtr, right_scope: &ScopePtr, )

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source

pub fn lookup( &mut self, scope: &ScopePtr, location: Location, def: DefId, prototype: bool, ) -> Option<TypeId>

Source§

impl ConstraintGenerator

Source

pub fn make_intersect( &mut self, scope: &ScopePtr, location: Location, lhs: TypeId, rhs: TypeId, ) -> TypeId

Source§

impl ConstraintGenerator

Source

pub fn make_union_scope_ptr_location_type_id_type_id( &mut self, _scope: *mut Scope, _location: Location, lhs: TypeId, rhs: TypeId, ) -> TypeId

Source§

impl ConstraintGenerator

Source

pub fn make_union_vector_type_id(&mut self, options: Vec<TypeId>) -> TypeId

Source§

impl ConstraintGenerator

Source

pub fn prepopulate_global_scope( &mut self, global_scope: &ScopePtr, program: *mut AstStatBlock, )

Source§

impl ConstraintGenerator

Source

pub fn prepopulate_global_scope_for_fragment_typecheck( &mut self, _global_scope: &ScopePtr, _resume_scope: &ScopePtr, program: *mut AstStatBlock, )

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source

pub fn record_inferred_binding(&mut self, local: *mut AstLocal, ty: TypeId)

Source§

impl ConstraintGenerator

Source

pub fn record_property_assignment(&mut self, ty: TypeId) -> bool

Source§

impl ConstraintGenerator

Source

pub fn report_code_too_complex(&mut self, location: Location)

Source§

impl ConstraintGenerator

Source

pub fn report_error(&mut self, location: Location, err: TypeErrorData)

Source§

impl ConstraintGenerator

Source

pub fn resolve_function_type( &mut self, scope: &ScopePtr, _ty: *mut AstType, fn_node: &AstTypeFunction, in_type_arguments: bool, replace_error_with_fresh: bool, ) -> TypeId

Source§

impl ConstraintGenerator

Source

pub fn resolve_generic_default_parameters( &mut self, defn_scope: *mut Scope, alias: *mut AstStatTypeAlias, fun: &TypeFun, )

Source§

impl ConstraintGenerator

Source

pub fn resolve_reference_type( &mut self, scope: &ScopePtr, ty: *mut AstType, ref_: *mut AstTypeReference, in_type_arguments: bool, replace_error_with_fresh: bool, ) -> TypeId

Source§

impl ConstraintGenerator

Source

pub fn resolve_table_type( &mut self, scope: *mut Scope, _ty: *mut AstType, tab: *mut AstTypeTable, in_type_arguments: bool, _replace_error_with_fresh: bool, ) -> TypeId

Source§

impl ConstraintGenerator

Source

pub fn resolve_type_arguments( &mut self, scope: *mut Scope, type_arguments: AstArray<AstTypeOrPack>, ) -> (Vec<TypeId>, Vec<TypePackId>)

Source§

impl ConstraintGenerator

Source

pub fn resolve_type( &mut self, _scope: *mut Scope, ty: *mut AstType, in_type_arguments: bool, replace_error_with_fresh: bool, initial_polarity: Polarity, ) -> TypeId

Source§

impl ConstraintGenerator

Source

pub fn resolve_type_constraint_generator_alt_b( &mut self, scope: *mut Scope, ty: *mut AstType, in_type_arguments: bool, replace_error_with_fresh: bool, ) -> TypeId

Source§

impl ConstraintGenerator

Source

pub fn resolve_type_pack_scope_ptr_ast_type_pack_bool_bool_polarity( &mut self, scope: *mut Scope, tp: *mut AstTypePack, in_type_argument: bool, replace_error_with_fresh: bool, initial_polarity: Polarity, ) -> TypePackId

Source§

impl ConstraintGenerator

Source

pub fn resolve_type_pack_scope_ptr_ast_type_pack_bool_bool( &mut self, scope: *mut Scope, tp: *mut AstTypePack, in_type_argument: bool, replace_error_with_fresh: bool, ) -> TypePackId

Source§

impl ConstraintGenerator

Source

pub fn resolve_type_pack_scope_ptr_ast_type_list_bool_bool( &mut self, _scope: *mut Scope, _list: &AstTypeList, _in_type_arguments: bool, _replace_error_with_fresh: bool, ) -> TypePackId

Source§

impl ConstraintGenerator

Source

pub fn resolve_type_pack_scope_ptr_ast_type_list_bool_bool_polarity( &mut self, scope: *mut Scope, list: &AstTypeList, in_type_arguments: bool, replace_error_with_fresh: bool, initial_polarity: Polarity, ) -> TypePackId

Source§

impl ConstraintGenerator

Source

pub fn run(&mut self, block: *mut AstStatBlock) -> ConstraintSet

Source§

impl ConstraintGenerator

Source

pub fn run_on_fragment( &mut self, resume_scope: &ScopePtr, block: *mut AstStatBlock, ) -> ConstraintSet

Source§

impl ConstraintGenerator

Source

pub fn simplify_union( &mut self, _scope: ScopePtr, _location: Location, left: TypeId, right: TypeId, ) -> TypeId

Source§

impl ConstraintGenerator

Source

pub fn union_refinements( &mut self, scope: &ScopePtr, location: Location, lhs: &RefinementContext, rhs: &RefinementContext, dest: *mut RefinementContext, _constraints: *mut Vec<ConstraintV>, )

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source

pub fn visit_scope_ptr_ast_stat( &mut self, scope: &ScopePtr, stat: *mut AstStat, ) -> ControlFlow

Source§

impl ConstraintGenerator

Source

pub fn visit_scope_ptr_ast_stat_local( &mut self, scope: &ScopePtr, stat_local: *mut AstStatLocal, ) -> ControlFlow

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source

pub fn visit_scope_ptr_ast_stat_if( &mut self, scope: &ScopePtr, if_statement: *mut AstStatIf, ) -> ControlFlow

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source

pub fn visit_scope_ptr_ast_stat_class( &mut self, scope: &ScopePtr, stat_class: *mut AstStatClass, ) -> ControlFlow

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source

pub fn visit_fragment_root( &mut self, resume_scope: &ScopePtr, block: *mut AstStatBlock, )

Source§

impl ConstraintGenerator

Source

pub fn visit_l_value_scope_ptr_ast_expr_type_id( &mut self, scope: &ScopePtr, expr: *mut AstExpr, rhs_type: TypeId, )

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source§

impl ConstraintGenerator

Source

pub fn visit_module_root(&mut self, block: *mut AstStatBlock)

Trait Implementations§

Source§

impl Debug for ConstraintGenerator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.