#![allow(non_snake_case)] use std::fmt; use crate::expr::*; use dhall_core; use dhall_core::context::Context; use dhall_core::*; use dhall_generator as dhall; use self::TypeMessage::*; impl Resolved { pub fn typecheck(self) -> Result> { type_of(self.0.clone()) } /// Pretends this expression has been typechecked. Use with care. pub fn skip_typecheck(self) -> Typed { Typed(self.0, UNTYPE) } } impl Typed { #[inline(always)] fn as_expr(&self) -> &SubExpr { &self.0 } #[inline(always)] fn into_expr(self) -> SubExpr { self.0 } #[inline(always)] pub fn get_type(&self) -> &Type { &self.1 } #[inline(always)] fn get_type_move(self) -> Type { self.1 } } impl Normalized { #[inline(always)] fn as_expr(&self) -> &SubExpr { &self.0 } #[inline(always)] fn into_expr(self) -> SubExpr { self.0 } #[inline(always)] pub fn get_type(&self) -> &Type { &self.1 } #[inline(always)] fn into_type(self) -> Type { crate::expr::Type(TypeInternal::Expr(Box::new(self))) } // Expose the outermost constructor #[inline(always)] fn unroll_ref(&self) -> &Expr { self.as_expr().as_ref() } #[inline(always)] fn shift(&self, delta: isize, var: &V