From 427c5e55a6e6768b22c3e7ad40594d451ac024e7 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Thu, 21 Mar 2019 15:42:16 +0100 Subject: Rename Record/Union to RecordType/UnionType --- dhall/src/binary.rs | 4 ++-- dhall/src/typecheck.rs | 10 +++++----- dhall_core/src/core.rs | 8 ++++---- dhall_core/src/parser.rs | 8 ++++---- dhall_generator/src/lib.rs | 4 ++-- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/dhall/src/binary.rs b/dhall/src/binary.rs index 1ab7956..9099afc 100644 --- a/dhall/src/binary.rs +++ b/dhall/src/binary.rs @@ -129,7 +129,7 @@ fn cbor_value_to_dhall(data: &cbor::Value) -> Result { } [U64(7), Object(map)] => { let map = cbor_map_to_dhall_map(map)?; - Record(map) + RecordType(map) } [U64(8), Object(map)] => { let map = cbor_map_to_dhall_map(map)?; @@ -142,7 +142,7 @@ fn cbor_value_to_dhall(data: &cbor::Value) -> Result { } [U64(11), Object(map)] => { let map = cbor_map_to_dhall_map(map)?; - Union(map) + UnionType(map) } [U64(12), String(l), x, Object(map)] => { let map = cbor_map_to_dhall_map(map)?; diff --git a/dhall/src/typecheck.rs b/dhall/src/typecheck.rs index 62dda08..15fb344 100644 --- a/dhall/src/typecheck.rs +++ b/dhall/src/typecheck.rs @@ -90,7 +90,7 @@ where .zip(aR.iter()) .all(|(aL, aR)| go(ctx, aL.as_ref(), aR.as_ref())) } - (&Record(ref ktsL0), &Record(ref ktsR0)) => { + (&RecordType(ref ktsL0), &RecordType(ref ktsR0)) => { ktsL0.len() == ktsR0.len() && ktsL0.iter().zip(ktsR0.iter()).all( |((kL, tL), (kR, tR))| { @@ -98,7 +98,7 @@ where }, ) } - (&Union(ref ktsL0), &Union(ref ktsR0)) => { + (&UnionType(ref ktsL0), &UnionType(ref ktsR0)) => { ktsL0.len() == ktsR0.len() && ktsL0.iter().zip(ktsR0.iter()).all( |((kL, tL), (kR, tR))| { @@ -397,7 +397,7 @@ where } return Ok(dhall_expr!(Optional t)); } - Record(kts) => { + RecordType(kts) => { for (k, t) in kts { let s = normalized_type_with(ctx, t.clone())?; ensure_is_type(s, InvalidFieldType(k.clone(), t.clone()))?; @@ -414,12 +414,12 @@ where Ok((k.clone(), t)) }) .collect::>()?; - Ok(Record(kts)) + Ok(RecordType(kts)) } Field(r, x) => { let t = normalized_type_with(ctx, r.clone())?; match t.as_ref() { - Record(kts) => { + RecordType(kts) => { return kts.get(x).cloned().ok_or_else(|| { mkerr(MissingField(x.clone(), t.clone())) }) diff --git a/dhall_core/src/core.rs b/dhall_core/src/core.rs index 68e781d..1d733aa 100644 --- a/dhall_core/src/core.rs +++ b/dhall_core/src/core.rs @@ -199,11 +199,11 @@ pub enum Expr { /// `OptionalLit t [] ~ [] : Optional t` OptionalLit(Option>, Option>), /// `Record [(k1, t1), (k2, t2)] ~ { k1 : t1, k2 : t1 }` - Record(BTreeMap>), + RecordType(BTreeMap>), /// `RecordLit [(k1, v1), (k2, v2)] ~ { k1 = v1, k2 = v2 }` RecordLit(BTreeMap>), /// `Union [(k1, t1), (k2, t2)] ~ < k1 : t1, k2 : t2 >` - Union(BTreeMap>), + UnionType(BTreeMap>), /// `UnionLit (k1, v1) [(k2, t2), (k3, t3)] ~ < k1 = t1, k2 : t2, k3 : t3 >` UnionLit( Label, @@ -347,9 +347,9 @@ where EmptyListLit(t) => EmptyListLit(map(t)), NEListLit(es) => NEListLit(vec(es)), OptionalLit(t, es) => OptionalLit(opt(t), opt(es)), - Record(kts) => Record(btmap(kts)), + RecordType(kts) => RecordType(btmap(kts)), RecordLit(kvs) => RecordLit(btmap(kvs)), - Union(kts) => Union(btmap(kts)), + UnionType(kts) => UnionType(btmap(kts)), UnionLit(k, v, kvs) => UnionLit(map_label(k), map(v), btmap(kvs)), Merge(x, y, t) => Merge(map(x), map(y), opt(t)), Field(r, x) => Field(map(r), map_label(x)), diff --git a/dhall_core/src/parser.rs b/dhall_core/src/parser.rs index 896a93f..3310bb9 100644 --- a/dhall_core/src/parser.rs +++ b/dhall_core/src/parser.rs @@ -631,14 +631,14 @@ make_parser! { ); rule!(empty_record_type as expression; - raw_pair!(_) => bx(Expr::Record(BTreeMap::new())) + raw_pair!(_) => bx(Expr::RecordType(BTreeMap::new())) ); rule!(non_empty_record_type_or_literal as expression; children!( [label_raw(first_label), non_empty_record_type(rest)] => { let (first_expr, mut map) = rest; map.insert(first_label, first_expr); - bx(Expr::Record(map)) + bx(Expr::RecordType(map)) }, [label_raw(first_label), non_empty_record_literal(rest)] => { let (first_expr, mut map) = rest; @@ -669,13 +669,13 @@ make_parser! { rule!(union_type_or_literal as expression; children!( [empty_union_type(_)] => { - bx(Expr::Union(BTreeMap::new())) + bx(Expr::UnionType(BTreeMap::new())) }, [non_empty_union_type_or_literal((Some((l, e)), entries))] => { bx(Expr::UnionLit(l, e, entries)) }, [non_empty_union_type_or_literal((None, entries))] => { - bx(Expr::Union(entries)) + bx(Expr::UnionType(entries)) }, )); diff --git a/dhall_generator/src/lib.rs b/dhall_generator/src/lib.rs index 434d297..a246818 100644 --- a/dhall_generator/src/lib.rs +++ b/dhall_generator/src/lib.rs @@ -76,9 +76,9 @@ fn dhall_to_tokenstream( let es = vec_to_tokenstream(es, ctx); quote! { NEListLit(#es) } } - Record(m) => { + RecordType(m) => { let m = map_to_tokenstream(m, ctx); - quote! { Record(#m) } + quote! { RecordType(#m) } } RecordLit(m) => { let m = map_to_tokenstream(m, ctx); -- cgit v1.2.3