pub enum Type {
}Expand description
Stores a Dyon type.
Variants§
Unreachable
Whether a statement is never reached.
Void
A no-type.
Any
Any type.
Bool
Boolean type.
F64
F64 type.
Vec4
4D vector type.
Mat4
4D matrix type.
Str
String/text type.
Link
Link type.
Array(Box<Type>)
Array type.
Object
Object type.
Option(Box<Type>)
Option type.
Result(Box<Type>)
Result type.
Secret(Box<Type>)
Secret type.
Thread(Box<Type>)
Thread handle type.
In(Box<Type>)
In-type.
AdHoc(Arc<String>, Box<Type>)
Ad-hoc type.
Closure(Box<Dfn>)
Closure type.
Implementations§
Source§impl Type
impl Type
Sourcepub fn all_ext(
args: Vec<Type>,
ret: Type,
) -> (Vec<Arc<String>>, Vec<Type>, Type)
pub fn all_ext( args: Vec<Type>, ret: Type, ) -> (Vec<Arc<String>>, Vec<Type>, Type)
Returns an extension quantified over ad-hoc types.
For example, (vec4, vec4) -> vec4 becomes all T { (T vec4, T vec4) -> T vec4 }.
Sourcepub fn description(&self) -> String
pub fn description(&self) -> String
Returns description of the type.
Sourcepub fn bind_ty_vars(
&self,
refine: &Type,
names: &[Arc<String>],
ty_vars: &mut Vec<Option<Arc<String>>>,
) -> Result<Type, String>
pub fn bind_ty_vars( &self, refine: &Type, names: &[Arc<String>], ty_vars: &mut Vec<Option<Arc<String>>>, ) -> Result<Type, String>
Binds refinement type variables.
Returns the type argument to compare to.
Sourcepub fn insert_var(&mut self, name: &Arc<String>, val: &Arc<String>)
pub fn insert_var(&mut self, name: &Arc<String>, val: &Arc<String>)
Inserts variable name, replacing ad-hoc type name.
Sourcepub fn insert_none_var(&mut self, name: &Arc<String>)
pub fn insert_none_var(&mut self, name: &Arc<String>)
Inserts a none ad-hoc variable.
Sourcepub fn ambiguous(&self, refine: &Type) -> bool
pub fn ambiguous(&self, refine: &Type) -> bool
Returns true if a type to be refined is ambiguous relative to this type (directional check).
For example, the type ad-hoc type Foo str is ambiguous with type str.
If more was known about the str type with further refinement,
then it might turn out to be Bar str, which triggers a collision.
Sourcepub fn closure_ret_ty(&self) -> Option<Type>
pub fn closure_ret_ty(&self) -> Option<Type>
Returns true if the type can be a closure, false otherwise.
Sourcepub fn goes_with(&self, other: &Type) -> bool
pub fn goes_with(&self, other: &Type) -> bool
Returns true if a type goes with another type (directional check).
bool(argument) goes withsec[bool](value)f64(argument) goes withsec[f64](value)
The opposite is not true, since sec contains extra information.
Sourcepub fn add_assign(&self, other: &Type) -> bool
pub fn add_assign(&self, other: &Type) -> bool
Infers type from the += operator.