summaryrefslogtreecommitdiff
path: root/dhall/src/semantics
diff options
context:
space:
mode:
authorNadrieril Feneanar2020-02-09 20:12:13 +0000
committerGitHub2020-02-09 20:12:13 +0000
commit75889ac64e2d04dfd7c00fc59e29e4530e69cc9a (patch)
treecf28b0104879bd73802c4a21c4ca76b298d1cb04 /dhall/src/semantics
parent5abc0628058a318782c46614d943c034711845c6 (diff)
parent4c2a28b844b18d7b67278a1c8f628d9a95ea37c4 (diff)
Merge pull request #130 from Nadrieril/improve-tests
Improve the test harness
Diffstat (limited to 'dhall/src/semantics')
-rw-r--r--dhall/src/semantics/tck/typecheck.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/dhall/src/semantics/tck/typecheck.rs b/dhall/src/semantics/tck/typecheck.rs
index 6817712..dd9a8fa 100644
--- a/dhall/src/semantics/tck/typecheck.rs
+++ b/dhall/src/semantics/tck/typecheck.rs
@@ -847,7 +847,10 @@ pub(crate) fn type_with(
/// Typecheck an expression and return the expression annotated with types if type-checking
/// succeeded, or an error if type-checking failed.
pub(crate) fn typecheck(e: &Expr<Normalized>) -> Result<TyExpr, TypeError> {
- type_with(&TyEnv::new(), e)
+ let res = type_with(&TyEnv::new(), e)?;
+ // Ensure that the inferred type exists (i.e. this is not Sort)
+ res.get_type()?;
+ Ok(res)
}
/// Like `typecheck`, but additionally checks that the expression's type matches the provided type.