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
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
UnknownIdentifier
ArityMismatch
NonExhaustiveMatch
UnknownField
DuplicateField
UnknownVariant
EffectNotDeclared
InfiniteType
AmbiguousType
RecursiveTypeWithoutConstructor
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.
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.
ExampleArityMismatch
A signature-level example case (#369) supplies the wrong number of arguments for the function it documents.
Fields
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.
Implementations§
Source§impl TypeError
impl TypeError
Sourcepub fn rule_tag(&self) -> &'static str
pub fn rule_tag(&self) -> &'static str
Stable kebab-case identifier for this error variant. See
all_rules for the full catalog.
Sourcepub fn rule_explanation(&self) -> &'static str
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<'de> Deserialize<'de> for TypeError
impl<'de> Deserialize<'de> for TypeError
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>,
Source§impl Error for TypeError
impl Error for TypeError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()