From e51b89d717a1f1aaba7e59c79c9fb4b8e7031bab Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Sat, 27 Jul 2019 15:09:31 +0100 Subject: Add case for RightBasedRecordMerge in the typechecking phase. The implementation checks the types and kinds of the LHS and RHS. In the happy path it unions the HashMap prefering keys on the RHS over the LHS, and the result is the type of the resulting HashMap. The error cases are: - If the kinds of the records differ it results in a RecordMismatch error. - If either the LHS or RHS are not records it results in a MustCombineRecord error. --- dhall/src/error/mod.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'dhall/src/error/mod.rs') diff --git a/dhall/src/error/mod.rs b/dhall/src/error/mod.rs index 125d013..20b8636 100644 --- a/dhall/src/error/mod.rs +++ b/dhall/src/error/mod.rs @@ -76,9 +76,11 @@ pub(crate) enum TypeMessage { MergeAnnotMismatch, MergeHandlerTypeMismatch, MergeHandlerReturnTypeMustNotBeDependent, + MustCombineRecord(Typed), ProjectionMustBeRecord, ProjectionMissingEntry, Sort, + RecordMismatch(Typed, Typed), RecordTypeDuplicateField, UnionTypeDuplicateField, Unimplemented, -- cgit v1.2.3