summaryrefslogtreecommitdiff
path: root/dhall
diff options
context:
space:
mode:
authorNadrieril2019-11-11 12:45:20 +0000
committerNadrieril2019-11-11 13:50:36 +0000
commit575adf9a7a87ba5d75548f7cd4efdec53c1fe17c (patch)
treed834fc0ce25ba70791afcb837a3a35f5dcff2933 /dhall
parent330f063e80a51f8f399864f9d01412e1bff34fe9 (diff)
Move "Type error" error prefix
Diffstat (limited to 'dhall')
-rw-r--r--dhall/src/error/mod.rs18
-rw-r--r--dhall/tests/type-errors/unit/AssertAlphaTrap.txt4
-rw-r--r--dhall/tests/type-errors/unit/UnionDeprecatedConstructorsKeyword.txt4
-rw-r--r--dhall/tests/type-errors/unit/VariableFree.txt4
4 files changed, 17 insertions, 13 deletions
diff --git a/dhall/src/error/mod.rs b/dhall/src/error/mod.rs
index efbd578..02e8ed3 100644
--- a/dhall/src/error/mod.rs
+++ b/dhall/src/error/mod.rs
@@ -103,14 +103,18 @@ impl std::fmt::Display for TypeError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
use TypeMessage::*;
let msg = match &self.message {
- UnboundVariable(span) => span.error("Unbound variable"),
- InvalidInputType(_) => "Invalid function input".to_string(),
- InvalidOutputType(_) => "Invalid function output".to_string(),
- NotAFunction(_) => "Not a function".to_string(),
+ UnboundVariable(span) => span.error("Type error: Unbound variable"),
+ InvalidInputType(_) => {
+ "Type error: Invalid function input".to_string()
+ }
+ InvalidOutputType(_) => {
+ "Type error: Invalid function output".to_string()
+ }
+ NotAFunction(_) => "Type error: Not a function".to_string(),
TypeMismatch(_, _, _) => {
- "Wrong type of function argument".to_string()
+ "Type error: Wrong type of function argument".to_string()
}
- _ => "Unhandled error".to_string(),
+ _ => "Type error: Unhandled error".to_string(),
};
write!(f, "{}", msg)
}
@@ -126,7 +130,7 @@ impl std::fmt::Display for Error {
Error::Decode(err) => write!(f, "{:?}", err),
Error::Encode(err) => write!(f, "{:?}", err),
Error::Resolve(err) => write!(f, "{:?}", err),
- Error::Typecheck(err) => write!(f, "Type error: {}", err),
+ Error::Typecheck(err) => write!(f, "{}", err),
}
}
}
diff --git a/dhall/tests/type-errors/unit/AssertAlphaTrap.txt b/dhall/tests/type-errors/unit/AssertAlphaTrap.txt
index f2fc8ce..2969c18 100644
--- a/dhall/tests/type-errors/unit/AssertAlphaTrap.txt
+++ b/dhall/tests/type-errors/unit/AssertAlphaTrap.txt
@@ -1,6 +1,6 @@
-Type error: --> 1:47
+ --> 1:47
|
1 | assert : (\(_: Bool) -> _) === (\(x: Bool) -> _)␊
| ^
|
- = Unbound variable
+ = Type error: Unbound variable
diff --git a/dhall/tests/type-errors/unit/UnionDeprecatedConstructorsKeyword.txt b/dhall/tests/type-errors/unit/UnionDeprecatedConstructorsKeyword.txt
index f7903de..9cc0c19 100644
--- a/dhall/tests/type-errors/unit/UnionDeprecatedConstructorsKeyword.txt
+++ b/dhall/tests/type-errors/unit/UnionDeprecatedConstructorsKeyword.txt
@@ -1,6 +1,6 @@
-Type error: --> 1:1
+ --> 1:1
|
1 | constructors < Left : Natural | Right : Bool >␊
| ^----------^
|
- = Unbound variable
+ = Type error: Unbound variable
diff --git a/dhall/tests/type-errors/unit/VariableFree.txt b/dhall/tests/type-errors/unit/VariableFree.txt
index ef1d16e..a46aac0 100644
--- a/dhall/tests/type-errors/unit/VariableFree.txt
+++ b/dhall/tests/type-errors/unit/VariableFree.txt
@@ -1,6 +1,6 @@
-Type error: --> 1:1
+ --> 1:1
|
1 | x␊
| ^
|
- = Unbound variable
+ = Type error: Unbound variable