pub enum Type {
Bottom,
Primitive(BitFlags<Typ>),
Ref {
scope: ModPath,
name: ModPath,
params: Arc<[Type]>,
},
Fn(Arc<FnType>),
Set(Arc<[Type]>),
TVar(TVar),
Array(Arc<Type>),
ByRef(Arc<Type>),
Tuple(Arc<[Type]>),
Struct(Arc<[(ArcStr, Type)]>),
Variant(ArcStr, Arc<[Type]>),
}
Variants§
Bottom
Primitive(BitFlags<Typ>)
Ref
Fn(Arc<FnType>)
Set(Arc<[Type]>)
TVar(TVar)
Array(Arc<Type>)
ByRef(Arc<Type>)
Tuple(Arc<[Type]>)
Struct(Arc<[(ArcStr, Type)]>)
Variant(ArcStr, Arc<[Type]>)
Implementations§
Source§impl Type
impl Type
pub fn empty_tvar() -> Self
pub fn is_defined(&self) -> bool
pub fn lookup_ref<'a, C: Ctx, E: UserEvent>( &'a self, env: &'a Env<C, E>, ) -> Result<&'a Type>
pub fn check_contains<C: Ctx, E: UserEvent>( &self, env: &Env<C, E>, t: &Self, ) -> Result<()>
pub fn contains<C: Ctx, E: UserEvent>( &self, env: &Env<C, E>, t: &Self, ) -> Result<bool>
pub fn union(&self, t: &Self) -> Self
pub fn diff<C: Ctx, E: UserEvent>( &self, env: &Env<C, E>, t: &Self, ) -> Result<Self>
pub fn any() -> Self
pub fn boolean() -> Self
pub fn number() -> Self
pub fn int() -> Self
pub fn uint() -> 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
pub fn check_cast<C: Ctx, E: UserEvent>(&self, env: &Env<C, E>) -> Result<()>
pub fn cast_value<C: Ctx, E: UserEvent>( &self, env: &Env<C, E>, v: Value, ) -> Value
Sourcepub fn is_a<C: Ctx, E: UserEvent>(&self, env: &Env<C, E>, v: &Value) -> bool
pub fn is_a<C: Ctx, E: UserEvent>(&self, env: &Env<C, E>, v: &Value) -> bool
return true if v is structurally compatible with the type
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
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> Pointable for T
impl<T> Pointable for T
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 moreSource§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