summaryrefslogtreecommitdiff
path: root/dhall/src/semantics/resolve
diff options
context:
space:
mode:
Diffstat (limited to 'dhall/src/semantics/resolve')
-rw-r--r--dhall/src/semantics/resolve/hir.rs14
-rw-r--r--dhall/src/semantics/resolve/resolve.rs4
2 files changed, 7 insertions, 11 deletions
diff --git a/dhall/src/semantics/resolve/hir.rs b/dhall/src/semantics/resolve/hir.rs
index fa2989f..22abaaf 100644
--- a/dhall/src/semantics/resolve/hir.rs
+++ b/dhall/src/semantics/resolve/hir.rs
@@ -1,7 +1,7 @@
use crate::error::TypeError;
use crate::semantics::{type_with, NameEnv, Nir, NzEnv, Tir, TyEnv, Type};
use crate::syntax::{Expr, ExprKind, Span, V};
-use crate::{NormalizedExpr, ToExprOptions};
+use crate::ToExprOptions;
/// Stores an alpha-normalized variable.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
@@ -51,15 +51,15 @@ impl Hir {
}
/// Converts a closed Hir expr back to the corresponding AST expression.
- pub fn to_expr(&self, opts: ToExprOptions) -> NormalizedExpr {
+ pub fn to_expr(&self, opts: ToExprOptions) -> Expr {
hir_to_expr(self, opts, &mut NameEnv::new())
}
/// Converts a closed Hir expr back to the corresponding AST expression.
- pub fn to_expr_noopts(&self) -> NormalizedExpr {
+ pub fn to_expr_noopts(&self) -> Expr {
let opts = ToExprOptions { alpha: false };
self.to_expr(opts)
}
- pub fn to_expr_tyenv(&self, env: &TyEnv) -> NormalizedExpr {
+ pub fn to_expr_tyenv(&self, env: &TyEnv) -> Expr {
let opts = ToExprOptions { alpha: false };
let mut env = env.as_nameenv().clone();
hir_to_expr(self, opts, &mut env)
@@ -93,11 +93,7 @@ impl Hir {
}
}
-fn hir_to_expr(
- hir: &Hir,
- opts: ToExprOptions,
- env: &mut NameEnv,
-) -> NormalizedExpr {
+fn hir_to_expr(hir: &Hir, opts: ToExprOptions, env: &mut NameEnv) -> Expr {
let kind = match hir.kind() {
HirKind::Var(v) if opts.alpha => ExprKind::Var(V("_".into(), v.idx())),
HirKind::Var(v) => ExprKind::Var(env.label_var(*v)),
diff --git a/dhall/src/semantics/resolve/resolve.rs b/dhall/src/semantics/resolve/resolve.rs
index f3fda4b..eb2f04f 100644
--- a/dhall/src/semantics/resolve/resolve.rs
+++ b/dhall/src/semantics/resolve/resolve.rs
@@ -13,7 +13,7 @@ use crate::syntax::{
BinOp, Builtin, Expr, ExprKind, FilePath, FilePrefix, ImportMode,
ImportTarget, Span, UnspannedExpr, URL,
};
-use crate::{Parsed, ParsedExpr, Resolved};
+use crate::{Parsed, Resolved};
// TODO: evaluate import headers
pub(crate) type Import = syntax::Import<()>;
@@ -333,7 +333,7 @@ pub(crate) fn resolve(parsed: Parsed) -> Result<Resolved, Error> {
resolve_with_env(&mut ImportEnv::new(), parsed)
}
-pub(crate) fn skip_resolve(expr: &ParsedExpr) -> Result<Hir, Error> {
+pub(crate) fn skip_resolve(expr: &Expr) -> Result<Hir, Error> {
traverse_resolve_expr(&mut NameEnv::new(), expr, &mut |import| {
Err(ImportError::UnexpectedImport(import).into())
})