diff options
author | Nadrieril | 2020-09-14 23:09:22 +0100 |
---|---|---|
committer | Nadrieril | 2020-09-14 23:19:49 +0100 |
commit | 7e523ae1903ae2d8bca8b3a8352167d7bac5b2b5 (patch) | |
tree | 37e53f88a0d3aa0621e021f307bfcfe4b0c8e29b /dhall/src/operations | |
parent | ffb7cff2ff317c81248a680e4899fa45eed00daa (diff) |
spec: Enable `with` optimizations
Diffstat (limited to '')
-rw-r--r-- | dhall/src/operations/kind.rs | 3 | ||||
-rw-r--r-- | dhall/src/operations/normalization.rs | 2 | ||||
-rw-r--r-- | dhall/src/operations/typecheck.rs | 2 |
3 files changed, 5 insertions, 2 deletions
diff --git a/dhall/src/operations/kind.rs b/dhall/src/operations/kind.rs index 0ee9671..2b035ef 100644 --- a/dhall/src/operations/kind.rs +++ b/dhall/src/operations/kind.rs @@ -55,6 +55,8 @@ pub enum OpKind<SubExpr> { ProjectionByExpr(SubExpr, SubExpr), /// `x::y` Completion(SubExpr, SubExpr), + /// `x with a.b.c = y` + With(SubExpr, Vec<Label>, SubExpr), } impl<SE> OpKind<SE> { @@ -85,6 +87,7 @@ impl<SE> OpKind<SE> { Projection(e, ls) => Projection(expr!(e), ls.clone()), ProjectionByExpr(e, x) => ProjectionByExpr(expr!(e), expr!(x)), Completion(e, x) => Completion(expr!(e), expr!(x)), + With(x, ls, y) => With(expr!(x), ls.clone(), expr!(y)), }) } diff --git a/dhall/src/operations/normalization.rs b/dhall/src/operations/normalization.rs index 86fed13..b930f93 100644 --- a/dhall/src/operations/normalization.rs +++ b/dhall/src/operations/normalization.rs @@ -299,7 +299,7 @@ pub fn normalize_operation(opkind: &OpKind<Nir>) -> Ret { )), _ => nothing_to_do(), }, - Completion(..) => { + Completion(..) | With(..) => { unreachable!("This case should have been handled in resolution") } } diff --git a/dhall/src/operations/typecheck.rs b/dhall/src/operations/typecheck.rs index 314c587..2ccc17d 100644 --- a/dhall/src/operations/typecheck.rs +++ b/dhall/src/operations/typecheck.rs @@ -503,7 +503,7 @@ pub fn typecheck_operation( selection_val } - Completion(..) => { + Completion(..) | With(..) => { unreachable!("This case should have been handled in resolution") } }) |