pub enum Type {
}Expand description
Aver static type representation.
Lives under crate::ast so that Spanned<T> can carry an optional
Type annotation without forming a cycle through crate::types
(which depends on crate::ast). The original crate::types::Type
is re-exported from here for backward compatibility.
Variants§
Int
Float
Str
Bool
Unit
Result(Box<Type>, Box<Type>)
Option(Box<Type>)
List(Box<Type>)
Tuple(Vec<Type>)
Map(Box<Type>, Box<Type>)
Vector(Box<Type>)
Fn(Vec<Type>, Box<Type>, Vec<String>)
Var(String)
Invalid
Named(String)
Implementations§
Source§impl Type
impl Type
Sourcepub fn compatible(&self, other: &Type) -> bool
pub fn compatible(&self, other: &Type) -> bool
a.compatible(b) — can a value of type self be used where other is expected?
Two concrete types must be equal (structurally) to be compatible. Type variables
are resolved by the type checker at call sites, not by this raw relation.
pub fn display(&self) -> String
Trait Implementations§
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 UnsafeUnpin for Type
impl UnwindSafe for Type
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
Mutably borrows from an owned value. Read more