pub enum Type {
Show 15 variants
Bottom,
Any,
Primitive(BitFlags<Typ>),
Ref {
scope: ModPath,
name: ModPath,
params: Arc<[Type]>,
},
Fn(Arc<FnType>),
Set(Arc<[Type]>),
TVar(TVar),
Error(Arc<Type>),
Array(Arc<Type>),
ByRef(Arc<Type>),
Tuple(Arc<[Type]>),
Struct(Arc<[(ArcStr, Type)]>),
Variant(ArcStr, Arc<[Type]>),
Map {
key: Arc<Type>,
value: Arc<Type>,
},
Abstract {
id: AbstractId,
params: Arc<[Type]>,
},
}Variants§
Bottom
Any
Primitive(BitFlags<Typ>)
Ref
Fn(Arc<FnType>)
Set(Arc<[Type]>)
TVar(TVar)
Error(Arc<Type>)
Array(Arc<Type>)
ByRef(Arc<Type>)
Tuple(Arc<[Type]>)
Struct(Arc<[(ArcStr, Type)]>)
Variant(ArcStr, Arc<[Type]>)
Map
Abstract
Implementations§
Source§impl Type
impl Type
pub fn could_match(&self, env: &Env, t: &Self) -> Result<bool>
pub fn sig_matches( &self, env: &Env, impl_type: &Self, adts: &FxHashMap<AbstractId, Type>, ) -> Result<()>
Source§impl Type
impl Type
pub fn unfreeze_tvars(&self)
Sourcepub fn alias_tvars(&self, known: &mut FxHashMap<ArcStr, TVar>)
pub fn alias_tvars(&self, known: &mut FxHashMap<ArcStr, TVar>)
alias type variables with the same name to each other
pub fn collect_tvars(&self, known: &mut FxHashMap<ArcStr, TVar>)
pub fn check_tvars_declared(&self, declared: &FxHashSet<ArcStr>) -> Result<()>
pub fn has_unbound(&self) -> bool
Sourcepub fn reset_tvars(&self) -> Type
pub fn reset_tvars(&self) -> Type
return a copy of self with all type variables unbound and unaliased. self will not be modified
Sourcepub fn replace_tvars(&self, known: &FxHashMap<ArcStr, Self>) -> Type
pub fn replace_tvars(&self, known: &FxHashMap<ArcStr, Self>) -> Type
return a copy of self with every TVar named in known replaced with the corresponding type
Source§impl Type
impl Type
pub fn empty_tvar() -> Self
pub fn is_defined(&self) -> bool
pub fn lookup_ref<'a>(&'a self, env: &'a Env) -> Result<&'a Type>
pub fn any() -> Self
pub fn boolean() -> Self
pub fn number() -> Self
pub fn int() -> Self
pub fn uint() -> Self
Sourcepub fn strip_error(&self, env: &Env) -> Option<Self>
pub fn strip_error(&self, env: &Env) -> Option<Self>
remove the outer error type and return the inner payload, fail if self isn’t an error or contains non error types
pub fn is_bot(&self) -> bool
pub fn with_deref<R, F: FnOnce(Option<&Self>) -> R>(&self, f: F) -> R
pub fn scope_refs(&self, scope: &ModPath) -> Type
Trait Implementations§
Source§impl Ord for Type
impl Ord for Type
Source§impl PartialOrd for Type
impl PartialOrd for Type
Source§impl PrettyDisplay for Type
impl PrettyDisplay for Type
Source§fn fmt_pretty_inner(&self, buf: &mut PrettyBuf) -> Result
fn fmt_pretty_inner(&self, buf: &mut PrettyBuf) -> Result
Do the actual pretty print. This should not be called directly, it will
be called by fmt_pretty when we know it can’t fit on a single line.
Source§fn fmt_pretty(&self, buf: &mut PrettyBuf) -> Result
fn fmt_pretty(&self, buf: &mut PrettyBuf) -> Result
This is the user facing fmt method, it will first try to format the
expression on a single line, and if that is impossible it will call the
pretty printer.
impl Eq for Type
impl StructuralPartialEq for Type
Auto Trait Implementations§
impl Freeze for Type
impl !RefUnwindSafe for Type
impl Send for Type
impl Sync for Type
impl Unpin for Type
impl !UnwindSafe for Type
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
Mutably borrows from an owned value. Read more
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
Compare self to
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>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more