summaryrefslogtreecommitdiff
path: root/dhall/src/error
diff options
context:
space:
mode:
authorNadrieril2019-08-19 21:52:26 +0200
committerNadrieril2019-08-19 21:52:42 +0200
commit26a1fd0f0861038a76a0f9b09eaef16d808d4139 (patch)
treee89770d190a73ce5f1bae7798b77c02b598faed2 /dhall/src/error
parent29016b78736dca857e4e7f7c4dc68ed5e30c28bb (diff)
Use TypedValue instead of Typed in normalize and typecheck
Now Typed is only used in dhall::phase, similarly to Parsed/Resolved/Normalized
Diffstat (limited to 'dhall/src/error')
-rw-r--r--dhall/src/error/mod.rs55
1 files changed, 28 insertions, 27 deletions
diff --git a/dhall/src/error/mod.rs b/dhall/src/error/mod.rs
index 34a89c0..0f2f5fc 100644
--- a/dhall/src/error/mod.rs
+++ b/dhall/src/error/mod.rs
@@ -3,8 +3,9 @@ use std::io::Error as IOError;
use dhall_syntax::{BinOp, Import, Label, ParseError, V};
use crate::core::context::TypecheckContext;
+use crate::core::value::TypedValue;
use crate::phase::resolve::ImportStack;
-use crate::phase::{NormalizedSubExpr, Type, Typed};
+use crate::phase::NormalizedSubExpr;
pub type Result<T> = std::result::Result<T, Error>;
@@ -48,28 +49,28 @@ pub struct TypeError {
#[derive(Debug)]
pub(crate) enum TypeMessage {
UnboundVariable(V<Label>),
- InvalidInputType(Typed),
- InvalidOutputType(Typed),
- NotAFunction(Typed),
- TypeMismatch(Typed, Typed, Typed),
- AnnotMismatch(Typed, Typed),
+ InvalidInputType(TypedValue),
+ InvalidOutputType(TypedValue),
+ NotAFunction(TypedValue),
+ TypeMismatch(TypedValue, TypedValue, TypedValue),
+ AnnotMismatch(TypedValue, TypedValue),
Untyped,
FieldCollision(Label),
- InvalidListElement(usize, Typed, Typed),
- InvalidListType(Typed),
- InvalidOptionalType(Typed),
- InvalidPredicate(Typed),
- IfBranchMismatch(Typed, Typed),
- IfBranchMustBeTerm(bool, Typed),
- InvalidFieldType(Label, Type),
- NotARecord(Label, Typed),
- MustCombineRecord(Typed),
- MissingRecordField(Label, Typed),
- MissingUnionField(Label, Typed),
- BinOpTypeMismatch(BinOp, Typed),
- InvalidTextInterpolation(Typed),
- Merge1ArgMustBeRecord(Typed),
- Merge2ArgMustBeUnion(Typed),
+ InvalidListElement(usize, TypedValue, TypedValue),
+ InvalidListType(TypedValue),
+ InvalidOptionalType(TypedValue),
+ InvalidPredicate(TypedValue),
+ IfBranchMismatch(TypedValue, TypedValue),
+ IfBranchMustBeTerm(bool, TypedValue),
+ InvalidFieldType(Label, TypedValue),
+ NotARecord(Label, TypedValue),
+ MustCombineRecord(TypedValue),
+ MissingRecordField(Label, TypedValue),
+ MissingUnionField(Label, TypedValue),
+ BinOpTypeMismatch(BinOp, TypedValue),
+ InvalidTextInterpolation(TypedValue),
+ Merge1ArgMustBeRecord(TypedValue),
+ Merge2ArgMustBeUnion(TypedValue),
MergeEmptyNeedsAnnotation,
MergeHandlerMissingVariant(Label),
MergeVariantMissingHandler(Label),
@@ -79,14 +80,14 @@ pub(crate) enum TypeMessage {
ProjectionMustBeRecord,
ProjectionMissingEntry,
Sort,
- RecordMismatch(Typed, Typed),
+ RecordMismatch(TypedValue, TypedValue),
RecordTypeDuplicateField,
- RecordTypeMergeRequiresRecordType(Type),
- RecordTypeMismatch(Type, Type, Type, Type),
+ RecordTypeMergeRequiresRecordType(TypedValue),
+ RecordTypeMismatch(TypedValue, TypedValue, TypedValue, TypedValue),
UnionTypeDuplicateField,
- EquivalenceArgumentMustBeTerm(bool, Typed),
- EquivalenceTypeMismatch(Typed, Typed),
- AssertMismatch(Typed, Typed),
+ EquivalenceArgumentMustBeTerm(bool, TypedValue),
+ EquivalenceTypeMismatch(TypedValue, TypedValue),
+ AssertMismatch(TypedValue, TypedValue),
AssertMustTakeEquivalence,
}