diff options
author | Nadrieril | 2019-12-22 18:24:21 +0000 |
---|---|---|
committer | Nadrieril | 2019-12-22 18:24:21 +0000 |
commit | fa6de4c077ab4f1c28d2ec64a33a3be8c5a9bb1c (patch) | |
tree | c0506c6bad8ff70e7108b3c6a9f34acbd5fb4010 /dhall/src | |
parent | 6e0d808e0f5683de942d912231fa10211b6d1377 (diff) |
Update dhall-lang submodule
Diffstat (limited to 'dhall/src')
-rw-r--r-- | dhall/src/error/mod.rs | 1 | ||||
-rw-r--r-- | dhall/src/semantics/phase/typecheck.rs | 10 |
2 files changed, 10 insertions, 1 deletions
diff --git a/dhall/src/error/mod.rs b/dhall/src/error/mod.rs index 1288c12..40cccac 100644 --- a/dhall/src/error/mod.rs +++ b/dhall/src/error/mod.rs @@ -76,6 +76,7 @@ pub(crate) enum TypeMessage { MergeHandlerReturnTypeMustNotBeDependent, ProjectionMustBeRecord, ProjectionMissingEntry, + ProjectionDuplicateField, Sort, RecordTypeDuplicateField, RecordTypeMergeRequiresRecordType(Value), diff --git a/dhall/src/semantics/phase/typecheck.rs b/dhall/src/semantics/phase/typecheck.rs index c439f74..856f5c3 100644 --- a/dhall/src/semantics/phase/typecheck.rs +++ b/dhall/src/semantics/phase/typecheck.rs @@ -774,7 +774,15 @@ fn type_last_layer( for l in labels { match kts.get(l) { None => return mkerr(ProjectionMissingEntry), - Some(t) => new_kts.insert(l.clone(), t.clone()), + Some(t) => { + use std::collections::hash_map::Entry; + match new_kts.entry(l.clone()) { + Entry::Occupied(_) => { + return mkerr(ProjectionDuplicateField) + } + Entry::Vacant(e) => e.insert(t.clone()), + } + } }; } |