diff options
author | Nadrieril | 2020-12-07 17:48:20 +0000 |
---|---|---|
committer | Nadrieril | 2020-12-07 19:35:13 +0000 |
commit | 7a392b07166c089979e69d4c8a68da3298964c28 (patch) | |
tree | 3a861160e7d4b379904dbed891bb684de0ad26bc /dhall/src/semantics/resolve/hir.rs | |
parent | f478bc16a3b8414770d84dd87f3e46b869d31750 (diff) |
Defer name errors to typechecking
We aren't supposed to inspect anything before alternatives are chosen
Diffstat (limited to 'dhall/src/semantics/resolve/hir.rs')
-rw-r--r-- | dhall/src/semantics/resolve/hir.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/dhall/src/semantics/resolve/hir.rs b/dhall/src/semantics/resolve/hir.rs index 3e282b4..05a8550 100644 --- a/dhall/src/semantics/resolve/hir.rs +++ b/dhall/src/semantics/resolve/hir.rs @@ -13,6 +13,8 @@ pub struct AlphaVar { pub enum HirKind<'cx> { /// A resolved variable (i.e. a DeBruijn index) Var(AlphaVar), + /// A variable that couldn't be resolved. Detected during resolution, but causes an error during typeck. + MissingVar(V), /// An import. It must have been resolved by the time we get to typechecking/normalization. Import(ImportId<'cx>), // Forbidden ExprKind variants: Var, Import, Completion @@ -104,6 +106,7 @@ fn hir_to_expr<'cx>( 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)), + HirKind::MissingVar(v) => ExprKind::Var(v.clone()), HirKind::Import(import) => { let typed = cx[import].unwrap_result(); return hir_to_expr(cx, &typed.hir, opts, &mut NameEnv::new()); |