pub enum TypeExpr {
Named {
name: String,
args: Vec<TypeExpr>,
},
Record(Vec<TypeField>),
Tuple(Vec<TypeExpr>),
Function {
params: Vec<TypeExpr>,
effects: Vec<Effect>,
ret: Box<TypeExpr>,
},
Union(Vec<UnionVariant>),
RecordWithSpreads {
spreads: Vec<String>,
fields: Vec<TypeField>,
},
Refined {
base: Box<TypeExpr>,
binding: String,
predicate: Box<Expr>,
},
}Variants§
Named
Named primitive or constructor application (Int, Result[Int, Str], T).
We resolve which it is during type-checking, not parsing.
Record(Vec<TypeField>)
Tuple(Vec<TypeExpr>)
Function
Union(Vec<UnionVariant>)
RecordWithSpreads
Record type with one or more spread bases (#363): { ...TypeName, field :: Type }.
Resolved to a flat Ty::Record during type-checking.
Refined
Refinement type (#209): a base type plus a predicate the
inhabitant must satisfy. Int{x | x > 0 and x <= balance}
parses with base = Named { name: "Int", args: [] },
binding = "x", and predicate = (x > 0) and (x <= balance).
Slice 1 stores the refinement; the type checker treats the
refined type as its base. Slice 2 wires up static discharge
via the spec-checker’s gate evaluator; slice 3 adds the
residual runtime check at call boundaries.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TypeExpr
impl<'de> Deserialize<'de> for TypeExpr
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for TypeExpr
Auto Trait Implementations§
impl Freeze for TypeExpr
impl RefUnwindSafe for TypeExpr
impl Send for TypeExpr
impl Sync for TypeExpr
impl Unpin for TypeExpr
impl UnsafeUnpin for TypeExpr
impl UnwindSafe for TypeExpr
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