diff options
-rw-r--r-- | dhall/src/lib.rs | 7 | ||||
-rw-r--r-- | dhall/src/tests.rs | 6 | ||||
-rw-r--r-- | dhall/src/typecheck.rs | 9 |
3 files changed, 8 insertions, 14 deletions
diff --git a/dhall/src/lib.rs b/dhall/src/lib.rs index c9a8f7c..6436927 100644 --- a/dhall/src/lib.rs +++ b/dhall/src/lib.rs @@ -18,11 +18,8 @@ mod parser; mod binary; mod imports; mod normalize; -pub mod traits; -pub mod typecheck; -pub use crate::imports::{load_dhall_file, ImportError}; +mod traits; +mod typecheck; pub use crate::traits::StaticType; -pub use dhall_generator::expr; -pub use dhall_generator::subexpr; pub use dhall_generator::StaticType; pub mod expr; diff --git a/dhall/src/tests.rs b/dhall/src/tests.rs index ae6fd12..ebb8855 100644 --- a/dhall/src/tests.rs +++ b/dhall/src/tests.rs @@ -29,8 +29,10 @@ macro_rules! make_spec_test { }; } +use crate::imports::ImportError; use crate::*; use dhall_core::*; +use dhall_generator as dhall; use std::path::PathBuf; #[allow(dead_code)] @@ -46,7 +48,7 @@ pub enum Feature { // Deprecated fn read_dhall_file<'i>(file_path: &str) -> Result<Expr<X, X>, ImportError> { - crate::load_dhall_file(&PathBuf::from(file_path), true) + crate::imports::load_dhall_file(&PathBuf::from(file_path), true) } fn load_from_file_str<'i>( @@ -138,7 +140,7 @@ pub fn run_test(base_path: &str, feature: Feature) { let expr = rc(read_dhall_file(&expr_file_path).unwrap()); let expected = rc(read_dhall_file(&expected_file_path).unwrap()); - typecheck::type_of(crate::subexpr!(expr: expected)) + typecheck::type_of(dhall::subexpr!(expr: expected)) .unwrap(); }) .unwrap() diff --git a/dhall/src/typecheck.rs b/dhall/src/typecheck.rs index ba32408..5230aab 100644 --- a/dhall/src/typecheck.rs +++ b/dhall/src/typecheck.rs @@ -11,7 +11,7 @@ use self::TypeMessage::*; impl Resolved { pub fn typecheck(self) -> Result<Typed, TypeError<X>> { - type_of_(self.0.clone()) + type_of(self.0.clone()) } /// Pretends this expression has been typechecked. Use with care. pub fn skip_typecheck(self) -> Typed { @@ -604,12 +604,7 @@ pub fn type_with( /// `typeOf` is the same as `type_with` with an empty context, meaning that the /// expression must be closed (i.e. no free variables), otherwise type-checking /// will fail. -pub fn type_of(e: SubExpr<X, X>) -> Result<SubExpr<X, X>, TypeError<X>> { - let e = type_of_(e)?; - Ok(e.get_type_move().into_normalized()?.into_expr()) -} - -pub fn type_of_(e: SubExpr<X, X>) -> Result<Typed, TypeError<X>> { +pub fn type_of(e: SubExpr<X, X>) -> Result<Typed, TypeError<X>> { let ctx = Context::new(); let e = type_with(&ctx, e)?; // Ensure the inferred type isn't UNTYPE |