From fc309bf41dfe53d043766ec9d468389b2b4269ae Mon Sep 17 00:00:00 2001 From: FintanH Date: Thu, 1 Aug 2019 16:26:10 +0100 Subject: Add typechecking for RecursiveRecordTypeMerge. The implementation brings with it intersection_with_key over HashMaps to help with the type checking of records of records. The implementation first checks that the Const values line up with the LHS and RHS. Then checks that combining the records does not result in a FieldCollision. It will finally return the shared Const type of the arguments. --- dhall/src/error/mod.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'dhall/src/error') diff --git a/dhall/src/error/mod.rs b/dhall/src/error/mod.rs index 125d013..2f65443 100644 --- a/dhall/src/error/mod.rs +++ b/dhall/src/error/mod.rs @@ -55,6 +55,7 @@ pub(crate) enum TypeMessage { TypeMismatch(Typed, Normalized, Typed), AnnotMismatch(Typed, Normalized), Untyped, + FieldCollision(Label), InvalidListElement(usize, Normalized, Typed), InvalidListType(Normalized), InvalidOptionalType(Normalized), @@ -80,6 +81,8 @@ pub(crate) enum TypeMessage { ProjectionMissingEntry, Sort, RecordTypeDuplicateField, + RecordTypeMergeRequiresRecordType(Type), + RecordTypeMismatch(Type, Type, Type, Type), UnionTypeDuplicateField, Unimplemented, } -- cgit v1.2.3