aboutsummaryrefslogtreecommitdiff
path: root/src/type/display.rs
diff options
context:
space:
mode:
authorJoel Kronqvist <joel.kronqvist@iki.fi>2025-08-12 20:00:56 +0300
committerJoel Kronqvist <joel.kronqvist@iki.fi>2025-08-12 20:00:56 +0300
commita8a4c5b567ea6a58809dc8232ea5f1d3c93879b9 (patch)
treed9ed2fc0970900bb4b8ff790158ae3ff3c0213d9 /src/type/display.rs
parentdb736d795b759edd913d96195747f0881c4e950f (diff)
downloadmyslip-a8a4c5b567ea6a58809dc8232ea5f1d3c93879b9.tar.gz
myslip-a8a4c5b567ea6a58809dc8232ea5f1d3c93879b9.zip
feat: type checking for case expressions
Diffstat (limited to 'src/type/display.rs')
-rw-r--r--src/type/display.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/type/display.rs b/src/type/display.rs
index e945eba..290e24e 100644
--- a/src/type/display.rs
+++ b/src/type/display.rs
@@ -123,7 +123,10 @@ impl fmt::Display for TypeError {
)
},
FunAsAtom => write!(f, "'fn' used as atom doesn't make sense"),
+ CaseAsAtom => write!(f, "'case' used as atom doesn't make sense"),
+ RestAsAtom => write!(f, "'..[name]' used as atom doesn't make sense"),
InvalidFunDef(exp, err) => write!(f, "invalid function definition '{exp}': {err}"),
+ NoWildcardInCase(exp) => write!(f, "no wildcard in cases: '{exp}'"),
OtherError => write!(f, "uncategorized error"),
}
}
@@ -133,6 +136,10 @@ impl fmt::Display for TypeError {
impl fmt::Display for PatFail {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
+ RestNotAtEnd(exp) =>
+ write!(f, "rest pattern should be at end in '{exp}'"),
+ NoArm(exp) =>
+ write!(f, "'{exp}' should consist of a pattern and a respective arm"),
RepeatedVariable(name, exp_in) =>
write!(f, "repeated pattern variable '{name}' in '{exp_in}'"),
TypeMismatch { pattern, expected, found } =>