From fa6de4c077ab4f1c28d2ec64a33a3be8c5a9bb1c Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sun, 22 Dec 2019 18:24:21 +0000 Subject: Update dhall-lang submodule --- dhall/src/error/mod.rs | 1 + dhall/src/semantics/phase/typecheck.rs | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'dhall/src') diff --git a/dhall/src/error/mod.rs b/dhall/src/error/mod.rs index 1288c12..40cccac 100644 --- a/dhall/src/error/mod.rs +++ b/dhall/src/error/mod.rs @@ -76,6 +76,7 @@ pub(crate) enum TypeMessage { MergeHandlerReturnTypeMustNotBeDependent, ProjectionMustBeRecord, ProjectionMissingEntry, + ProjectionDuplicateField, Sort, RecordTypeDuplicateField, RecordTypeMergeRequiresRecordType(Value), diff --git a/dhall/src/semantics/phase/typecheck.rs b/dhall/src/semantics/phase/typecheck.rs index c439f74..856f5c3 100644 --- a/dhall/src/semantics/phase/typecheck.rs +++ b/dhall/src/semantics/phase/typecheck.rs @@ -774,7 +774,15 @@ fn type_last_layer( for l in labels { match kts.get(l) { None => return mkerr(ProjectionMissingEntry), - Some(t) => new_kts.insert(l.clone(), t.clone()), + Some(t) => { + use std::collections::hash_map::Entry; + match new_kts.entry(l.clone()) { + Entry::Occupied(_) => { + return mkerr(ProjectionDuplicateField) + } + Entry::Vacant(e) => e.insert(t.clone()), + } + } }; } -- cgit v1.2.3 From 54d7e61ad40682ee24e36288980ee4164ea87c34 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sun, 22 Dec 2019 18:38:05 +0000 Subject: Update dhall-lang submodule --- dhall/src/syntax/text/printer.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'dhall/src') diff --git a/dhall/src/syntax/text/printer.rs b/dhall/src/syntax/text/printer.rs index 78942ed..dff3479 100644 --- a/dhall/src/syntax/text/printer.rs +++ b/dhall/src/syntax/text/printer.rs @@ -322,6 +322,8 @@ impl Display for NaiveDouble { f.write_str("-Infinity") } else if v.is_nan() { f.write_str("NaN") + } else if v == 0.0 && v.is_sign_negative() { + f.write_str("-0.0") } else { let s = format!("{}", v); if s.contains('e') || s.contains('.') { -- cgit v1.2.3 From e294450e1e76491e96019b8a3695463e09d1739b Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sun, 22 Dec 2019 19:02:18 +0000 Subject: Implement parsing for record completion --- dhall/src/dhall.pest.visibility | 2 ++ dhall/src/semantics/phase/normalize.rs | 1 + dhall/src/semantics/phase/typecheck.rs | 1 + dhall/src/syntax/ast/expr.rs | 2 ++ dhall/src/syntax/ast/visitor.rs | 7 +++++++ dhall/src/syntax/binary/decode.rs | 5 +++++ dhall/src/syntax/binary/encode.rs | 3 +++ dhall/src/syntax/text/parser.rs | 19 +++++++++++++++++++ dhall/src/syntax/text/printer.rs | 20 ++++++++++++-------- 9 files changed, 52 insertions(+), 8 deletions(-) (limited to 'dhall/src') diff --git a/dhall/src/dhall.pest.visibility b/dhall/src/dhall.pest.visibility index 17c1edc..41aa833 100644 --- a/dhall/src/dhall.pest.visibility +++ b/dhall/src/dhall.pest.visibility @@ -91,6 +91,7 @@ prefer lambda forall arrow +# complete # exponent numeric_double_literal minus_infinity_literal @@ -161,6 +162,7 @@ equivalent_expression application_expression first_application_expression # import_expression +completion_expression selector_expression selector labels diff --git a/dhall/src/semantics/phase/normalize.rs b/dhall/src/semantics/phase/normalize.rs index d81a910..65384c2 100644 --- a/dhall/src/semantics/phase/normalize.rs +++ b/dhall/src/semantics/phase/normalize.rs @@ -741,6 +741,7 @@ pub(crate) fn normalize_one_layer( ExprKind::ProjectionByExpr(_, _) => { unimplemented!("selection by expression") } + ExprKind::Completion(_, _) => unimplemented!("record completion"), ExprKind::Merge(ref handlers, ref variant, _) => { let handlers_borrow = handlers.as_whnf(); diff --git a/dhall/src/semantics/phase/typecheck.rs b/dhall/src/semantics/phase/typecheck.rs index 856f5c3..c9834e1 100644 --- a/dhall/src/semantics/phase/typecheck.rs +++ b/dhall/src/semantics/phase/typecheck.rs @@ -792,6 +792,7 @@ fn type_last_layer( )) } ProjectionByExpr(_, _) => unimplemented!("selection by expression"), + Completion(_, _) => unimplemented!("record completion"), }; Ok(match ret { diff --git a/dhall/src/syntax/ast/expr.rs b/dhall/src/syntax/ast/expr.rs index 48c48d8..fe49448 100644 --- a/dhall/src/syntax/ast/expr.rs +++ b/dhall/src/syntax/ast/expr.rs @@ -163,6 +163,8 @@ pub enum ExprKind { Projection(SubExpr, DupTreeSet