summaryrefslogtreecommitdiff
path: root/dhall
diff options
context:
space:
mode:
Diffstat (limited to 'dhall')
-rw-r--r--dhall/src/error/mod.rs55
-rw-r--r--dhall/src/semantics/tck/typecheck.rs112
-rw-r--r--dhall/src/syntax/ast/span.rs6
-rw-r--r--dhall/tests/type-errors/hurkensParadox.txt2
-rw-r--r--dhall/tests/type-errors/mixedUnions.txt7
-rw-r--r--dhall/tests/type-errors/unit/AnnotationRecordWrongFieldName.txt7
-rw-r--r--dhall/tests/type-errors/unit/AnnotationRecordWrongFieldType.txt7
-rw-r--r--dhall/tests/type-errors/unit/AssertAlphaTrap.txt2
-rw-r--r--dhall/tests/type-errors/unit/AssertDoubleZeros.txt7
-rw-r--r--dhall/tests/type-errors/unit/AssertNotEquivalence.txt7
-rw-r--r--dhall/tests/type-errors/unit/AssertTriviallyFalse.txt7
-rw-r--r--dhall/tests/type-errors/unit/EquivalenceNotSameType.txt7
-rw-r--r--dhall/tests/type-errors/unit/EquivalenceNotTerms.txt7
-rw-r--r--dhall/tests/type-errors/unit/FunctionApplicationArgumentNotMatch.txt2
-rw-r--r--dhall/tests/type-errors/unit/FunctionApplicationIsNotFunction.txt2
-rw-r--r--dhall/tests/type-errors/unit/FunctionArgumentTypeNotAType.txt2
-rw-r--r--dhall/tests/type-errors/unit/FunctionTypeArgumentTypeNotAType.txt2
-rw-r--r--dhall/tests/type-errors/unit/IfBranchesNotMatch.txt7
-rw-r--r--dhall/tests/type-errors/unit/IfBranchesNotType.txt7
-rw-r--r--dhall/tests/type-errors/unit/IfNotBool.txt7
-rw-r--r--dhall/tests/type-errors/unit/LetWithWrongAnnotation.txt7
-rw-r--r--dhall/tests/type-errors/unit/ListLiteralEmptyNotType.txt2
-rw-r--r--dhall/tests/type-errors/unit/ListLiteralNotType.txt7
-rw-r--r--dhall/tests/type-errors/unit/ListLiteralTypesNotMatch.txt7
-rw-r--r--dhall/tests/type-errors/unit/MergeAlternativeHasNoHandler.txt7
-rw-r--r--dhall/tests/type-errors/unit/MergeAnnotationMismatch.txt7
-rw-r--r--dhall/tests/type-errors/unit/MergeAnnotationNotType.txt7
-rw-r--r--dhall/tests/type-errors/unit/MergeEmptyNeedsDirectAnnotation1.txt7
-rw-r--r--dhall/tests/type-errors/unit/MergeEmptyNeedsDirectAnnotation2.txt7
-rw-r--r--dhall/tests/type-errors/unit/MergeEmptyWithoutAnnotation.txt7
-rw-r--r--dhall/tests/type-errors/unit/MergeHandlerNotFunction.txt2
-rw-r--r--dhall/tests/type-errors/unit/MergeHandlerNotInUnion.txt7
-rw-r--r--dhall/tests/type-errors/unit/MergeHandlerNotMatchAlternativeType.txt2
-rw-r--r--dhall/tests/type-errors/unit/MergeHandlersWithDifferentType.txt7
-rw-r--r--dhall/tests/type-errors/unit/MergeLhsNotRecord.txt7
-rw-r--r--dhall/tests/type-errors/unit/MergeMissingHandler1.txt7
-rw-r--r--dhall/tests/type-errors/unit/MergeMissingHandler2.txt7
-rw-r--r--dhall/tests/type-errors/unit/MergeRhsNotUnion.txt7
-rw-r--r--dhall/tests/type-errors/unit/MergeUnusedHandler.txt7
-rw-r--r--dhall/tests/type-errors/unit/NaturalSubtractNotNatural.txt2
-rw-r--r--dhall/tests/type-errors/unit/OperatorAndNotBool.txt7
-rw-r--r--dhall/tests/type-errors/unit/OperatorEqualNotBool.txt7
-rw-r--r--dhall/tests/type-errors/unit/OperatorListConcatenateLhsNotList.txt7
-rw-r--r--dhall/tests/type-errors/unit/OperatorListConcatenateListsNotMatch.txt7
-rw-r--r--dhall/tests/type-errors/unit/OperatorListConcatenateNotListsButMatch.txt7
-rw-r--r--dhall/tests/type-errors/unit/OperatorListConcatenateRhsNotList.txt7
-rw-r--r--dhall/tests/type-errors/unit/OperatorNotEqualNotBool.txt7
-rw-r--r--dhall/tests/type-errors/unit/OperatorOrNotBool.txt7
-rw-r--r--dhall/tests/type-errors/unit/OperatorPlusNotNatural.txt7
-rw-r--r--dhall/tests/type-errors/unit/OperatorTextConcatenateLhsNotText.txt7
-rw-r--r--dhall/tests/type-errors/unit/OperatorTextConcatenateRhsNotText.txt7
-rw-r--r--dhall/tests/type-errors/unit/OperatorTimesNotNatural.txt7
-rw-r--r--dhall/tests/type-errors/unit/OptionalDeprecatedSyntaxAbsent.txt7
-rw-r--r--dhall/tests/type-errors/unit/OptionalDeprecatedSyntaxPresent.txt7
-rw-r--r--dhall/tests/type-errors/unit/RecordLitDuplicateFields.txt7
-rw-r--r--dhall/tests/type-errors/unit/RecordProjectionDuplicateFields.txt7
-rw-r--r--dhall/tests/type-errors/unit/RecordProjectionEmpty.txt7
-rw-r--r--dhall/tests/type-errors/unit/RecordProjectionNotPresent.txt7
-rw-r--r--dhall/tests/type-errors/unit/RecordProjectionNotRecord.txt7
-rw-r--r--dhall/tests/type-errors/unit/RecordSelectionEmpty.txt7
-rw-r--r--dhall/tests/type-errors/unit/RecordSelectionNotPresent.txt7
-rw-r--r--dhall/tests/type-errors/unit/RecordSelectionNotRecord.txt7
-rw-r--r--dhall/tests/type-errors/unit/RecordSelectionTypeNotUnionType.txt7
-rw-r--r--dhall/tests/type-errors/unit/RecordTypeDuplicateFields.txt7
-rw-r--r--dhall/tests/type-errors/unit/RecordTypeValueMember.txt7
-rw-r--r--dhall/tests/type-errors/unit/RecursiveRecordMergeLhsNotRecord.txt2
-rw-r--r--dhall/tests/type-errors/unit/RecursiveRecordMergeOverlapping.txt2
-rw-r--r--dhall/tests/type-errors/unit/RecursiveRecordMergeRhsNotRecord.txt2
-rw-r--r--dhall/tests/type-errors/unit/RecursiveRecordTypeMergeLhsNotRecordType.txt7
-rw-r--r--dhall/tests/type-errors/unit/RecursiveRecordTypeMergeOverlapping.txt2
-rw-r--r--dhall/tests/type-errors/unit/RecursiveRecordTypeMergeRhsNotRecordType.txt7
-rw-r--r--dhall/tests/type-errors/unit/RightBiasedRecordMergeLhsNotRecord.txt7
-rw-r--r--dhall/tests/type-errors/unit/RightBiasedRecordMergeRhsNotRecord.txt7
-rw-r--r--dhall/tests/type-errors/unit/SomeNotType.txt7
-rw-r--r--dhall/tests/type-errors/unit/TextLiteralInterpolateNotText.txt7
-rw-r--r--dhall/tests/type-errors/unit/TypeAnnotationWrong.txt7
-rw-r--r--dhall/tests/type-errors/unit/UnionConstructorFieldNotPresent.txt7
-rw-r--r--dhall/tests/type-errors/unit/UnionDeprecatedConstructorsKeyword.txt2
-rw-r--r--dhall/tests/type-errors/unit/UnionTypeDuplicateVariants1.txt7
-rw-r--r--dhall/tests/type-errors/unit/UnionTypeDuplicateVariants2.txt7
-rw-r--r--dhall/tests/type-errors/unit/UnionTypeMixedKinds.txt7
-rw-r--r--dhall/tests/type-errors/unit/UnionTypeMixedKinds2.txt7
-rw-r--r--dhall/tests/type-errors/unit/UnionTypeMixedKinds3.txt7
-rw-r--r--dhall/tests/type-errors/unit/UnionTypeNotType.txt7
-rw-r--r--dhall/tests/type-errors/unit/VariableFree.txt2
85 files changed, 484 insertions, 183 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)
}
diff --git a/dhall/src/semantics/tck/typecheck.rs b/dhall/src/semantics/tck/typecheck.rs
index 11c07d8..c3c589b 100644
--- a/dhall/src/semantics/tck/typecheck.rs
+++ b/dhall/src/semantics/tck/typecheck.rs
@@ -14,14 +14,22 @@ use crate::syntax::{
use crate::Normalized;
fn type_of_recordtype<'a>(
+ span: Span,
tys: impl Iterator<Item = Cow<'a, TyExpr>>,
) -> Result<Type, TypeError> {
+ let span_err = |msg: &str| {
+ mkerr(
+ ErrorBuilder::new(msg.to_string())
+ .span_err(span.clone(), msg.to_string())
+ .format(),
+ )
+ };
// An empty record type has type Type
let mut k = Const::Type;
for t in tys {
match t.get_type()?.as_const() {
Some(c) => k = max(k, c),
- None => return mkerr("InvalidFieldType"),
+ None => return span_err("InvalidFieldType"),
}
}
Ok(Value::from_const(k))
@@ -46,6 +54,14 @@ fn type_one_layer(
kind: &ExprKind<TyExpr, Normalized>,
span: Span,
) -> Result<Type, TypeError> {
+ let span_err = |msg: &str| {
+ mkerr(
+ ErrorBuilder::new(msg.to_string())
+ .span_err(span.clone(), msg.to_string())
+ .format(),
+ )
+ };
+
Ok(match kind {
ExprKind::Import(..) => unreachable!(
"There should remain no imports in a resolved expression"
@@ -92,7 +108,7 @@ fn type_one_layer(
};
let kt = match body.get_type()?.as_const() {
Some(k) => k,
- _ => return mkerr("Invalid output type"),
+ _ => return span_err("Invalid output type"),
};
Value::from_const(function_check(ks, kt))
@@ -116,7 +132,7 @@ fn type_one_layer(
use InterpolatedTextContents::Expr;
if let Expr(x) = contents {
if x.get_type()? != text_type {
- return mkerr("InvalidTextInterpolation");
+ return span_err("InvalidTextInterpolation");
}
}
}
@@ -130,7 +146,7 @@ fn type_one_layer(
args,
..
}) if args.len() == 1 => {}
- _ => return mkerr("InvalidListType"),
+ _ => return span_err("InvalidListType"),
};
t
}
@@ -139,12 +155,12 @@ fn type_one_layer(
let x = iter.next().unwrap();
for y in iter {
if x.get_type()? != y.get_type()? {
- return mkerr("InvalidListElement");
+ return span_err("InvalidListElement");
}
}
let t = x.get_type()?;
if t.get_type()?.as_const() != Some(Const::Type) {
- return mkerr("InvalidListType");
+ return span_err("InvalidListType");
}
Value::from_builtin(Builtin::List).app(t)
@@ -152,7 +168,7 @@ fn type_one_layer(
ExprKind::SomeLit(x) => {
let t = x.get_type()?;
if t.get_type()?.as_const() != Some(Const::Type) {
- return mkerr("InvalidOptionalType");
+ return span_err("InvalidOptionalType");
}
Value::from_builtin(Builtin::Optional).app(t)
@@ -164,13 +180,14 @@ fn type_one_layer(
// Check for duplicated entries
match kts.entry(x.clone()) {
Entry::Occupied(_) => {
- return mkerr("RecordTypeDuplicateField")
+ return span_err("RecordTypeDuplicateField")
}
Entry::Vacant(e) => e.insert(v.get_type()?),
};
}
let ty = type_of_recordtype(
+ span,
kts.iter()
.map(|(_, t)| Cow::Owned(t.to_tyexpr(env.as_varenv()))),
)?;
@@ -183,13 +200,13 @@ fn type_one_layer(
// Check for duplicated entries
match seen_fields.entry(x.clone()) {
Entry::Occupied(_) => {
- return mkerr("RecordTypeDuplicateField")
+ return span_err("RecordTypeDuplicateField")
}
Entry::Vacant(e) => e.insert(()),
};
}
- type_of_recordtype(kts.iter().map(|(_, t)| Cow::Borrowed(t)))?
+ type_of_recordtype(span, kts.iter().map(|(_, t)| Cow::Borrowed(t)))?
}
ExprKind::UnionType(kts) => {
use std::collections::hash_map::Entry;
@@ -201,12 +218,12 @@ fn type_one_layer(
match (k, t.get_type()?.as_const()) {
(None, Some(k2)) => k = Some(k2),
(Some(k1), Some(k2)) if k1 == k2 => {}
- _ => return mkerr("InvalidFieldType"),
+ _ => return span_err("InvalidFieldType"),
}
}
match seen_fields.entry(x) {
Entry::Occupied(_) => {
- return mkerr("UnionTypeDuplicateField")
+ return span_err("UnionTypeDuplicateField")
}
Entry::Vacant(e) => e.insert(()),
};
@@ -222,7 +239,7 @@ fn type_one_layer(
match &*scrut.get_type()?.kind() {
ValueKind::RecordType(kts) => match kts.get(&x) {
Some(tth) => tth.clone(),
- None => return mkerr("MissingRecordField"),
+ None => return span_err("MissingRecordField"),
},
// TODO: branch here only when scrut.get_type() is a Const
_ => {
@@ -249,29 +266,29 @@ fn type_one_layer(
)
}
Some(None) => scrut_nf,
- None => return mkerr("MissingUnionField"),
+ None => return span_err("MissingUnionField"),
},
- _ => return mkerr("NotARecord"),
+ _ => return span_err("NotARecord"),
}
- } // _ => mkerr("NotARecord"),
+ } // _ => span_err("NotARecord"),
}
}
ExprKind::Annot(x, t) => {
let t = t.eval(env.as_nzenv());
let x_ty = x.get_type()?;
if x_ty != t {
- return mkerr(format!(
+ return span_err(&format!(
"annot mismatch: ({} : {}) : {}",
x.to_expr_tyenv(env),
x_ty.to_tyexpr(env.as_varenv()).to_expr_tyenv(env),
t.to_tyexpr(env.as_varenv()).to_expr_tyenv(env)
));
- // return mkerr(format!(
+ // return span_err(format!(
// "annot mismatch: {} != {}",
// x_ty.to_tyexpr(env.as_varenv()).to_expr_tyenv(env),
// t.to_tyexpr(env.as_varenv()).to_expr_tyenv(env)
// ));
- // return mkerr(format!("annot mismatch: {:#?} : {:#?}", x, t,));
+ // return span_err(format!("annot mismatch: {:#?} : {:#?}", x, t,));
}
x_ty
}
@@ -279,8 +296,10 @@ fn type_one_layer(
let t = t.eval(env.as_nzenv());
match &*t.kind() {
ValueKind::Equivalence(x, y) if x == y => {}
- ValueKind::Equivalence(..) => return mkerr("AssertMismatch"),
- _ => return mkerr("AssertMustTakeEquivalence"),
+ ValueKind::Equivalence(..) => {
+ return span_err("AssertMismatch")
+ }
+ _ => return span_err("AssertMustTakeEquivalence"),
}
t
}
@@ -333,16 +352,16 @@ fn type_one_layer(
}
ExprKind::BoolIf(x, y, z) => {
if *x.get_type()?.kind() != ValueKind::from_builtin(Builtin::Bool) {
- return mkerr("InvalidPredicate");
+ return span_err("InvalidPredicate");
}
if y.get_type()?.get_type()?.as_const() != Some(Const::Type) {
- return mkerr("IfBranchMustBeTerm");
+ return span_err("IfBranchMustBeTerm");
}
if z.get_type()?.get_type()?.as_const() != Some(Const::Type) {
- return mkerr("IfBranchMustBeTerm");
+ return span_err("IfBranchMustBeTerm");
}
if y.get_type()? != z.get_type()? {
- return mkerr("IfBranchMismatch");
+ return span_err("IfBranchMismatch");
}
y.get_type()?
@@ -354,12 +373,12 @@ fn type_one_layer(
// Extract the LHS record type
let kts_x = match x_type.kind() {
ValueKind::RecordType(kts) => kts,
- _ => return mkerr("MustCombineRecord"),
+ _ => return span_err("MustCombineRecord"),
};
// Extract the RHS record type
let kts_y = match y_type.kind() {
ValueKind::RecordType(kts) => kts,
- _ => return mkerr("MustCombineRecord"),
+ _ => return span_err("MustCombineRecord"),
};
// Union the two records, prefering
@@ -370,6 +389,7 @@ fn type_one_layer(
// Construct the final record type
let ty = type_of_recordtype(
+ span,
kts.iter()
.map(|(_, t)| Cow::Owned(t.to_tyexpr(env.as_varenv()))),
)?;
@@ -390,11 +410,11 @@ fn type_one_layer(
let y_val = y.eval(env.as_nzenv());
let kts_x = match x_val.kind() {
ValueKind::RecordType(kts) => kts,
- _ => return mkerr("RecordTypeMergeRequiresRecordType"),
+ _ => return span_err("RecordTypeMergeRequiresRecordType"),
};
let kts_y = match y_val.kind() {
ValueKind::RecordType(kts) => kts,
- _ => return mkerr("RecordTypeMergeRequiresRecordType"),
+ _ => return span_err("RecordTypeMergeRequiresRecordType"),
};
for (k, tx) in kts_x {
if let Some(ty) = kts_y.get(k) {
@@ -422,21 +442,21 @@ fn type_one_layer(
b: Builtin::List,
..
}) => {}
- _ => return mkerr("BinOpTypeMismatch"),
+ _ => return span_err("BinOpTypeMismatch"),
}
if l_ty != r.get_type()? {
- return mkerr("BinOpTypeMismatch");
+ return span_err("BinOpTypeMismatch");
}
l_ty
}
ExprKind::BinOp(BinOp::Equivalence, l, r) => {
if l.get_type()? != r.get_type()? {
- return mkerr("EquivalenceTypeMismatch");
+ return span_err("EquivalenceTypeMismatch");
}
if l.get_type()?.get_type()?.as_const() != Some(Const::Type) {
- return mkerr("EquivalenceArgumentsMustBeTerms");
+ return span_err("EquivalenceArgumentsMustBeTerms");
}
Value::from_const(Const::Type)
@@ -458,11 +478,11 @@ fn type_one_layer(
});
if l.get_type()? != t {
- return mkerr("BinOpTypeMismatch");
+ return span_err("BinOpTypeMismatch");
}
if r.get_type()? != t {
- return mkerr("BinOpTypeMismatch");
+ return span_err("BinOpTypeMismatch");
}
t
@@ -471,7 +491,7 @@ fn type_one_layer(
let record_type = record.get_type()?;
let handlers = match record_type.kind() {
ValueKind::RecordType(kts) => kts,
- _ => return mkerr("Merge1ArgMustBeRecord"),
+ _ => return span_err("Merge1ArgMustBeRecord"),
};
let union_type = union.get_type()?;
@@ -488,7 +508,7 @@ fn type_one_layer(
kts.insert("Some".into(), Some(ty.clone()));
Cow::Owned(kts)
}
- _ => return mkerr("Merge2ArgMustBeUnionOrOptional"),
+ _ => return span_err("Merge2ArgMustBeUnionOrOptional"),
};
let mut inferred_type = None;
@@ -528,7 +548,7 @@ fn type_one_layer(
}
closure.remove_binder().or_else(|()| {
- mkerr("MergeReturnTypeIsDependent")
+ span_err("MergeReturnTypeIsDependent")
})?
}
_ => {
@@ -568,20 +588,20 @@ fn type_one_layer(
},
// Union alternative without type
Some(None) => handler_type.clone(),
- None => return mkerr("MergeHandlerMissingVariant"),
+ None => return span_err("MergeHandlerMissingVariant"),
};
match &inferred_type {
None => inferred_type = Some(handler_return_type),
Some(t) => {
if t != &handler_return_type {
- return mkerr("MergeHandlerTypeMismatch");
+ return span_err("MergeHandlerTypeMismatch");
}
}
}
}
for x in variants.keys() {
if !handlers.contains_key(x) {
- return mkerr("MergeVariantMissingHandler");
+ return span_err("MergeVariantMissingHandler");
}
}
@@ -590,13 +610,13 @@ fn type_one_layer(
match (inferred_type, type_annot) {
(Some(t1), Some(t2)) => {
if t1 != t2 {
- return mkerr("MergeAnnotMismatch");
+ return span_err("MergeAnnotMismatch");
}
t1
}
(Some(t), None) => t,
(None, Some(t)) => t,
- (None, None) => return mkerr("MergeEmptyNeedsAnnotation"),
+ (None, None) => return span_err("MergeEmptyNeedsAnnotation"),
}
}
ExprKind::ToMap(_, _) => unimplemented!("toMap"),
@@ -604,18 +624,18 @@ fn type_one_layer(
let record_type = record.get_type()?;
let kts = match record_type.kind() {
ValueKind::RecordType(kts) => kts,
- _ => return mkerr("ProjectionMustBeRecord"),
+ _ => return span_err("ProjectionMustBeRecord"),
};
let mut new_kts = HashMap::new();
for l in labels {
match kts.get(l) {
- None => return mkerr("ProjectionMissingEntry"),
+ None => return span_err("ProjectionMissingEntry"),
Some(t) => {
use std::collections::hash_map::Entry;
match new_kts.entry(l.clone()) {
Entry::Occupied(_) => {
- return mkerr("ProjectionDuplicateField")
+ return span_err("ProjectionDuplicateField")
}
Entry::Vacant(e) => e.insert(t.clone()),
}
diff --git a/dhall/src/syntax/ast/span.rs b/dhall/src/syntax/ast/span.rs
index ffdd82c..fba6a2d 100644
--- a/dhall/src/syntax/ast/span.rs
+++ b/dhall/src/syntax/ast/span.rs
@@ -100,8 +100,10 @@ fn char_idx_from_byte_idx(input: &str, idx: usize) -> usize {
.char_indices()
.enumerate()
.find(|(_, (i, _))| *i == idx)
- .unwrap()
- .0;
+ .map(|(i, (_, _))| i)
+ // We should be able to unwrap() here, but somehow it panics on an example from
+ // serde_dhall/lib.rs...
+ .unwrap_or(0);
// Unix-style newlines are counted as two chars (see
// https://github.com/rust-lang/annotate-snippets-rs/issues/24).
let nbr_newlines = input[..idx].chars().filter(|c| *c == '\n').count();
diff --git a/dhall/tests/type-errors/hurkensParadox.txt b/dhall/tests/type-errors/hurkensParadox.txt
index 522e1a2..6b99615 100644
--- a/dhall/tests/type-errors/hurkensParadox.txt
+++ b/dhall/tests/type-errors/hurkensParadox.txt
@@ -1,4 +1,4 @@
-Type error: Unhandled error: error: wrong type of function argument
+Type error: error: wrong type of function argument
--> <current file>:6:23
|
1 | let bottom : Type = ∀(any : Type) → any
diff --git a/dhall/tests/type-errors/mixedUnions.txt b/dhall/tests/type-errors/mixedUnions.txt
index fd4de70..8e0026d 100644
--- a/dhall/tests/type-errors/mixedUnions.txt
+++ b/dhall/tests/type-errors/mixedUnions.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: InvalidFieldType
+Type error: error: InvalidFieldType
+ --> <current file>:1:0
+ |
+1 | < Left : Natural | Right : Type >
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ InvalidFieldType
+ |
diff --git a/dhall/tests/type-errors/unit/AnnotationRecordWrongFieldName.txt b/dhall/tests/type-errors/unit/AnnotationRecordWrongFieldName.txt
index 946b296..2a754fc 100644
--- a/dhall/tests/type-errors/unit/AnnotationRecordWrongFieldName.txt
+++ b/dhall/tests/type-errors/unit/AnnotationRecordWrongFieldName.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: annot mismatch: ({ x = 1 } : { x : Natural }) : { y : Natural }
+Type error: error: annot mismatch: ({ x = 1 } : { x : Natural }) : { y : Natural }
+ --> <current file>:1:0
+ |
+1 | { x = 1 } : { y : Natural }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ annot mismatch: ({ x = 1 } : { x : Natural }) : { y : Natural }
+ |
diff --git a/dhall/tests/type-errors/unit/AnnotationRecordWrongFieldType.txt b/dhall/tests/type-errors/unit/AnnotationRecordWrongFieldType.txt
index 89817db..e67edb8 100644
--- a/dhall/tests/type-errors/unit/AnnotationRecordWrongFieldType.txt
+++ b/dhall/tests/type-errors/unit/AnnotationRecordWrongFieldType.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: annot mismatch: ({ x = 1 } : { x : Natural }) : { x : Text }
+Type error: error: annot mismatch: ({ x = 1 } : { x : Natural }) : { x : Text }
+ --> <current file>:1:0
+ |
+1 | { x = 1 } : { x : Text }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ annot mismatch: ({ x = 1 } : { x : Natural }) : { x : Text }
+ |
diff --git a/dhall/tests/type-errors/unit/AssertAlphaTrap.txt b/dhall/tests/type-errors/unit/AssertAlphaTrap.txt
index e4584f5..7e27d00 100644
--- a/dhall/tests/type-errors/unit/AssertAlphaTrap.txt
+++ b/dhall/tests/type-errors/unit/AssertAlphaTrap.txt
@@ -1,4 +1,4 @@
-Type error: Unhandled error: error: unbound variable ``_``
+Type error: error: unbound variable ``_``
--> <current file>:1:46
|
1 | assert : (\(_: Bool) -> _) === (\(x: Bool) -> _)
diff --git a/dhall/tests/type-errors/unit/AssertDoubleZeros.txt b/dhall/tests/type-errors/unit/AssertDoubleZeros.txt
index d8627ba..12231a0 100644
--- a/dhall/tests/type-errors/unit/AssertDoubleZeros.txt
+++ b/dhall/tests/type-errors/unit/AssertDoubleZeros.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: AssertMismatch
+Type error: error: AssertMismatch
+ --> <current file>:1:0
+ |
+1 | assert : -0.0 ≡ +0.0
+ | ^^^^^^^^^^^^^^^^^^^^ AssertMismatch
+ |
diff --git a/dhall/tests/type-errors/unit/AssertNotEquivalence.txt b/dhall/tests/type-errors/unit/AssertNotEquivalence.txt
index 537d31a..5973d19 100644
--- a/dhall/tests/type-errors/unit/AssertNotEquivalence.txt
+++ b/dhall/tests/type-errors/unit/AssertNotEquivalence.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: AssertMustTakeEquivalence
+Type error: error: AssertMustTakeEquivalence
+ --> <current file>:1:0
+ |
+1 | assert : Bool
+ | ^^^^^^^^^^^^^ AssertMustTakeEquivalence
+ |
diff --git a/dhall/tests/type-errors/unit/AssertTriviallyFalse.txt b/dhall/tests/type-errors/unit/AssertTriviallyFalse.txt
index d8627ba..5742022 100644
--- a/dhall/tests/type-errors/unit/AssertTriviallyFalse.txt
+++ b/dhall/tests/type-errors/unit/AssertTriviallyFalse.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: AssertMismatch
+Type error: error: AssertMismatch
+ --> <current file>:1:0
+ |
+1 | assert : 1 === 2
+ | ^^^^^^^^^^^^^^^^ AssertMismatch
+ |
diff --git a/dhall/tests/type-errors/unit/EquivalenceNotSameType.txt b/dhall/tests/type-errors/unit/EquivalenceNotSameType.txt
index 89749e9..12e21e4 100644
--- a/dhall/tests/type-errors/unit/EquivalenceNotSameType.txt
+++ b/dhall/tests/type-errors/unit/EquivalenceNotSameType.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: EquivalenceTypeMismatch
+Type error: error: EquivalenceTypeMismatch
+ --> <current file>:1:0
+ |
+1 | 1 === False
+ | ^^^^^^^^^^^ EquivalenceTypeMismatch
+ |
diff --git a/dhall/tests/type-errors/unit/EquivalenceNotTerms.txt b/dhall/tests/type-errors/unit/EquivalenceNotTerms.txt
index de11e28..0183c60 100644
--- a/dhall/tests/type-errors/unit/EquivalenceNotTerms.txt
+++ b/dhall/tests/type-errors/unit/EquivalenceNotTerms.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: EquivalenceArgumentsMustBeTerms
+Type error: error: EquivalenceArgumentsMustBeTerms
+ --> <current file>:1:0
+ |
+1 | Bool === Bool
+ | ^^^^^^^^^^^^^ EquivalenceArgumentsMustBeTerms
+ |
diff --git a/dhall/tests/type-errors/unit/FunctionApplicationArgumentNotMatch.txt b/dhall/tests/type-errors/unit/FunctionApplicationArgumentNotMatch.txt
index 01facbc..07278b8 100644
--- a/dhall/tests/type-errors/unit/FunctionApplicationArgumentNotMatch.txt
+++ b/dhall/tests/type-errors/unit/FunctionApplicationArgumentNotMatch.txt
@@ -1,4 +1,4 @@
-Type error: Unhandled error: error: wrong type of function argument
+Type error: error: wrong type of function argument
--> <current file>:1:1
|
1 | (λ(_ : Natural) → _) True
diff --git a/dhall/tests/type-errors/unit/FunctionApplicationIsNotFunction.txt b/dhall/tests/type-errors/unit/FunctionApplicationIsNotFunction.txt
index f779fd6..e46904a 100644
--- a/dhall/tests/type-errors/unit/FunctionApplicationIsNotFunction.txt
+++ b/dhall/tests/type-errors/unit/FunctionApplicationIsNotFunction.txt
@@ -1,4 +1,4 @@
-Type error: Unhandled error: error: expected function, found `Bool`
+Type error: error: expected function, found `Bool`
--> <current file>:1:0
|
1 | True True
diff --git a/dhall/tests/type-errors/unit/FunctionArgumentTypeNotAType.txt b/dhall/tests/type-errors/unit/FunctionArgumentTypeNotAType.txt
index 3fc1652..e84eb15 100644
--- a/dhall/tests/type-errors/unit/FunctionArgumentTypeNotAType.txt
+++ b/dhall/tests/type-errors/unit/FunctionArgumentTypeNotAType.txt
@@ -1,4 +1,4 @@
-Type error: Unhandled error: error: Invalid input type: `Natural`
+Type error: error: Invalid input type: `Natural`
--> <current file>:1:6
|
1 | λ(_ : 1) → _
diff --git a/dhall/tests/type-errors/unit/FunctionTypeArgumentTypeNotAType.txt b/dhall/tests/type-errors/unit/FunctionTypeArgumentTypeNotAType.txt
index 948c6c7..4aa0f4f 100644
--- a/dhall/tests/type-errors/unit/FunctionTypeArgumentTypeNotAType.txt
+++ b/dhall/tests/type-errors/unit/FunctionTypeArgumentTypeNotAType.txt
@@ -1,4 +1,4 @@
-Type error: Unhandled error: error: Invalid input type: `Natural`
+Type error: error: Invalid input type: `Natural`
--> <current file>:1:0
|
1 | 2 → _
diff --git a/dhall/tests/type-errors/unit/IfBranchesNotMatch.txt b/dhall/tests/type-errors/unit/IfBranchesNotMatch.txt
index 6b1dcdd..d58af95 100644
--- a/dhall/tests/type-errors/unit/IfBranchesNotMatch.txt
+++ b/dhall/tests/type-errors/unit/IfBranchesNotMatch.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: IfBranchMismatch
+Type error: error: IfBranchMismatch
+ --> <current file>:1:0
+ |
+1 | if True then 1 else ""
+ | ^^^^^^^^^^^^^^^^^^^^^^ IfBranchMismatch
+ |
diff --git a/dhall/tests/type-errors/unit/IfBranchesNotType.txt b/dhall/tests/type-errors/unit/IfBranchesNotType.txt
index 06039a7..b70ac5f 100644
--- a/dhall/tests/type-errors/unit/IfBranchesNotType.txt
+++ b/dhall/tests/type-errors/unit/IfBranchesNotType.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: IfBranchMustBeTerm
+Type error: error: IfBranchMustBeTerm
+ --> <current file>:1:0
+ |
+1 | if True then Type else Type
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ IfBranchMustBeTerm
+ |
diff --git a/dhall/tests/type-errors/unit/IfNotBool.txt b/dhall/tests/type-errors/unit/IfNotBool.txt
index b2d200c..eb5ff42 100644
--- a/dhall/tests/type-errors/unit/IfNotBool.txt
+++ b/dhall/tests/type-errors/unit/IfNotBool.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: InvalidPredicate
+Type error: error: InvalidPredicate
+ --> <current file>:1:0
+ |
+1 | if 1 then 1 else 1
+ | ^^^^^^^^^^^^^^^^^^ InvalidPredicate
+ |
diff --git a/dhall/tests/type-errors/unit/LetWithWrongAnnotation.txt b/dhall/tests/type-errors/unit/LetWithWrongAnnotation.txt
index cae4fea..5ba4b35 100644
--- a/dhall/tests/type-errors/unit/LetWithWrongAnnotation.txt
+++ b/dhall/tests/type-errors/unit/LetWithWrongAnnotation.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: annot mismatch: (True : Bool) : Natural
+Type error: error: annot mismatch: (True : Bool) : Natural
+ --> <current file>:1:8
+ |
+1 | let x : Natural = True in True
+ | ^^^^^^^ annot mismatch: (True : Bool) : Natural
+ |
diff --git a/dhall/tests/type-errors/unit/ListLiteralEmptyNotType.txt b/dhall/tests/type-errors/unit/ListLiteralEmptyNotType.txt
index aa7c8c5..2ca5819 100644
--- a/dhall/tests/type-errors/unit/ListLiteralEmptyNotType.txt
+++ b/dhall/tests/type-errors/unit/ListLiteralEmptyNotType.txt
@@ -1,4 +1,4 @@
-Type error: Unhandled error: error: wrong type of function argument
+Type error: error: wrong type of function argument
--> <current file>:1:5
|
1 | [] : List Type
diff --git a/dhall/tests/type-errors/unit/ListLiteralNotType.txt b/dhall/tests/type-errors/unit/ListLiteralNotType.txt
index 3937453..62d69e5 100644
--- a/dhall/tests/type-errors/unit/ListLiteralNotType.txt
+++ b/dhall/tests/type-errors/unit/ListLiteralNotType.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: InvalidListType
+Type error: error: InvalidListType
+ --> <current file>:1:0
+ |
+1 | [ Bool ]
+ | ^^^^^^^^ InvalidListType
+ |
diff --git a/dhall/tests/type-errors/unit/ListLiteralTypesNotMatch.txt b/dhall/tests/type-errors/unit/ListLiteralTypesNotMatch.txt
index a64cf67..33e007d 100644
--- a/dhall/tests/type-errors/unit/ListLiteralTypesNotMatch.txt
+++ b/dhall/tests/type-errors/unit/ListLiteralTypesNotMatch.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: InvalidListElement
+Type error: error: InvalidListElement
+ --> <current file>:1:0
+ |
+1 | [ True, 1 ]
+ | ^^^^^^^^^^^ InvalidListElement
+ |
diff --git a/dhall/tests/type-errors/unit/MergeAlternativeHasNoHandler.txt b/dhall/tests/type-errors/unit/MergeAlternativeHasNoHandler.txt
index 711d77d..a4a967a 100644
--- a/dhall/tests/type-errors/unit/MergeAlternativeHasNoHandler.txt
+++ b/dhall/tests/type-errors/unit/MergeAlternativeHasNoHandler.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: MergeVariantMissingHandler
+Type error: error: MergeVariantMissingHandler
+ --> <current file>:1:0
+ |
+1 | merge {=} (< x : Bool >.x True)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ MergeVariantMissingHandler
+ |
diff --git a/dhall/tests/type-errors/unit/MergeAnnotationMismatch.txt b/dhall/tests/type-errors/unit/MergeAnnotationMismatch.txt
index 823f2f7..9175f33 100644
--- a/dhall/tests/type-errors/unit/MergeAnnotationMismatch.txt
+++ b/dhall/tests/type-errors/unit/MergeAnnotationMismatch.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: MergeAnnotMismatch
+Type error: error: MergeAnnotMismatch
+ --> <current file>:1:0
+ |
+1 | merge { x = 0 } < x >.x : Bool
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ MergeAnnotMismatch
+ |
diff --git a/dhall/tests/type-errors/unit/MergeAnnotationNotType.txt b/dhall/tests/type-errors/unit/MergeAnnotationNotType.txt
index 4c72653..1173f0c 100644
--- a/dhall/tests/type-errors/unit/MergeAnnotationNotType.txt
+++ b/dhall/tests/type-errors/unit/MergeAnnotationNotType.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: Merge2ArgMustBeUnionOrOptional
+Type error: error: Merge2ArgMustBeUnionOrOptional
+ --> <current file>:1:0
+ |
+1 | merge {=} <> : Type
+ | ^^^^^^^^^^^^^^^^^^^ Merge2ArgMustBeUnionOrOptional
+ |
diff --git a/dhall/tests/type-errors/unit/MergeEmptyNeedsDirectAnnotation1.txt b/dhall/tests/type-errors/unit/MergeEmptyNeedsDirectAnnotation1.txt
index 563b3bf..94442e0 100644
--- a/dhall/tests/type-errors/unit/MergeEmptyNeedsDirectAnnotation1.txt
+++ b/dhall/tests/type-errors/unit/MergeEmptyNeedsDirectAnnotation1.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: MergeEmptyNeedsAnnotation
+Type error: error: MergeEmptyNeedsAnnotation
+ --> <current file>:1:13
+ |
+1 | \(x: <>) -> (merge {=} x) : Bool
+ | ^^^^^^^^^^^ MergeEmptyNeedsAnnotation
+ |
diff --git a/dhall/tests/type-errors/unit/MergeEmptyNeedsDirectAnnotation2.txt b/dhall/tests/type-errors/unit/MergeEmptyNeedsDirectAnnotation2.txt
index 563b3bf..5dcffdf 100644
--- a/dhall/tests/type-errors/unit/MergeEmptyNeedsDirectAnnotation2.txt
+++ b/dhall/tests/type-errors/unit/MergeEmptyNeedsDirectAnnotation2.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: MergeEmptyNeedsAnnotation
+Type error: error: MergeEmptyNeedsAnnotation
+ --> <current file>:1:26
+ |
+1 | \(x: <>) -> let y: Bool = merge {=} x in 1
+ | ^^^^^^^^^^^ MergeEmptyNeedsAnnotation
+ |
diff --git a/dhall/tests/type-errors/unit/MergeEmptyWithoutAnnotation.txt b/dhall/tests/type-errors/unit/MergeEmptyWithoutAnnotation.txt
index 4c72653..bf45123 100644
--- a/dhall/tests/type-errors/unit/MergeEmptyWithoutAnnotation.txt
+++ b/dhall/tests/type-errors/unit/MergeEmptyWithoutAnnotation.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: Merge2ArgMustBeUnionOrOptional
+Type error: error: Merge2ArgMustBeUnionOrOptional
+ --> <current file>:1:0
+ |
+1 | merge {=} <>
+ | ^^^^^^^^^^^^ Merge2ArgMustBeUnionOrOptional
+ |
diff --git a/dhall/tests/type-errors/unit/MergeHandlerNotFunction.txt b/dhall/tests/type-errors/unit/MergeHandlerNotFunction.txt
index 053a054..8528f90 100644
--- a/dhall/tests/type-errors/unit/MergeHandlerNotFunction.txt
+++ b/dhall/tests/type-errors/unit/MergeHandlerNotFunction.txt
@@ -1,4 +1,4 @@
-Type error: Unhandled error: error: merge handler is not a function
+Type error: error: merge handler is not a function
--> <current file>:1:0
|
1 | merge { x = True } (< x : Bool >.x True)
diff --git a/dhall/tests/type-errors/unit/MergeHandlerNotInUnion.txt b/dhall/tests/type-errors/unit/MergeHandlerNotInUnion.txt
index 4c72653..3159340 100644
--- a/dhall/tests/type-errors/unit/MergeHandlerNotInUnion.txt
+++ b/dhall/tests/type-errors/unit/MergeHandlerNotInUnion.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: Merge2ArgMustBeUnionOrOptional
+Type error: error: Merge2ArgMustBeUnionOrOptional
+ --> <current file>:1:0
+ |
+1 | merge { x = λ(_ : Bool) → _ } <> : Bool
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Merge2ArgMustBeUnionOrOptional
+ |
diff --git a/dhall/tests/type-errors/unit/MergeHandlerNotMatchAlternativeType.txt b/dhall/tests/type-errors/unit/MergeHandlerNotMatchAlternativeType.txt
index faca63a..c2229bd 100644
--- a/dhall/tests/type-errors/unit/MergeHandlerNotMatchAlternativeType.txt
+++ b/dhall/tests/type-errors/unit/MergeHandlerNotMatchAlternativeType.txt
@@ -1,4 +1,4 @@
-Type error: Unhandled error: error: Wrong handler input type
+Type error: error: Wrong handler input type
--> <current file>:1:0
|
1 | merge { x = λ(_ : Bool) → _ } (< x : Natural >.x 1)
diff --git a/dhall/tests/type-errors/unit/MergeHandlersWithDifferentType.txt b/dhall/tests/type-errors/unit/MergeHandlersWithDifferentType.txt
index 8b729a4..47f3de7 100644
--- a/dhall/tests/type-errors/unit/MergeHandlersWithDifferentType.txt
+++ b/dhall/tests/type-errors/unit/MergeHandlersWithDifferentType.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: MergeHandlerTypeMismatch
+Type error: error: MergeHandlerTypeMismatch
+ --> <current file>:1:0
+ |
+1 | merge { x = λ(_ : Bool) → _, y = λ(_ : Natural) → _ } (< x : Bool | y : Natural >.x True)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ MergeHandlerTypeMismatch
+ |
diff --git a/dhall/tests/type-errors/unit/MergeLhsNotRecord.txt b/dhall/tests/type-errors/unit/MergeLhsNotRecord.txt
index d151710..f27dddd 100644
--- a/dhall/tests/type-errors/unit/MergeLhsNotRecord.txt
+++ b/dhall/tests/type-errors/unit/MergeLhsNotRecord.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: Merge1ArgMustBeRecord
+Type error: error: Merge1ArgMustBeRecord
+ --> <current file>:1:0
+ |
+1 | merge True < x >.x
+ | ^^^^^^^^^^^^^^^^^^ Merge1ArgMustBeRecord
+ |
diff --git a/dhall/tests/type-errors/unit/MergeMissingHandler1.txt b/dhall/tests/type-errors/unit/MergeMissingHandler1.txt
index 711d77d..af58d05 100644
--- a/dhall/tests/type-errors/unit/MergeMissingHandler1.txt
+++ b/dhall/tests/type-errors/unit/MergeMissingHandler1.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: MergeVariantMissingHandler
+Type error: error: MergeVariantMissingHandler
+ --> <current file>:1:0
+ |
+1 | merge {=} <x>.x
+ | ^^^^^^^^^^^^^^^ MergeVariantMissingHandler
+ |
diff --git a/dhall/tests/type-errors/unit/MergeMissingHandler2.txt b/dhall/tests/type-errors/unit/MergeMissingHandler2.txt
index 711d77d..49484df 100644
--- a/dhall/tests/type-errors/unit/MergeMissingHandler2.txt
+++ b/dhall/tests/type-errors/unit/MergeMissingHandler2.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: MergeVariantMissingHandler
+Type error: error: MergeVariantMissingHandler
+ --> <current file>:1:0
+ |
+1 | merge { x = 0 } <x | y>.x
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ MergeVariantMissingHandler
+ |
diff --git a/dhall/tests/type-errors/unit/MergeRhsNotUnion.txt b/dhall/tests/type-errors/unit/MergeRhsNotUnion.txt
index 4c72653..0108725 100644
--- a/dhall/tests/type-errors/unit/MergeRhsNotUnion.txt
+++ b/dhall/tests/type-errors/unit/MergeRhsNotUnion.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: Merge2ArgMustBeUnionOrOptional
+Type error: error: Merge2ArgMustBeUnionOrOptional
+ --> <current file>:1:0
+ |
+1 | merge {=} True
+ | ^^^^^^^^^^^^^^ Merge2ArgMustBeUnionOrOptional
+ |
diff --git a/dhall/tests/type-errors/unit/MergeUnusedHandler.txt b/dhall/tests/type-errors/unit/MergeUnusedHandler.txt
index a429b89..2afe376 100644
--- a/dhall/tests/type-errors/unit/MergeUnusedHandler.txt
+++ b/dhall/tests/type-errors/unit/MergeUnusedHandler.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: MergeHandlerMissingVariant
+Type error: error: MergeHandlerMissingVariant
+ --> <current file>:1:0
+ |
+1 | merge { x = 1, y = 2 } < x >.x
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ MergeHandlerMissingVariant
+ |
diff --git a/dhall/tests/type-errors/unit/NaturalSubtractNotNatural.txt b/dhall/tests/type-errors/unit/NaturalSubtractNotNatural.txt
index 7e410c4..ac336a6 100644
--- a/dhall/tests/type-errors/unit/NaturalSubtractNotNatural.txt
+++ b/dhall/tests/type-errors/unit/NaturalSubtractNotNatural.txt
@@ -1,4 +1,4 @@
-Type error: Unhandled error: error: wrong type of function argument
+Type error: error: wrong type of function argument
--> <current file>:1:0
|
1 | Natural/subtract True True
diff --git a/dhall/tests/type-errors/unit/OperatorAndNotBool.txt b/dhall/tests/type-errors/unit/OperatorAndNotBool.txt
index 9f10587..f6ea50b 100644
--- a/dhall/tests/type-errors/unit/OperatorAndNotBool.txt
+++ b/dhall/tests/type-errors/unit/OperatorAndNotBool.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: BinOpTypeMismatch
+Type error: error: BinOpTypeMismatch
+ --> <current file>:1:0
+ |
+1 | 1 && 1
+ | ^^^^^^ BinOpTypeMismatch
+ |
diff --git a/dhall/tests/type-errors/unit/OperatorEqualNotBool.txt b/dhall/tests/type-errors/unit/OperatorEqualNotBool.txt
index 9f10587..8662c16 100644
--- a/dhall/tests/type-errors/unit/OperatorEqualNotBool.txt
+++ b/dhall/tests/type-errors/unit/OperatorEqualNotBool.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: BinOpTypeMismatch
+Type error: error: BinOpTypeMismatch
+ --> <current file>:1:0
+ |
+1 | 1 == 1
+ | ^^^^^^ BinOpTypeMismatch
+ |
diff --git a/dhall/tests/type-errors/unit/OperatorListConcatenateLhsNotList.txt b/dhall/tests/type-errors/unit/OperatorListConcatenateLhsNotList.txt
index 9f10587..8075b99 100644
--- a/dhall/tests/type-errors/unit/OperatorListConcatenateLhsNotList.txt
+++ b/dhall/tests/type-errors/unit/OperatorListConcatenateLhsNotList.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: BinOpTypeMismatch
+Type error: error: BinOpTypeMismatch
+ --> <current file>:1:0
+ |
+1 | 1 # [ True ]
+ | ^^^^^^^^^^^^ BinOpTypeMismatch
+ |
diff --git a/dhall/tests/type-errors/unit/OperatorListConcatenateListsNotMatch.txt b/dhall/tests/type-errors/unit/OperatorListConcatenateListsNotMatch.txt
index 9f10587..9e404f8 100644
--- a/dhall/tests/type-errors/unit/OperatorListConcatenateListsNotMatch.txt
+++ b/dhall/tests/type-errors/unit/OperatorListConcatenateListsNotMatch.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: BinOpTypeMismatch
+Type error: error: BinOpTypeMismatch
+ --> <current file>:1:0
+ |
+1 | [ True ] # [ 1 ]
+ | ^^^^^^^^^^^^^^^^ BinOpTypeMismatch
+ |
diff --git a/dhall/tests/type-errors/unit/OperatorListConcatenateNotListsButMatch.txt b/dhall/tests/type-errors/unit/OperatorListConcatenateNotListsButMatch.txt
index 9f10587..fffc898 100644
--- a/dhall/tests/type-errors/unit/OperatorListConcatenateNotListsButMatch.txt
+++ b/dhall/tests/type-errors/unit/OperatorListConcatenateNotListsButMatch.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: BinOpTypeMismatch
+Type error: error: BinOpTypeMismatch
+ --> <current file>:1:0
+ |
+1 | 1 # 2
+ | ^^^^^ BinOpTypeMismatch
+ |
diff --git a/dhall/tests/type-errors/unit/OperatorListConcatenateRhsNotList.txt b/dhall/tests/type-errors/unit/OperatorListConcatenateRhsNotList.txt
index 9f10587..2ba0b91 100644
--- a/dhall/tests/type-errors/unit/OperatorListConcatenateRhsNotList.txt
+++ b/dhall/tests/type-errors/unit/OperatorListConcatenateRhsNotList.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: BinOpTypeMismatch
+Type error: error: BinOpTypeMismatch
+ --> <current file>:1:0
+ |
+1 | [ True ] # 1
+ | ^^^^^^^^^^^^ BinOpTypeMismatch
+ |
diff --git a/dhall/tests/type-errors/unit/OperatorNotEqualNotBool.txt b/dhall/tests/type-errors/unit/OperatorNotEqualNotBool.txt
index 9f10587..ac04fd4 100644
--- a/dhall/tests/type-errors/unit/OperatorNotEqualNotBool.txt
+++ b/dhall/tests/type-errors/unit/OperatorNotEqualNotBool.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: BinOpTypeMismatch
+Type error: error: BinOpTypeMismatch
+ --> <current file>:1:0
+ |
+1 | 1 != 1
+ | ^^^^^^ BinOpTypeMismatch
+ |
diff --git a/dhall/tests/type-errors/unit/OperatorOrNotBool.txt b/dhall/tests/type-errors/unit/OperatorOrNotBool.txt
index 9f10587..9e1c4fb 100644
--- a/dhall/tests/type-errors/unit/OperatorOrNotBool.txt
+++ b/dhall/tests/type-errors/unit/OperatorOrNotBool.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: BinOpTypeMismatch
+Type error: error: BinOpTypeMismatch
+ --> <current file>:1:0
+ |
+1 | 1 || 1
+ | ^^^^^^ BinOpTypeMismatch
+ |
diff --git a/dhall/tests/type-errors/unit/OperatorPlusNotNatural.txt b/dhall/tests/type-errors/unit/OperatorPlusNotNatural.txt
index 9f10587..97e0df4 100644
--- a/dhall/tests/type-errors/unit/OperatorPlusNotNatural.txt
+++ b/dhall/tests/type-errors/unit/OperatorPlusNotNatural.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: BinOpTypeMismatch
+Type error: error: BinOpTypeMismatch
+ --> <current file>:1:0
+ |
+1 | True + True
+ | ^^^^^^^^^^^ BinOpTypeMismatch
+ |
diff --git a/dhall/tests/type-errors/unit/OperatorTextConcatenateLhsNotText.txt b/dhall/tests/type-errors/unit/OperatorTextConcatenateLhsNotText.txt
index 9f10587..679d991 100644
--- a/dhall/tests/type-errors/unit/OperatorTextConcatenateLhsNotText.txt
+++ b/dhall/tests/type-errors/unit/OperatorTextConcatenateLhsNotText.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: BinOpTypeMismatch
+Type error: error: BinOpTypeMismatch
+ --> <current file>:1:0
+ |
+1 | 1 ++ ""
+ | ^^^^^^^ BinOpTypeMismatch
+ |
diff --git a/dhall/tests/type-errors/unit/OperatorTextConcatenateRhsNotText.txt b/dhall/tests/type-errors/unit/OperatorTextConcatenateRhsNotText.txt
index 9f10587..85611f7 100644
--- a/dhall/tests/type-errors/unit/OperatorTextConcatenateRhsNotText.txt
+++ b/dhall/tests/type-errors/unit/OperatorTextConcatenateRhsNotText.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: BinOpTypeMismatch
+Type error: error: BinOpTypeMismatch
+ --> <current file>:1:0
+ |
+1 | "" ++ 1
+ | ^^^^^^^ BinOpTypeMismatch
+ |
diff --git a/dhall/tests/type-errors/unit/OperatorTimesNotNatural.txt b/dhall/tests/type-errors/unit/OperatorTimesNotNatural.txt
index 9f10587..d688ed6 100644
--- a/dhall/tests/type-errors/unit/OperatorTimesNotNatural.txt
+++ b/dhall/tests/type-errors/unit/OperatorTimesNotNatural.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: BinOpTypeMismatch
+Type error: error: BinOpTypeMismatch
+ --> <current file>:1:0
+ |
+1 | True * True
+ | ^^^^^^^^^^^ BinOpTypeMismatch
+ |
diff --git a/dhall/tests/type-errors/unit/OptionalDeprecatedSyntaxAbsent.txt b/dhall/tests/type-errors/unit/OptionalDeprecatedSyntaxAbsent.txt
index 3937453..bfb36ae 100644
--- a/dhall/tests/type-errors/unit/OptionalDeprecatedSyntaxAbsent.txt
+++ b/dhall/tests/type-errors/unit/OptionalDeprecatedSyntaxAbsent.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: InvalidListType
+Type error: error: InvalidListType
+ --> <current file>:1:0
+ |
+1 | [] : Optional Bool
+ | ^^^^^^^^^^^^^^^^^^ InvalidListType
+ |
diff --git a/dhall/tests/type-errors/unit/OptionalDeprecatedSyntaxPresent.txt b/dhall/tests/type-errors/unit/OptionalDeprecatedSyntaxPresent.txt
index 91d7fb0..5332fcb 100644
--- a/dhall/tests/type-errors/unit/OptionalDeprecatedSyntaxPresent.txt
+++ b/dhall/tests/type-errors/unit/OptionalDeprecatedSyntaxPresent.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: annot mismatch: ([1] : List Natural) : Optional Natural
+Type error: error: annot mismatch: ([1] : List Natural) : Optional Natural
+ --> <current file>:1:0
+ |
+1 | [ 1 ] : Optional Natural
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ annot mismatch: ([1] : List Natural) : Optional Natural
+ |
diff --git a/dhall/tests/type-errors/unit/RecordLitDuplicateFields.txt b/dhall/tests/type-errors/unit/RecordLitDuplicateFields.txt
index 4fc4a50..608c6a0 100644
--- a/dhall/tests/type-errors/unit/RecordLitDuplicateFields.txt
+++ b/dhall/tests/type-errors/unit/RecordLitDuplicateFields.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: RecordTypeDuplicateField
+Type error: error: RecordTypeDuplicateField
+ --> <current file>:1:0
+ |
+1 | { x = 0, x = 0 }
+ | ^^^^^^^^^^^^^^^^ RecordTypeDuplicateField
+ |
diff --git a/dhall/tests/type-errors/unit/RecordProjectionDuplicateFields.txt b/dhall/tests/type-errors/unit/RecordProjectionDuplicateFields.txt
index 0d2e83e..5c6520b 100644
--- a/dhall/tests/type-errors/unit/RecordProjectionDuplicateFields.txt
+++ b/dhall/tests/type-errors/unit/RecordProjectionDuplicateFields.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: ProjectionDuplicateField
+Type error: error: ProjectionDuplicateField
+ --> <current file>:1:0
+ |
+1 | { x = 1 }.{ x, x }
+ | ^^^^^^^^^^^^^^^^^^ ProjectionDuplicateField
+ |
diff --git a/dhall/tests/type-errors/unit/RecordProjectionEmpty.txt b/dhall/tests/type-errors/unit/RecordProjectionEmpty.txt
index ddbe5e4..39f263b 100644
--- a/dhall/tests/type-errors/unit/RecordProjectionEmpty.txt
+++ b/dhall/tests/type-errors/unit/RecordProjectionEmpty.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: ProjectionMissingEntry
+Type error: error: ProjectionMissingEntry
+ --> <current file>:1:0
+ |
+1 | {=}.{ x }
+ | ^^^^^^^^^ ProjectionMissingEntry
+ |
diff --git a/dhall/tests/type-errors/unit/RecordProjectionNotPresent.txt b/dhall/tests/type-errors/unit/RecordProjectionNotPresent.txt
index ddbe5e4..032f7a0 100644
--- a/dhall/tests/type-errors/unit/RecordProjectionNotPresent.txt
+++ b/dhall/tests/type-errors/unit/RecordProjectionNotPresent.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: ProjectionMissingEntry
+Type error: error: ProjectionMissingEntry
+ --> <current file>:1:0
+ |
+1 | { y = {=} }.{ x }
+ | ^^^^^^^^^^^^^^^^^ ProjectionMissingEntry
+ |
diff --git a/dhall/tests/type-errors/unit/RecordProjectionNotRecord.txt b/dhall/tests/type-errors/unit/RecordProjectionNotRecord.txt
index cb4b52f..5ed6ffd 100644
--- a/dhall/tests/type-errors/unit/RecordProjectionNotRecord.txt
+++ b/dhall/tests/type-errors/unit/RecordProjectionNotRecord.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: ProjectionMustBeRecord
+Type error: error: ProjectionMustBeRecord
+ --> <current file>:1:0
+ |
+1 | True.{ x }
+ | ^^^^^^^^^^ ProjectionMustBeRecord
+ |
diff --git a/dhall/tests/type-errors/unit/RecordSelectionEmpty.txt b/dhall/tests/type-errors/unit/RecordSelectionEmpty.txt
index ea48374..5b3b7f8 100644
--- a/dhall/tests/type-errors/unit/RecordSelectionEmpty.txt
+++ b/dhall/tests/type-errors/unit/RecordSelectionEmpty.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: MissingRecordField
+Type error: error: MissingRecordField
+ --> <current file>:1:0
+ |
+1 | {=}.x
+ | ^^^^^ MissingRecordField
+ |
diff --git a/dhall/tests/type-errors/unit/RecordSelectionNotPresent.txt b/dhall/tests/type-errors/unit/RecordSelectionNotPresent.txt
index ea48374..d435ca0 100644
--- a/dhall/tests/type-errors/unit/RecordSelectionNotPresent.txt
+++ b/dhall/tests/type-errors/unit/RecordSelectionNotPresent.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: MissingRecordField
+Type error: error: MissingRecordField
+ --> <current file>:1:0
+ |
+1 | { y = {=} }.x
+ | ^^^^^^^^^^^^^ MissingRecordField
+ |
diff --git a/dhall/tests/type-errors/unit/RecordSelectionNotRecord.txt b/dhall/tests/type-errors/unit/RecordSelectionNotRecord.txt
index 35d604f..3f9b7ed 100644
--- a/dhall/tests/type-errors/unit/RecordSelectionNotRecord.txt
+++ b/dhall/tests/type-errors/unit/RecordSelectionNotRecord.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: NotARecord
+Type error: error: NotARecord
+ --> <current file>:1:0
+ |
+1 | True.x
+ | ^^^^^^ NotARecord
+ |
diff --git a/dhall/tests/type-errors/unit/RecordSelectionTypeNotUnionType.txt b/dhall/tests/type-errors/unit/RecordSelectionTypeNotUnionType.txt
index 35d604f..cca28b8 100644
--- a/dhall/tests/type-errors/unit/RecordSelectionTypeNotUnionType.txt
+++ b/dhall/tests/type-errors/unit/RecordSelectionTypeNotUnionType.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: NotARecord
+Type error: error: NotARecord
+ --> <current file>:1:0
+ |
+1 | Bool.x
+ | ^^^^^^ NotARecord
+ |
diff --git a/dhall/tests/type-errors/unit/RecordTypeDuplicateFields.txt b/dhall/tests/type-errors/unit/RecordTypeDuplicateFields.txt
index 4fc4a50..145a59b 100644
--- a/dhall/tests/type-errors/unit/RecordTypeDuplicateFields.txt
+++ b/dhall/tests/type-errors/unit/RecordTypeDuplicateFields.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: RecordTypeDuplicateField
+Type error: error: RecordTypeDuplicateField
+ --> <current file>:1:0
+ |
+1 | { x: Natural, x: Natural }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ RecordTypeDuplicateField
+ |
diff --git a/dhall/tests/type-errors/unit/RecordTypeValueMember.txt b/dhall/tests/type-errors/unit/RecordTypeValueMember.txt
index fd4de70..04488ad 100644
--- a/dhall/tests/type-errors/unit/RecordTypeValueMember.txt
+++ b/dhall/tests/type-errors/unit/RecordTypeValueMember.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: InvalidFieldType
+Type error: error: InvalidFieldType
+ --> <current file>:1:0
+ |
+1 | { x : True }
+ | ^^^^^^^^^^^^ InvalidFieldType
+ |
diff --git a/dhall/tests/type-errors/unit/RecursiveRecordMergeLhsNotRecord.txt b/dhall/tests/type-errors/unit/RecursiveRecordMergeLhsNotRecord.txt
index 7fd03d3..f74e839 100644
--- a/dhall/tests/type-errors/unit/RecursiveRecordMergeLhsNotRecord.txt
+++ b/dhall/tests/type-errors/unit/RecursiveRecordMergeLhsNotRecord.txt
@@ -1 +1 @@
-Type error: Unhandled error: RecordTypeMergeRequiresRecordType
+Type error: error: RecordTypeMergeRequiresRecordType
diff --git a/dhall/tests/type-errors/unit/RecursiveRecordMergeOverlapping.txt b/dhall/tests/type-errors/unit/RecursiveRecordMergeOverlapping.txt
index 7fd03d3..f74e839 100644
--- a/dhall/tests/type-errors/unit/RecursiveRecordMergeOverlapping.txt
+++ b/dhall/tests/type-errors/unit/RecursiveRecordMergeOverlapping.txt
@@ -1 +1 @@
-Type error: Unhandled error: RecordTypeMergeRequiresRecordType
+Type error: error: RecordTypeMergeRequiresRecordType
diff --git a/dhall/tests/type-errors/unit/RecursiveRecordMergeRhsNotRecord.txt b/dhall/tests/type-errors/unit/RecursiveRecordMergeRhsNotRecord.txt
index 7fd03d3..f74e839 100644
--- a/dhall/tests/type-errors/unit/RecursiveRecordMergeRhsNotRecord.txt
+++ b/dhall/tests/type-errors/unit/RecursiveRecordMergeRhsNotRecord.txt
@@ -1 +1 @@
-Type error: Unhandled error: RecordTypeMergeRequiresRecordType
+Type error: error: RecordTypeMergeRequiresRecordType
diff --git a/dhall/tests/type-errors/unit/RecursiveRecordTypeMergeLhsNotRecordType.txt b/dhall/tests/type-errors/unit/RecursiveRecordTypeMergeLhsNotRecordType.txt
index 7fd03d3..b35e64b 100644
--- a/dhall/tests/type-errors/unit/RecursiveRecordTypeMergeLhsNotRecordType.txt
+++ b/dhall/tests/type-errors/unit/RecursiveRecordTypeMergeLhsNotRecordType.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: RecordTypeMergeRequiresRecordType
+Type error: error: RecordTypeMergeRequiresRecordType
+ --> <current file>:1:0
+ |
+1 | Bool ⩓ {}
+ | ^^^^^^^^^ RecordTypeMergeRequiresRecordType
+ |
diff --git a/dhall/tests/type-errors/unit/RecursiveRecordTypeMergeOverlapping.txt b/dhall/tests/type-errors/unit/RecursiveRecordTypeMergeOverlapping.txt
index 7fd03d3..f74e839 100644
--- a/dhall/tests/type-errors/unit/RecursiveRecordTypeMergeOverlapping.txt
+++ b/dhall/tests/type-errors/unit/RecursiveRecordTypeMergeOverlapping.txt
@@ -1 +1 @@
-Type error: Unhandled error: RecordTypeMergeRequiresRecordType
+Type error: error: RecordTypeMergeRequiresRecordType
diff --git a/dhall/tests/type-errors/unit/RecursiveRecordTypeMergeRhsNotRecordType.txt b/dhall/tests/type-errors/unit/RecursiveRecordTypeMergeRhsNotRecordType.txt
index 7fd03d3..0200f97 100644
--- a/dhall/tests/type-errors/unit/RecursiveRecordTypeMergeRhsNotRecordType.txt
+++ b/dhall/tests/type-errors/unit/RecursiveRecordTypeMergeRhsNotRecordType.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: RecordTypeMergeRequiresRecordType
+Type error: error: RecordTypeMergeRequiresRecordType
+ --> <current file>:1:0
+ |
+1 | {} ⩓ Bool
+ | ^^^^^^^^^ RecordTypeMergeRequiresRecordType
+ |
diff --git a/dhall/tests/type-errors/unit/RightBiasedRecordMergeLhsNotRecord.txt b/dhall/tests/type-errors/unit/RightBiasedRecordMergeLhsNotRecord.txt
index 42600a4..3b158ce 100644
--- a/dhall/tests/type-errors/unit/RightBiasedRecordMergeLhsNotRecord.txt
+++ b/dhall/tests/type-errors/unit/RightBiasedRecordMergeLhsNotRecord.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: MustCombineRecord
+Type error: error: MustCombineRecord
+ --> <current file>:1:0
+ |
+1 | True ⫽ {=}
+ | ^^^^^^^^^^ MustCombineRecord
+ |
diff --git a/dhall/tests/type-errors/unit/RightBiasedRecordMergeRhsNotRecord.txt b/dhall/tests/type-errors/unit/RightBiasedRecordMergeRhsNotRecord.txt
index 42600a4..4f9cb0d 100644
--- a/dhall/tests/type-errors/unit/RightBiasedRecordMergeRhsNotRecord.txt
+++ b/dhall/tests/type-errors/unit/RightBiasedRecordMergeRhsNotRecord.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: MustCombineRecord
+Type error: error: MustCombineRecord
+ --> <current file>:1:0
+ |
+1 | {=} ⫽ True
+ | ^^^^^^^^^^ MustCombineRecord
+ |
diff --git a/dhall/tests/type-errors/unit/SomeNotType.txt b/dhall/tests/type-errors/unit/SomeNotType.txt
index 63fec72..3584768 100644
--- a/dhall/tests/type-errors/unit/SomeNotType.txt
+++ b/dhall/tests/type-errors/unit/SomeNotType.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: InvalidOptionalType
+Type error: error: InvalidOptionalType
+ --> <current file>:1:0
+ |
+1 | Some Bool
+ | ^^^^^^^^^ InvalidOptionalType
+ |
diff --git a/dhall/tests/type-errors/unit/TextLiteralInterpolateNotText.txt b/dhall/tests/type-errors/unit/TextLiteralInterpolateNotText.txt
index f1a77d9..0132a30 100644
--- a/dhall/tests/type-errors/unit/TextLiteralInterpolateNotText.txt
+++ b/dhall/tests/type-errors/unit/TextLiteralInterpolateNotText.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: InvalidTextInterpolation
+Type error: error: InvalidTextInterpolation
+ --> <current file>:1:0
+ |
+1 | "${1}"
+ | ^^^^^^ InvalidTextInterpolation
+ |
diff --git a/dhall/tests/type-errors/unit/TypeAnnotationWrong.txt b/dhall/tests/type-errors/unit/TypeAnnotationWrong.txt
index 52fc94d..7360e68 100644
--- a/dhall/tests/type-errors/unit/TypeAnnotationWrong.txt
+++ b/dhall/tests/type-errors/unit/TypeAnnotationWrong.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: annot mismatch: (1 : Natural) : Bool
+Type error: error: annot mismatch: (1 : Natural) : Bool
+ --> <current file>:1:0
+ |
+1 | 1 : Bool
+ | ^^^^^^^^ annot mismatch: (1 : Natural) : Bool
+ |
diff --git a/dhall/tests/type-errors/unit/UnionConstructorFieldNotPresent.txt b/dhall/tests/type-errors/unit/UnionConstructorFieldNotPresent.txt
index f88cb57..41d283d 100644
--- a/dhall/tests/type-errors/unit/UnionConstructorFieldNotPresent.txt
+++ b/dhall/tests/type-errors/unit/UnionConstructorFieldNotPresent.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: MissingUnionField
+Type error: error: MissingUnionField
+ --> <current file>:1:0
+ |
+1 | < x : Bool >.y
+ | ^^^^^^^^^^^^^^ MissingUnionField
+ |
diff --git a/dhall/tests/type-errors/unit/UnionDeprecatedConstructorsKeyword.txt b/dhall/tests/type-errors/unit/UnionDeprecatedConstructorsKeyword.txt
index a234f9f..91fb96d 100644
--- a/dhall/tests/type-errors/unit/UnionDeprecatedConstructorsKeyword.txt
+++ b/dhall/tests/type-errors/unit/UnionDeprecatedConstructorsKeyword.txt
@@ -1,4 +1,4 @@
-Type error: Unhandled error: error: unbound variable `constructors`
+Type error: error: unbound variable `constructors`
--> <current file>:1:0
|
1 | constructors < Left : Natural | Right : Bool >
diff --git a/dhall/tests/type-errors/unit/UnionTypeDuplicateVariants1.txt b/dhall/tests/type-errors/unit/UnionTypeDuplicateVariants1.txt
index 27c6cbe..7372641 100644
--- a/dhall/tests/type-errors/unit/UnionTypeDuplicateVariants1.txt
+++ b/dhall/tests/type-errors/unit/UnionTypeDuplicateVariants1.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: UnionTypeDuplicateField
+Type error: error: UnionTypeDuplicateField
+ --> <current file>:1:0
+ |
+1 | <x | x>
+ | ^^^^^^^ UnionTypeDuplicateField
+ |
diff --git a/dhall/tests/type-errors/unit/UnionTypeDuplicateVariants2.txt b/dhall/tests/type-errors/unit/UnionTypeDuplicateVariants2.txt
index 27c6cbe..07042c2 100644
--- a/dhall/tests/type-errors/unit/UnionTypeDuplicateVariants2.txt
+++ b/dhall/tests/type-errors/unit/UnionTypeDuplicateVariants2.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: UnionTypeDuplicateField
+Type error: error: UnionTypeDuplicateField
+ --> <current file>:1:0
+ |
+1 | <x | x: Natural>
+ | ^^^^^^^^^^^^^^^^ UnionTypeDuplicateField
+ |
diff --git a/dhall/tests/type-errors/unit/UnionTypeMixedKinds.txt b/dhall/tests/type-errors/unit/UnionTypeMixedKinds.txt
index fd4de70..00e24b3 100644
--- a/dhall/tests/type-errors/unit/UnionTypeMixedKinds.txt
+++ b/dhall/tests/type-errors/unit/UnionTypeMixedKinds.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: InvalidFieldType
+Type error: error: InvalidFieldType
+ --> <current file>:1:0
+ |
+1 | < x : Bool | y : Type >
+ | ^^^^^^^^^^^^^^^^^^^^^^^ InvalidFieldType
+ |
diff --git a/dhall/tests/type-errors/unit/UnionTypeMixedKinds2.txt b/dhall/tests/type-errors/unit/UnionTypeMixedKinds2.txt
index fd4de70..924b1e1 100644
--- a/dhall/tests/type-errors/unit/UnionTypeMixedKinds2.txt
+++ b/dhall/tests/type-errors/unit/UnionTypeMixedKinds2.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: InvalidFieldType
+Type error: error: InvalidFieldType
+ --> <current file>:1:0
+ |
+1 | < x : Kind | y : Type >
+ | ^^^^^^^^^^^^^^^^^^^^^^^ InvalidFieldType
+ |
diff --git a/dhall/tests/type-errors/unit/UnionTypeMixedKinds3.txt b/dhall/tests/type-errors/unit/UnionTypeMixedKinds3.txt
index fd4de70..1113a0d 100644
--- a/dhall/tests/type-errors/unit/UnionTypeMixedKinds3.txt
+++ b/dhall/tests/type-errors/unit/UnionTypeMixedKinds3.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: InvalidFieldType
+Type error: error: InvalidFieldType
+ --> <current file>:1:0
+ |
+1 | < x : Kind | y : Bool >
+ | ^^^^^^^^^^^^^^^^^^^^^^^ InvalidFieldType
+ |
diff --git a/dhall/tests/type-errors/unit/UnionTypeNotType.txt b/dhall/tests/type-errors/unit/UnionTypeNotType.txt
index fd4de70..b2c06e0 100644
--- a/dhall/tests/type-errors/unit/UnionTypeNotType.txt
+++ b/dhall/tests/type-errors/unit/UnionTypeNotType.txt
@@ -1 +1,6 @@
-Type error: Unhandled error: InvalidFieldType
+Type error: error: InvalidFieldType
+ --> <current file>:1:0
+ |
+1 | < x : True >
+ | ^^^^^^^^^^^^ InvalidFieldType
+ |
diff --git a/dhall/tests/type-errors/unit/VariableFree.txt b/dhall/tests/type-errors/unit/VariableFree.txt
index 52baa7f..db78e15 100644
--- a/dhall/tests/type-errors/unit/VariableFree.txt
+++ b/dhall/tests/type-errors/unit/VariableFree.txt
@@ -1,4 +1,4 @@
-Type error: Unhandled error: error: unbound variable `x`
+Type error: error: unbound variable `x`
--> <current file>:1:0
|
1 | x