aboutsummaryrefslogtreecommitdiff
path: root/src/type/display.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/type/display.rs')
-rw-r--r--src/type/display.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/type/display.rs b/src/type/display.rs
index 781d614..be51858 100644
--- a/src/type/display.rs
+++ b/src/type/display.rs
@@ -26,7 +26,7 @@ impl fmt::Display for Type {
.collect::<Vec<String>>()
.join(" ")
),
- UndefinedType => write!(f, "?"),
+ VarType(name) => write!(f, "{}", name),
}
}
}
@@ -47,7 +47,7 @@ impl fmt::Display for TypeError {
/// assert_eq!(
/// InvalidOperator {
/// operator: Atom(Int(1)),
- /// expected: arr(UndefinedType, UndefinedType),
+ /// expected: arr(VarType("?".to_string()), VarType("?".to_string())),
/// found: Integer
/// }.to_string(),
/// "invalid operator: '1'\nexpected: '? -> ?'\nfound: 'Int'".to_string()
@@ -60,10 +60,15 @@ impl fmt::Display for TypeError {
/// }.to_string(),
/// "invalid argument list: '(1 2 3)'\nexpected: '(Int Int)'\nfound: '(Int Int Int)'".to_string()
/// );
+ /// assert_eq!(
+ /// UnboundGeneric(String::from("?")).to_string(),
+ /// "unbound generic type: '?'".to_string()
+ /// );
/// ```
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
UndefinedVariable(name) => write!(f, "undefined variable: '{}'", name),
+ UnboundGeneric(name) => write!(f, "unbound generic type: '{}'", name),
InvalidOperator { operator, expected, found } => {
write!(
f,