diff options
author | Nadrieril Feneanar | 2020-02-04 18:55:37 +0000 |
---|---|---|
committer | GitHub | 2020-02-04 18:55:37 +0000 |
commit | eb9129312edf574948df777acb340189dc147724 (patch) | |
tree | b3297ae9f8a46f976274159aa7f4c8ee8662b6f1 /dhall/src/error | |
parent | 488bce275f104384282a0867aeaad011ae8cf48c (diff) | |
parent | f3bdd5ab32e112483da4c81d64ec14a116bf06cf (diff) |
Merge pull request #128 from Nadrieril/nice-errors-everywhere
Add basic pretty type errors to all errors
Diffstat (limited to 'dhall/src/error')
-rw-r--r-- | dhall/src/error/mod.rs | 55 |
1 files changed, 2 insertions, 53 deletions
diff --git a/dhall/src/error/mod.rs b/dhall/src/error/mod.rs index 6ea7d0c..13b61fa 100644 --- a/dhall/src/error/mod.rs +++ b/dhall/src/error/mod.rs @@ -47,42 +47,7 @@ pub struct TypeError { /// The specific type error #[derive(Debug)] pub(crate) enum TypeMessage { - // UnboundVariable(Span), - // NotAFunction(Value), - // TypeMismatch(Value, Value, Value), - // AnnotMismatch(Value, Value), - // InvalidListElement(usize, Value, Value), - // InvalidListType(Value), - // InvalidOptionalType(Value), - // InvalidPredicate(Value), - // IfBranchMismatch(Value, Value), - // IfBranchMustBeTerm(bool, Value), - // InvalidFieldType(Label, Value), - // NotARecord(Label, Value), - // MustCombineRecord(Value), - // MissingRecordField(Label, Value), - // MissingUnionField(Label, Value), - // BinOpTypeMismatch(BinOp, Value), - // InvalidTextInterpolation(Value), - // Merge1ArgMustBeRecord(Value), - // Merge2ArgMustBeUnionOrOptional(Value), - // MergeEmptyNeedsAnnotation, - // MergeHandlerMissingVariant(Label), - // MergeVariantMissingHandler(Label), - // MergeAnnotMismatch, - // MergeHandlerTypeMismatch, - // MergeHandlerReturnTypeMustNotBeDependent, - // ProjectionMustBeRecord, - // ProjectionMissingEntry, - // ProjectionDuplicateField, Sort, - // RecordTypeDuplicateField, - // RecordTypeMergeRequiresRecordType(Value), - // UnionTypeDuplicateField, - // EquivalenceArgumentMustBeTerm(bool, Value), - // EquivalenceTypeMismatch(Value, Value), - // AssertMismatch(Value, Value), - // AssertMustTakeEquivalence, Custom(String), } @@ -96,24 +61,8 @@ 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(var) => var.error("Type error: Unbound variable"), - // NotAFunction(v) => v.span().error("Type error: Not a function"), - // TypeMismatch(x, y, z) => { - // x.span() - // .error("Type error: Wrong type of function argument") - // + "\n" - // + &z.span().error(format!( - // "This argument has type {:?}", - // z.get_type().unwrap() - // )) - // + "\n" - // + &y.span().error(format!( - // "But the function expected an argument of type {:?}", - // y - // )) - // } - Custom(s) => format!("Type error: Unhandled error: {}", s), - _ => format!("Type error: Unhandled error: {:?}", self.message), + Sort => format!("Type error: Unhandled error: {:?}", self.message), + Custom(s) => format!("Type error: {}", s), }; write!(f, "{}", msg) } |