pub struct FnType {
pub args: Arc<[FnArgType]>,
pub vargs: Option<Type>,
pub rtype: Type,
pub constraints: Arc<RwLock<LPooled<Vec<(TVar, Type)>>>>,
pub throws: Type,
pub explicit_throws: bool,
pub lambda_ids: Arc<RwLock<IntSet<LambdaId>>>,
}Fields§
§args: Arc<[FnArgType]>§vargs: Option<Type>§rtype: Type§constraints: Arc<RwLock<LPooled<Vec<(TVar, Type)>>>>§throws: Type§explicit_throws: bool§lambda_ids: Arc<RwLock<IntSet<LambdaId>>>accumulated set of all LambdaIds this type might represent (for late binding)
Implementations§
Source§impl FnType
impl FnType
Sourcepub fn resolve_tvars(&self) -> Self
pub fn resolve_tvars(&self) -> Self
Deep-clone with all bound TVars replaced by their concrete types. Constraints are emptied since all TVars are resolved.
pub fn unbind_tvars(&self)
pub fn constrain_known(&self)
pub fn reset_tvars(&self) -> Self
pub fn replace_tvars(&self, known: &AHashMap<ArcStr, Type>) -> Self
Sourcepub fn replace_auto_constrained(&self) -> Self
pub fn replace_auto_constrained(&self) -> Self
Replace automatically constrained type variables (those with
underscore-prefixed names like '_23) with their constraint type.
This is only useful for making nicer display types in IDEs and
shells.
Ordering: when combining with Type::resolve_tvars to fully
pretty a function signature, call replace_auto_constrained
FIRST and resolve_tvars SECOND. resolve_tvars empties the
constraint table, so reversing the order leaves the auto
constraints with nothing to fold against.
pub fn has_unbound(&self) -> bool
pub fn bind_as(&self, t: &Type)
pub fn alias_tvars(&self, known: &mut AHashMap<ArcStr, TVar>)
pub fn unfreeze_tvars(&self)
pub fn collect_tvars(&self, known: &mut AHashMap<ArcStr, TVar>)
pub fn contains(&self, env: &Env, t: &Self) -> Result<bool>
Sourcepub fn merge_lambda_ids(&self, other: &Self)
pub fn merge_lambda_ids(&self, other: &Self)
Merge lambda_ids between two FnTypes during unification. Called after contains_int succeeds to track late-bound function identities.
pub fn check_contains(&self, env: &Env, other: &Self) -> Result<()>
Sourcepub fn sig_contains(&self, env: &Env, other: &Self) -> Result<bool>
pub fn sig_contains(&self, env: &Env, other: &Self) -> Result<bool>
Return true if function signatures are contained. This is contains, but does not allow labeled argument subtyping.
pub fn check_sig_contains(&self, env: &Env, other: &Self) -> Result<()>
pub fn sig_matches( &self, env: &Env, impl_fn: &Self, adts: &mut IntMap<AbstractId, Type>, ) -> Result<()>
pub fn map_argpos( &self, other: &Self, ) -> LPooled<AHashMap<ArcStr, (Option<usize>, Option<usize>)>>
pub fn scope_refs(&self, scope: &ModPath) -> Self
Trait Implementations§
Source§impl Ord for FnType
impl Ord for FnType
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for FnType
impl PartialOrd for FnType
Source§impl PrettyDisplay for FnType
impl PrettyDisplay for FnType
Source§fn fmt_pretty_inner(&self, buf: &mut PrettyBuf) -> Result
fn fmt_pretty_inner(&self, buf: &mut PrettyBuf) -> Result
Source§fn fmt_pretty(&self, buf: &mut PrettyBuf) -> Result
fn fmt_pretty(&self, buf: &mut PrettyBuf) -> Result
impl Eq for FnType
Auto Trait Implementations§
impl Freeze for FnType
impl !RefUnwindSafe for FnType
impl Send for FnType
impl Sync for FnType
impl Unpin for FnType
impl UnsafeUnpin for FnType
impl !UnwindSafe for FnType
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more