Newer
Older
use crate::{term::Term, Location};
/// Type representing kernel errors, is used by the toplevel to pretty-print errors.
#[derive(Clone, Debug, Display, PartialEq, Eq)]
pub enum KernelError {
/// cannot parse command
#[display(fmt = "cannot parse: {}", _1)]
CannotParse(Location, String),
/// s is already defined
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#[display(fmt = "{} is already defined", _0)]
AlreadyDefined(String),
/// s is not defined
#[display(fmt = "{} is not defined", _0)]
ConstNotFound(String),
/// t is not a universe
#[display(fmt = "{} is not a universe", _0)]
NotUniverse(Term),
/// t is not a type
#[display(fmt = "{} is not a type", _0)]
NotType(Term),
/// t1 and t2 are not definitionally equal
#[display(fmt = "{} and {} are not definitionaly equal", _0, _1)]
NotDefEq(Term, Term),
/// f of type t1 cannot be applied to x of type t2
#[display(fmt = "{} : {} cannot be applied to {} : {}", _0, _1, _2, _3)]
WrongArgumentType(Term, Term, Term, Term),
/// t1 of type ty is not a function so cannot be applied to t2
#[display(
fmt = "{} : {} is not a function so cannot be applied to {}",
_0,
_1,
_2
)]
NotAFunction(Term, Term, Term),
/// Expected ty1, found ty2
#[display(fmt = "expected {}, found {}", _0, _1)]
TypeMismatch(Term, Term),
}
impl Error for KernelError {}
pub type Result<T> = std::result::Result<T, KernelError>;