summaryrefslogtreecommitdiff
path: root/dhall/src/phase
diff options
context:
space:
mode:
authorFintanH2019-08-03 18:54:01 +0100
committerFintanH2019-08-03 18:54:01 +0100
commit8bc33c16e90ff6e1d2b4ddc7317a91190c9d8540 (patch)
tree0303d4b3af2990c97ce6747100e1b61259fcceff /dhall/src/phase
parenta390b54b6a55a348b7fc000f9f81d395996a32c1 (diff)
Simplify Const checking logic
Diffstat (limited to '')
-rw-r--r--dhall/src/phase/typecheck.rs18
1 files changed, 7 insertions, 11 deletions
diff --git a/dhall/src/phase/typecheck.rs b/dhall/src/phase/typecheck.rs
index 3bff7ca..75f78ac 100644
--- a/dhall/src/phase/typecheck.rs
+++ b/dhall/src/phase/typecheck.rs
@@ -687,17 +687,13 @@ fn type_last_layer(
};
// Const values must match for the Records
- let k = match (k_l, k_r) {
- (dhall_syntax::Const::Type, dhall_syntax::Const::Type) => dhall_syntax::Const::Type,
- (dhall_syntax::Const::Kind, dhall_syntax::Const::Kind) => dhall_syntax::Const::Kind,
- (dhall_syntax::Const::Sort, dhall_syntax::Const::Sort) => dhall_syntax::Const::Sort,
- (l_mismatch, r_mismatch) =>
- return Err(mkerr(RecordTypeMismatch(
- Typed::from_const(l_mismatch),
- Typed::from_const(r_mismatch),
- l.clone(),
- r.clone(),
- ))),
+ let k = if k_l == k_r { k_l } else {
+ return Err(mkerr(RecordTypeMismatch(
+ Typed::from_const(k_l),
+ Typed::from_const(k_r),
+ l.clone(),
+ r.clone(),
+ )))
};
// Extract the LHS record type