Skip to main content

TypedTermKind

Enum TypedTermKind 

Source
pub enum TypedTermKind {
Show 17 variants Int(i64), Char(char), String(String), Float(f64), Identifier { reference: Reference, context: Vec<Predicate>, }, Fun { param: TypeBinder, body: Box<TypedTerm>, }, Apply { fun: Box<TypedTerm>, arg: Box<TypedTerm>, saturation: Saturation, }, If { cond: Box<TypedTerm>, true_branch: Box<TypedTerm>, false_branch: Box<TypedTerm>, }, Let { binding: TypeBinder, value: Box<TypedTerm>, body: Box<TypedTerm>, }, Tuple(Tuple<TypedTerm>), Unit, Case { scrutinee: Box<TypedTerm>, branches: Vec<(TermPattern, Box<TypedTerm>)>, form: CaseForm, }, Hole, Record(Vec<Field<TypedTerm>>), Update { record: Box<TypedTerm>, fields: Vec<Field<TypedTerm>>, }, Access { record: Box<TypedTerm>, label: Name, label_span: NodeSpan, }, Accessor { label: Name, label_span: NodeSpan, },
}

Variants§

§

Int(i64)

See TermKind::Int for the width.

§

Char(char)

§

String(String)

§

Float(f64)

§

Identifier

A name, and — when its type has a context — what that context asks of the type this use gave it.

Fields

§reference: Reference
§context: Vec<Predicate>

One Predicate per constraint of the name’s context, in the order its annotation wrote them, with the final substitution applied. A class member’s context is its class: eq at Int carries Eq Int. Empty for a name whose type has none, which is every local, every constructor and every value declared without a constraint.

§

Fun

Fields

§

Apply

Fields

§saturation: Saturation
§

If

Fields

§true_branch: Box<TypedTerm>
§false_branch: Box<TypedTerm>
§

Let

Fields

§binding: TypeBinder
§

Tuple(Tuple<TypedTerm>)

§

Unit

The unit value, (). Its type is always Type::Unit.

zelkova_js::emit emits it as undefined (The unit value crosses as undefined).

§

Case

Fields

§scrutinee: Box<TypedTerm>
§

Hole

A name that did not resolve (TermKind::Hole). Its type is the one inference solved for its position, and is an unsolved variable when nothing around it constrains it.

An error stands behind every hole, so a declaration holding one is never emitted: zelkova_js::emit refuses it by name.

§

Record(Vec<Field<TypedTerm>>)

A record (TermKind::Record), its fields in the order they were written. Its type is the Type::Record of its fields’ types, which has no order.

§

Update

An update (TermKind::Update). Its type is the type of record.

Fields

§record: Box<TypedTerm>
§

Access

A field access (TermKind::Access). Its type is the field’s; the record’s type, a Type::Record holding label, is on record.

Fields

§record: Box<TypedTerm>
§label: Name
§label_span: NodeSpan
§

Accessor

An accessor (TermKind::Accessor). Its type is a function from the record type it reads to the field’s type.

Fields

§label: Name
§label_span: NodeSpan

Trait Implementations§

Source§

impl Debug for TypedTermKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.