diff options
Diffstat (limited to 'dhall/src/semantics')
-rw-r--r-- | dhall/src/semantics/phase/mod.rs | 17 | ||||
-rw-r--r-- | dhall/src/semantics/phase/resolve.rs | 8 | ||||
-rw-r--r-- | dhall/src/semantics/phase/typecheck.rs | 1 |
3 files changed, 5 insertions, 21 deletions
diff --git a/dhall/src/semantics/phase/mod.rs b/dhall/src/semantics/phase/mod.rs index 2727a61..f24a668 100644 --- a/dhall/src/semantics/phase/mod.rs +++ b/dhall/src/semantics/phase/mod.rs @@ -2,9 +2,7 @@ use std::fmt::Display; use std::path::Path; use crate::error::{EncodeError, Error, ImportError, TypeError}; -use crate::semantics::core::value::Value; -use crate::semantics::core::value::ValueKind; -use crate::semantics::tck::tyexpr::TyExpr; +use crate::semantics::{typecheck, typecheck_with, TyExpr, Value, ValueKind}; use crate::syntax::binary; use crate::syntax::{Builtin, Const, Expr}; use resolve::ImportRoot; @@ -12,7 +10,6 @@ use resolve::ImportRoot; pub(crate) mod normalize; pub(crate) mod parse; pub(crate) mod resolve; -pub(crate) mod typecheck; pub type ParsedExpr = Expr<Normalized>; pub type DecodedExpr = Expr<Normalized>; @@ -80,23 +77,15 @@ impl Parsed { impl Resolved { pub fn typecheck(&self) -> Result<Typed, TypeError> { - Ok(Typed(crate::semantics::tck::typecheck::typecheck(&self.0)?)) + Ok(Typed(typecheck(&self.0)?)) } pub fn typecheck_with(self, ty: &Normalized) -> Result<Typed, TypeError> { - Ok(Typed(crate::semantics::tck::typecheck::typecheck_with( - &self.0, - ty.to_expr(), - )?)) + Ok(Typed(typecheck_with(&self.0, ty.to_expr())?)) } /// Converts a value back to the corresponding AST expression. pub fn to_expr(&self) -> ResolvedExpr { self.0.clone() } - pub fn tck_and_normalize_new_flow(&self) -> Result<Normalized, TypeError> { - let val = crate::semantics::tck::typecheck::typecheck(&self.0)? - .normalize_whnf_noenv(); - Ok(Normalized(val)) - } } impl Typed { diff --git a/dhall/src/semantics/phase/resolve.rs b/dhall/src/semantics/phase/resolve.rs index 64106aa..cc4a024 100644 --- a/dhall/src/semantics/phase/resolve.rs +++ b/dhall/src/semantics/phase/resolve.rs @@ -52,14 +52,10 @@ fn load_import( import_cache: &mut ImportCache, import_stack: &ImportStack, ) -> Result<Normalized, Error> { - // Ok( - // do_resolve_expr(Parsed::parse_file(f)?, import_cache, import_stack)? - // .typecheck()? - // .normalize(), - // ) Ok( do_resolve_expr(Parsed::parse_file(f)?, import_cache, import_stack)? - .tck_and_normalize_new_flow()?, + .typecheck()? + .normalize(), ) } diff --git a/dhall/src/semantics/phase/typecheck.rs b/dhall/src/semantics/phase/typecheck.rs deleted file mode 100644 index 8b13789..0000000 --- a/dhall/src/semantics/phase/typecheck.rs +++ /dev/null @@ -1 +0,0 @@ - |