Skip to main content

TypeError

Enum TypeError 

Source
pub enum TypeError {
Show 16 variants TypeMismatch { at_node: String, expected: String, got: String, context: Vec<String>, }, EffectRowMismatch { at_node: String, expected: String, got: String, context: Vec<String>, }, UnknownIdentifier { at_node: String, name: String, }, ArityMismatch { at_node: String, expected: usize, got: usize, }, NonExhaustiveMatch { at_node: String, missing: Vec<String>, }, UnknownField { at_node: String, record_type: String, field: String, }, DuplicateField { at_node: String, field: String, }, UnknownVariant { at_node: String, constructor: String, }, EffectNotDeclared { at_node: String, effect: String, }, InfiniteType { at_node: String, }, AmbiguousType { at_node: String, }, RecursiveTypeWithoutConstructor { at_node: String, name: String, }, RefinementViolation { at_node: String, fn_name: String, param_index: usize, binding: String, reason: String, }, ExamplesOnEffectfulFn { at_node: String, fn_name: String, }, ExampleArityMismatch { at_node: String, fn_name: String, case_index: usize, expected: usize, got: usize, }, ExampleMismatch { at_node: String, fn_name: String, case_index: usize, expected: String, got: String, },
}

Variants§

§

TypeMismatch

Fields

§at_node: String
§expected: String
§context: Vec<String>
§

EffectRowMismatch

Two function types failed to unify specifically because their effect rows differ (#565). Effect rows unify by equality, not subtyping — a concrete row must match exactly, not merely be a superset or subset. This most often surfaces on record-field closures (e.g. Skill.handle, Tool.execute) whose declared row is fixed by the record type. Split out from TypeMismatch so the rule_tag names the invariance and the suggested fix steers toward narrowing the body rather than broadening the row.

Fields

§at_node: String
§expected: String

Pretty-printed expected effect row, e.g. [io, net].

§got: String

Pretty-printed actual effect row found.

§context: Vec<String>
§

UnknownIdentifier

Fields

§at_node: String
§name: String
§

ArityMismatch

Fields

§at_node: String
§expected: usize
§got: usize
§

NonExhaustiveMatch

Fields

§at_node: String
§missing: Vec<String>
§

UnknownField

Fields

§at_node: String
§record_type: String
§field: String
§

DuplicateField

Fields

§at_node: String
§field: String
§

UnknownVariant

Fields

§at_node: String
§constructor: String
§

EffectNotDeclared

Fields

§at_node: String
§effect: String
§

InfiniteType

Fields

§at_node: String
§

AmbiguousType

Fields

§at_node: String
§

RecursiveTypeWithoutConstructor

Fields

§at_node: String
§name: String
§

RefinementViolation

Refinement-type predicate provably violated at a call site (#209 slice 2). The type checker statically discharged the refinement and found the literal argument doesn’t satisfy the predicate. Slice 3 will add residual runtime checks for arguments that can’t be discharged statically.

Fields

§at_node: String
§fn_name: String
§param_index: usize
§binding: String
§reason: String
§

ExamplesOnEffectfulFn

A function carrying signature-level examples (#369) declares at least one effect. v1 restricts examples to pure functions so the “same inputs ⇒ same outputs” invariant (rule #5) holds without modeling effect responses.

Fields

§at_node: String
§fn_name: String
§

ExampleArityMismatch

A signature-level example case (#369) supplies the wrong number of arguments for the function it documents.

Fields

§at_node: String
§fn_name: String
§case_index: usize

Zero-based index of the failing case in the examples block.

§expected: usize
§got: usize
§

ExampleMismatch

A signature-level example case (#369 slice 2) ran successfully but the function’s actual output disagrees with the declared expected value. This is the load-bearing check that makes the examples block enforce behavior, not just types.

Fields

§at_node: String
§fn_name: String
§case_index: usize
§expected: String

Pretty-printed expected value (LHS of the => in the example).

§got: String

Pretty-printed actual value the function body produced.

Implementations§

Source§

impl TypeError

Source

pub fn node(&self) -> &str

Source§

impl TypeError

Source

pub fn rule_tag(&self) -> &'static str

Stable kebab-case identifier for this error variant. See all_rules for the full catalog.

Source

pub fn rule_explanation(&self) -> &'static str

Plain-language description of what the rule enforces. Aimed at LLM repair-flow prompts: short enough to inline in a system message, specific enough to suggest the next move.

Trait Implementations§

Source§

impl Clone for TypeError

Source§

fn clone(&self) -> TypeError

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TypeError

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for TypeError

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for TypeError

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Error for TypeError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<TypeError> for PositionedError

Source§

fn from(e: TypeError) -> Self

Converts to this type from the input type.
Source§

impl Serialize for TypeError

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.