summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dhall/src/operations/typecheck.rs6
-rw-r--r--dhall/src/semantics/nze/nir.rs8
2 files changed, 6 insertions, 8 deletions
diff --git a/dhall/src/operations/typecheck.rs b/dhall/src/operations/typecheck.rs
index 9b19c84..e62a8cc 100644
--- a/dhall/src/operations/typecheck.rs
+++ b/dhall/src/operations/typecheck.rs
@@ -219,10 +219,8 @@ fn typecheck_merge<'cx>(
// TODO: this actually doesn't check anything yet
match closure.remove_binder() {
- Ok(v) => Type::new_infer_universe(env, v.clone())?,
- Err(()) => {
- return span_err("MergeReturnTypeIsDependent")
- }
+ Some(v) => Type::new_infer_universe(env, v.clone())?,
+ None => return span_err("MergeReturnTypeIsDependent"),
}
}
_ => {
diff --git a/dhall/src/semantics/nze/nir.rs b/dhall/src/semantics/nze/nir.rs
index 8cf06c5..124ac05 100644
--- a/dhall/src/semantics/nze/nir.rs
+++ b/dhall/src/semantics/nze/nir.rs
@@ -344,17 +344,17 @@ impl<'cx> Closure<'cx> {
self.apply_var(NzVar::new(venv.size()))
.to_hir(venv.insert())
}
- /// If the closure variable is free in the closure, return Err. Otherwise, return the value
+ /// If the closure variable is free in the closure, return `None`. Otherwise, return the value
/// with that free variable remove.
- pub fn remove_binder(&self) -> Result<Nir<'cx>, ()> {
+ pub fn remove_binder(&self) -> Option<Nir<'cx>> {
match self {
Closure::Closure { .. } => {
let v = NzVar::fresh();
// TODO: handle case where variable is used in closure
// TODO: return information about where the variable is used
- Ok(self.apply_var(v))
+ Some(self.apply_var(v))
}
- Closure::ConstantClosure { body, .. } => Ok(body.clone()),
+ Closure::ConstantClosure { body, .. } => Some(body.clone()),
}
}
}