summaryrefslogtreecommitdiff
path: root/dhall/src/typecheck.rs
diff options
context:
space:
mode:
Diffstat (limited to 'dhall/src/typecheck.rs')
-rw-r--r--dhall/src/typecheck.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/dhall/src/typecheck.rs b/dhall/src/typecheck.rs
index f51f1b6..9741e65 100644
--- a/dhall/src/typecheck.rs
+++ b/dhall/src/typecheck.rs
@@ -13,6 +13,11 @@ impl Resolved {
pub fn typecheck(self) -> Result<Typed, TypeError<X>> {
type_of(self.0.clone())
}
+ pub fn typecheck_with(self, ty: &Type) -> Result<Typed, TypeError<X>> {
+ let expr: SubExpr<_, _> = self.0.clone();
+ let ty: SubExpr<_, _> = ty.as_normalized()?.as_expr().clone();
+ type_of(dhall::subexpr!(expr: ty))
+ }
/// Pretends this expression has been typechecked. Use with care.
pub fn skip_typecheck(self) -> Typed {
Typed(self.0, UNTYPE)