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/tck | |
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/tck')
-rw-r--r-- | dhall/src/semantics/tck/typecheck.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/dhall/src/semantics/tck/typecheck.rs b/dhall/src/semantics/tck/typecheck.rs index 5a44c9c..e14bcc6 100644 --- a/dhall/src/semantics/tck/typecheck.rs +++ b/dhall/src/semantics/tck/typecheck.rs @@ -184,6 +184,11 @@ pub fn type_with<'cx, 'hir>( ) -> Result<Tir<'cx, 'hir>, TypeError> { let tir = match hir.kind() { HirKind::Var(var) => Tir::from_hir(hir, env.lookup(*var)), + HirKind::MissingVar(var) => mkerr( + ErrorBuilder::new(format!("unbound variable `{}`", var)) + .span_err(hir.span(), "not found in this scope") + .format(), + )?, HirKind::Import(import) => { let typed = env.cx()[import].unwrap_result(); Tir::from_hir(hir, typed.ty.clone()) |