diff options
author | Nadrieril | 2019-08-07 21:05:01 +0200 |
---|---|---|
committer | Nadrieril | 2019-08-07 21:05:01 +0200 |
commit | d248762095908246951b6aa6c211587c6e333c0e (patch) | |
tree | 688d4c1c199fd8f759d41c65e4dbc8bde9cc6614 /dhall/src/phase | |
parent | 0c9831e6a851e8f91bddc33e7a163f49d60aa033 (diff) |
Remove union literals from the language
Diffstat (limited to 'dhall/src/phase')
-rw-r--r-- | dhall/src/phase/binary.rs | 12 | ||||
-rw-r--r-- | dhall/src/phase/normalize.rs | 7 | ||||
-rw-r--r-- | dhall/src/phase/typecheck.rs | 9 |
3 files changed, 3 insertions, 25 deletions
diff --git a/dhall/src/phase/binary.rs b/dhall/src/phase/binary.rs index e44b1e2..bfe217f 100644 --- a/dhall/src/phase/binary.rs +++ b/dhall/src/phase/binary.rs @@ -160,12 +160,9 @@ fn cbor_value_to_dhall( let map = cbor_map_to_dhall_opt_map(map)?; UnionType(map) } - [U64(12), String(l), x, Object(map)] => { - let map = cbor_map_to_dhall_opt_map(map)?; - let x = cbor_value_to_dhall(&x)?; - let l = Label::from(l.as_str()); - UnionLit(l, x, map) - } + [U64(12), ..] => Err(DecodeError::WrongFormatError( + "Union literals are not supported anymore".to_owned(), + ))?, [U64(14), x, y, z] => { let x = cbor_value_to_dhall(&x)?; let y = cbor_value_to_dhall(&y)?; @@ -496,9 +493,6 @@ where RecordType(map) => ser_seq!(ser; tag(7), RecordMap(map)), RecordLit(map) => ser_seq!(ser; tag(8), RecordMap(map)), UnionType(map) => ser_seq!(ser; tag(11), UnionMap(map)), - UnionLit(l, x, map) => { - ser_seq!(ser; tag(12), label(l), expr(x), UnionMap(map)) - } Field(x, l) => ser_seq!(ser; tag(9), expr(x), label(l)), BinOp(op, x, y) => { use dhall_syntax::BinOp::*; diff --git a/dhall/src/phase/normalize.rs b/dhall/src/phase/normalize.rs index 2e9f258..3e45240 100644 --- a/dhall/src/phase/normalize.rs +++ b/dhall/src/phase/normalize.rs @@ -677,13 +677,6 @@ pub fn normalize_one_layer(expr: ExprF<Thunk, X>) -> Value { .map(|(k, t)| (k, TypeThunk::from_thunk(t))) .collect(), )), - ExprF::UnionLit(l, x, kts) => Ret::Value(UnionLit( - l, - x, - kts.into_iter() - .map(|(k, t)| (k, t.map(|t| TypeThunk::from_thunk(t)))) - .collect(), - )), ExprF::UnionType(kts) => Ret::Value(UnionType( kts.into_iter() .map(|(k, t)| (k, t.map(|t| TypeThunk::from_thunk(t)))) diff --git a/dhall/src/phase/typecheck.rs b/dhall/src/phase/typecheck.rs index 35bf3a9..4b3a03f 100644 --- a/dhall/src/phase/typecheck.rs +++ b/dhall/src/phase/typecheck.rs @@ -505,15 +505,6 @@ fn type_last_layer( )? .into_type(), )), - UnionLit(x, v, kvs) => { - use std::iter::once; - let kts = kvs - .iter() - .map(|(x, v)| Ok((x.clone(), v.as_ref().map(|v| v.to_type())))); - let t = v.get_type()?.into_owned(); - let kts = kts.chain(once(Ok((x.clone(), Some(t))))); - Ok(RetTypeOnly(tck_union_type(ctx, kts)?.to_type())) - } Field(r, x) => { match &r.get_type()?.to_value() { Value::RecordType(kts) => match kts.get(&x) { |