From 72ad56209fe10e3120c19ca5b820ff267423ab1d Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sat, 11 Apr 2020 15:41:21 +0100 Subject: spec: fix precedence of `===` and `with` --- dhall/tests/parser/success/unit/WithPrecedence1B.txt | 1 + dhall/tests/parser/success/unit/WithPrecedence2B.txt | 1 + dhall/tests/parser/success/unit/WithPrecedence3B.txt | 1 + dhall/tests/parser/success/unit/operators/PrecedenceEquivalenceB.txt | 1 + 4 files changed, 4 insertions(+) create mode 100644 dhall/tests/parser/success/unit/WithPrecedence1B.txt create mode 100644 dhall/tests/parser/success/unit/WithPrecedence2B.txt create mode 100644 dhall/tests/parser/success/unit/WithPrecedence3B.txt create mode 100644 dhall/tests/parser/success/unit/operators/PrecedenceEquivalenceB.txt (limited to 'dhall/tests/parser/success') diff --git a/dhall/tests/parser/success/unit/WithPrecedence1B.txt b/dhall/tests/parser/success/unit/WithPrecedence1B.txt new file mode 100644 index 0000000..5f22335 --- /dev/null +++ b/dhall/tests/parser/success/unit/WithPrecedence1B.txt @@ -0,0 +1 @@ +{ a = Some 1 } ⫽ { a = Some 2 } ⫽ { a = Some 3 } diff --git a/dhall/tests/parser/success/unit/WithPrecedence2B.txt b/dhall/tests/parser/success/unit/WithPrecedence2B.txt new file mode 100644 index 0000000..f945cc9 --- /dev/null +++ b/dhall/tests/parser/success/unit/WithPrecedence2B.txt @@ -0,0 +1 @@ +{ x = 0 } ⫽ { x = 1 + 1 } diff --git a/dhall/tests/parser/success/unit/WithPrecedence3B.txt b/dhall/tests/parser/success/unit/WithPrecedence3B.txt new file mode 100644 index 0000000..a801b24 --- /dev/null +++ b/dhall/tests/parser/success/unit/WithPrecedence3B.txt @@ -0,0 +1 @@ +foo::{ x = 0 } ⫽ { x = 1 } diff --git a/dhall/tests/parser/success/unit/operators/PrecedenceEquivalenceB.txt b/dhall/tests/parser/success/unit/operators/PrecedenceEquivalenceB.txt new file mode 100644 index 0000000..717c108 --- /dev/null +++ b/dhall/tests/parser/success/unit/operators/PrecedenceEquivalenceB.txt @@ -0,0 +1 @@ +2 + 3 * 4 ≡ 4 * 3 + 2 -- cgit v1.3.1 From 233e17abd5ec68f2a964954fb42c23705e6fa62d Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sat, 11 Apr 2020 22:58:02 +0100 Subject: spec: update encoding of floating point values to RFC7049bis --- CHANGELOG.md | 1 + dhall-lang | 2 +- dhall/tests/parser/success/unit/DoubleLit16bitB.txt | 1 + dhall/tests/parser/success/unit/DoubleLit32bitB.txt | 1 + dhall/tests/parser/success/unit/DoubleLit64bitB.txt | 1 + dhall/tests/spec.rs | 15 +++------------ 6 files changed, 8 insertions(+), 13 deletions(-) create mode 100644 dhall/tests/parser/success/unit/DoubleLit16bitB.txt create mode 100644 dhall/tests/parser/success/unit/DoubleLit32bitB.txt create mode 100644 dhall/tests/parser/success/unit/DoubleLit64bitB.txt (limited to 'dhall/tests/parser/success') diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ac4b21..f410d16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ #### [Unreleased] +- Update encoding of floating point values to RFC7049bis - Allow unions with mixed kinds - Adjust precedence of `===` and `with` - Fix running tests on Windows. Developing on this lib should now be possible on Windows. diff --git a/dhall-lang b/dhall-lang index 5973964..379e741 160000 --- a/dhall-lang +++ b/dhall-lang @@ -1 +1 @@ -Subproject commit 5973964062be2e7ea6ff7300a46616086dd9143b +Subproject commit 379e741365465313aa77e755077bd81f328ca1bc diff --git a/dhall/tests/parser/success/unit/DoubleLit16bitB.txt b/dhall/tests/parser/success/unit/DoubleLit16bitB.txt new file mode 100644 index 0000000..9ad974f --- /dev/null +++ b/dhall/tests/parser/success/unit/DoubleLit16bitB.txt @@ -0,0 +1 @@ +5.5 diff --git a/dhall/tests/parser/success/unit/DoubleLit32bitB.txt b/dhall/tests/parser/success/unit/DoubleLit32bitB.txt new file mode 100644 index 0000000..f67efa2 --- /dev/null +++ b/dhall/tests/parser/success/unit/DoubleLit32bitB.txt @@ -0,0 +1 @@ +5555.5 diff --git a/dhall/tests/parser/success/unit/DoubleLit64bitB.txt b/dhall/tests/parser/success/unit/DoubleLit64bitB.txt new file mode 100644 index 0000000..f3714c3 --- /dev/null +++ b/dhall/tests/parser/success/unit/DoubleLit64bitB.txt @@ -0,0 +1 @@ +55555555555.5 diff --git a/dhall/tests/spec.rs b/dhall/tests/spec.rs index 37df91d..ee12bc7 100644 --- a/dhall/tests/spec.rs +++ b/dhall/tests/spec.rs @@ -51,7 +51,7 @@ impl FileType { match self { FileType::Text => TestFile::Source(file), FileType::Binary => TestFile::Binary(file), - FileType::Hash => TestFile::Binary(file), + FileType::Hash => TestFile::UI(file), FileType::UI => TestFile::UI(file), } } @@ -449,10 +449,6 @@ fn define_features() -> Vec { false // Pretty sure the test is incorrect || path == "unit/import/urls/quotedPathFakeUrlEncode" - // See https://github.com/pyfisch/cbor/issues/109 - || path == "double" - || path == "unit/DoubleLitExponentNoDot" - || path == "unit/DoubleLitSecretelyInt" }), output_type: FileType::Binary, ..default_feature.clone() @@ -518,13 +514,8 @@ fn define_features() -> Vec { directory: "semantic-hash/success/", variant: SpecTestKind::SemanticHash, exclude_path: Rc::new(|path: &str| { - false - // We don't support bignums - || path == "simple/integerToDouble" - // See https://github.com/pyfisch/cbor/issues/109 - || path == "prelude/Integer/toDouble/0" - || path == "prelude/Integer/toDouble/1" - || path == "prelude/Natural/toDouble/0" + // We don't support bignums + path == "simple/integerToDouble" }), output_type: FileType::Hash, ..default_feature.clone() -- cgit v1.3.1 From 2cb647a1af179662832fb978b90f0b1df6e3dc18 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Thu, 25 Jun 2020 13:55:49 +0100 Subject: spec: allow quoted labels to be empty --- CHANGELOG.md | 1 + dhall-lang | 2 +- dhall/src/syntax/text/dhall.abnf | 2 +- dhall/src/syntax/text/printer.rs | 4 +++- dhall/tests/parser/success/quotedLabelB.txt | 2 +- dhall/tests/parser/success/quotedRecordLabelB.txt | 1 + dhall/tests/parser/success/quotedUnionLabelB.txt | 1 + 7 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 dhall/tests/parser/success/quotedRecordLabelB.txt create mode 100644 dhall/tests/parser/success/quotedUnionLabelB.txt (limited to 'dhall/tests/parser/success') diff --git a/CHANGELOG.md b/CHANGELOG.md index 436b02c..959f0a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ #### [Unreleased] +- Allow quoted labels to be empty - Support Dhall v16.0.0 - Fix running tests on Windows. Developing on this lib should now be possible on Windows. diff --git a/dhall-lang b/dhall-lang index 4d7c8e4..eb2e9df 160000 --- a/dhall-lang +++ b/dhall-lang @@ -1 +1 @@ -Subproject commit 4d7c8e403202d7e8c64429bc23da41e33475d4e4 +Subproject commit eb2e9df445f8fd2036863813c3ad32a89e7778e0 diff --git a/dhall/src/syntax/text/dhall.abnf b/dhall/src/syntax/text/dhall.abnf index 861f7b3..05d76e6 100644 --- a/dhall/src/syntax/text/dhall.abnf +++ b/dhall/src/syntax/text/dhall.abnf @@ -206,7 +206,7 @@ quoted-label-char = ; %x60 = '`' / %x61-7E -quoted-label = 1*quoted-label-char +quoted-label = *quoted-label-char ; NOTE: Dhall does not support Unicode labels, mainly to minimize the potential ; for code obfuscation diff --git a/dhall/src/syntax/text/printer.rs b/dhall/src/syntax/text/printer.rs index ccba385..8815d69 100644 --- a/dhall/src/syntax/text/printer.rs +++ b/dhall/src/syntax/text/printer.rs @@ -154,7 +154,9 @@ fn fmt_label(label: &Label, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { | "True" | "False" | "Some" => true, _ => Builtin::parse(&s).is_some(), }; - if !is_reserved && s.chars().all(|c| c.is_ascii_alphanumeric()) { + if s.is_empty() { + write!(f, "``") + } else if !is_reserved && s.chars().all(|c| c.is_ascii_alphanumeric()) { write!(f, "{}", s) } else { write!(f, "`{}`", s) diff --git a/dhall/tests/parser/success/quotedLabelB.txt b/dhall/tests/parser/success/quotedLabelB.txt index 861ae0b..f8175de 100644 --- a/dhall/tests/parser/success/quotedLabelB.txt +++ b/dhall/tests/parser/success/quotedLabelB.txt @@ -1 +1 @@ -{ example1 = let `let` = 1 in `let`, example2 = let `:.` = 1 in `:.`, example3 = let `$ref` = 1 in `$ref` } +{ example1 = let `let` = 1 in `let`, example2 = let `:.` = 1 in `:.`, example3 = let `$ref` = 1 in `$ref`, example4 = let `` = 1 in `` } diff --git a/dhall/tests/parser/success/quotedRecordLabelB.txt b/dhall/tests/parser/success/quotedRecordLabelB.txt new file mode 100644 index 0000000..6e5a76b --- /dev/null +++ b/dhall/tests/parser/success/quotedRecordLabelB.txt @@ -0,0 +1 @@ +{ `` = 2, ` ` = 3, foo = 1 } diff --git a/dhall/tests/parser/success/quotedUnionLabelB.txt b/dhall/tests/parser/success/quotedUnionLabelB.txt new file mode 100644 index 0000000..1974ec2 --- /dev/null +++ b/dhall/tests/parser/success/quotedUnionLabelB.txt @@ -0,0 +1 @@ +< ``: Natural | ` `: Natural | foo: Natural > -- cgit v1.3.1 From 8fd2fb4871335c72b9448da4a66144fd7f986f09 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Thu, 25 Jun 2020 14:21:02 +0100 Subject: spec!: remove the ability to quote paths in URLs --- CHANGELOG.md | 1 + dhall-lang | 2 +- dhall/src/syntax/text/dhall.abnf | 9 ++------- dhall/src/syntax/text/dhall.pest.visibility | 2 +- dhall/src/syntax/text/parser.rs | 11 +++++------ dhall/tests/parser/failure/unit/UrlWithQuotedPath.txt | 6 ++++++ dhall/tests/parser/success/unit/import/quotedPathsB.txt | 2 +- 7 files changed, 17 insertions(+), 16 deletions(-) create mode 100644 dhall/tests/parser/failure/unit/UrlWithQuotedPath.txt (limited to 'dhall/tests/parser/success') diff --git a/CHANGELOG.md b/CHANGELOG.md index 959f0a6..dd042c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ #### [Unreleased] +- BREAKING CHANGE: Remove the ability to quote paths in URLs - Allow quoted labels to be empty - Support Dhall v16.0.0 - Fix running tests on Windows. Developing on this lib should now be possible on Windows. diff --git a/dhall-lang b/dhall-lang index 871e8f7..8637829 160000 --- a/dhall-lang +++ b/dhall-lang @@ -1 +1 @@ -Subproject commit 871e8f749f4c8a9d80311e0646dfbf0b5eeec316 +Subproject commit 86378293333912335c7b4bfaa32a562947809512 diff --git a/dhall/src/syntax/text/dhall.abnf b/dhall/src/syntax/text/dhall.abnf index 26f6eab..4061de2 100644 --- a/dhall/src/syntax/text/dhall.abnf +++ b/dhall/src/syntax/text/dhall.abnf @@ -582,7 +582,6 @@ scheme = %x68.74.74.70 [ %x73 ] ; "http" [ "s" ] ; NOTE: This does not match the official grammar for a URI. Specifically: ; -; * path segments may be quoted instead of using percent-encoding ; * this does not support fragment identifiers, which have no meaning within ; Dhall expressions and do not affect import resolution ; * the characters "(" ")" and "," are not included in the `sub-delims` rule: @@ -595,13 +594,9 @@ scheme = %x68.74.74.70 [ %x73 ] ; "http" [ "s" ] ; ; Reserved characters in quoted path components should be percent-encoded ; according to https://tools.ietf.org/html/rfc3986#section-2 -http-raw = scheme "://" authority url-path [ "?" query ] +http-raw = scheme "://" authority path-abempty [ "?" query ] -; Temporary rule to allow old-style `path-component`s and RFC3986 `segment`s in -; the same grammar. Eventually we can just use `path-abempty` from the same -; RFC. See issue #581 - -url-path = *(path-component / "/" segment) +path-abempty = *( "/" segment ) ; NOTE: Backtrack if parsing the optional user info prefix fails authority = [ userinfo "@" ] host [ ":" port ] diff --git a/dhall/src/syntax/text/dhall.pest.visibility b/dhall/src/syntax/text/dhall.pest.visibility index 2fee160..6de7dd2 100644 --- a/dhall/src/syntax/text/dhall.pest.visibility +++ b/dhall/src/syntax/text/dhall.pest.visibility @@ -120,7 +120,7 @@ home_path absolute_path scheme http_raw -url_path +path_abempty authority # userinfo # host diff --git a/dhall/src/syntax/text/parser.rs b/dhall/src/syntax/text/parser.rs index 1c51ca2..06c1ac3 100644 --- a/dhall/src/syntax/text/parser.rs +++ b/dhall/src/syntax/text/parser.rs @@ -514,14 +514,14 @@ impl DhallParser { fn http_raw(input: ParseInput) -> ParseResult> { Ok(match_nodes!(input.into_children(); - [scheme(sch), authority(auth), url_path(p)] => URL { + [scheme(sch), authority(auth), path_abempty(p)] => URL { scheme: sch, authority: auth, path: p, query: None, headers: None, }, - [scheme(sch), authority(auth), url_path(p), query(q)] => URL { + [scheme(sch), authority(auth), path_abempty(p), query(q)] => URL { scheme: sch, authority: auth, path: p, @@ -531,10 +531,10 @@ impl DhallParser { )) } - fn url_path(input: ParseInput) -> ParseResult { + fn path_abempty(input: ParseInput) -> ParseResult { Ok(match_nodes!(input.into_children(); - [path_component(components)..] => { - let mut file_path: Vec<_> = components.collect(); + [segment(segments)..] => { + let mut file_path: Vec<_> = segments.collect(); // An empty path normalizes to "/" if file_path.is_empty() { file_path = vec!["".to_owned()]; @@ -548,7 +548,6 @@ impl DhallParser { Ok(input.as_str().to_owned()) } - #[alias(path_component)] fn segment(input: ParseInput) -> ParseResult { Ok(input.as_str().to_string()) } diff --git a/dhall/tests/parser/failure/unit/UrlWithQuotedPath.txt b/dhall/tests/parser/failure/unit/UrlWithQuotedPath.txt new file mode 100644 index 0000000..0b51f38 --- /dev/null +++ b/dhall/tests/parser/failure/unit/UrlWithQuotedPath.txt @@ -0,0 +1,6 @@ + --> 1:21 + | +1 | https://example.com/"a%20b"/c␊ + | ^--- + | + = expected EOI, import_alt, bool_or, natural_plus, text_append, list_append, bool_and, natural_times, bool_eq, bool_ne, combine, combine_types, equivalent, prefer, or arrow diff --git a/dhall/tests/parser/success/unit/import/quotedPathsB.txt b/dhall/tests/parser/success/unit/import/quotedPathsB.txt index 4705ca3..373b872 100644 --- a/dhall/tests/parser/success/unit/import/quotedPathsB.txt +++ b/dhall/tests/parser/success/unit/import/quotedPathsB.txt @@ -1 +1 @@ -{ example0 = /foo/bar/"baz qux", example1 = https://example.com/foo/bar%3Fbaz?qux } +/foo/bar/"baz qux" -- cgit v1.3.1 From 75929b8a3ca99ead6e10365439c40d2fe86dfe55 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Thu, 25 Jun 2020 14:27:53 +0100 Subject: chore: garbage collect removed tests --- dhall/tests/parser/success/unit/WithPrecedenceB.txt | 1 - .../success/unit/import/urls/quotedPathFakeUrlEncodeB.txt | 1 - dhall/tests/spec.rs | 10 ---------- 3 files changed, 12 deletions(-) delete mode 100644 dhall/tests/parser/success/unit/WithPrecedenceB.txt delete mode 100644 dhall/tests/parser/success/unit/import/urls/quotedPathFakeUrlEncodeB.txt (limited to 'dhall/tests/parser/success') diff --git a/dhall/tests/parser/success/unit/WithPrecedenceB.txt b/dhall/tests/parser/success/unit/WithPrecedenceB.txt deleted file mode 100644 index 5f22335..0000000 --- a/dhall/tests/parser/success/unit/WithPrecedenceB.txt +++ /dev/null @@ -1 +0,0 @@ -{ a = Some 1 } ⫽ { a = Some 2 } ⫽ { a = Some 3 } diff --git a/dhall/tests/parser/success/unit/import/urls/quotedPathFakeUrlEncodeB.txt b/dhall/tests/parser/success/unit/import/urls/quotedPathFakeUrlEncodeB.txt deleted file mode 100644 index a8366d2..0000000 --- a/dhall/tests/parser/success/unit/import/urls/quotedPathFakeUrlEncodeB.txt +++ /dev/null @@ -1 +0,0 @@ -https://example.com/a%20b/c diff --git a/dhall/tests/spec.rs b/dhall/tests/spec.rs index ee12bc7..d9e2c56 100644 --- a/dhall/tests/spec.rs +++ b/dhall/tests/spec.rs @@ -413,11 +413,6 @@ fn define_features() -> Vec { directory: "parser/success/", variant: SpecTestKind::ParserSuccess, too_slow_path: Rc::new(|path: &str| path == "largeExpression"), - exclude_path: Rc::new(|path: &str| { - false - // Pretty sure the test is incorrect - || path == "unit/import/urls/quotedPathFakeUrlEncode" - }), output_type: FileType::Binary, ..default_feature.clone() }, @@ -445,11 +440,6 @@ fn define_features() -> Vec { directory: "parser/success/", variant: SpecTestKind::BinaryEncoding, too_slow_path: Rc::new(|path: &str| path == "largeExpression"), - exclude_path: Rc::new(|path: &str| { - false - // Pretty sure the test is incorrect - || path == "unit/import/urls/quotedPathFakeUrlEncode" - }), output_type: FileType::Binary, ..default_feature.clone() }, -- cgit v1.3.1 From ac7e39a752c41c06155e27e84404c67c1341065d Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Thu, 25 Jun 2020 14:28:48 +0100 Subject: spec!: remove Optional/build and Optional/fold --- CHANGELOG.md | 1 + dhall-lang | 2 +- dhall/src/builtins.rs | 43 ---------------------- dhall/src/syntax/text/dhall.abnf | 7 ++-- dhall/tests/parser/success/builtinsB.txt | 2 +- .../unit/LetWithNonterminatingAnnotation.txt | 12 ++++++ .../failure/unit/RemovedBuiltinOptionalBuild.txt | 6 +++ .../failure/unit/RemovedBuiltinOptionalFold.txt | 6 +++ 8 files changed, 30 insertions(+), 49 deletions(-) create mode 100644 dhall/tests/type-inference/failure/unit/LetWithNonterminatingAnnotation.txt create mode 100644 dhall/tests/type-inference/failure/unit/RemovedBuiltinOptionalBuild.txt create mode 100644 dhall/tests/type-inference/failure/unit/RemovedBuiltinOptionalFold.txt (limited to 'dhall/tests/parser/success') diff --git a/CHANGELOG.md b/CHANGELOG.md index dd042c3..8854a31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ #### [Unreleased] +- BREAKING CHANGE: Remove Optional/build and Optional/fold - BREAKING CHANGE: Remove the ability to quote paths in URLs - Allow quoted labels to be empty - Support Dhall v16.0.0 diff --git a/dhall-lang b/dhall-lang index 9358ffa..5494705 160000 --- a/dhall-lang +++ b/dhall-lang @@ -1 +1 @@ -Subproject commit 9358ffa9c8241b0d8446d46010318758b0df38cb +Subproject commit 549470527dcc0ee59253708c6ac23c0cee455093 diff --git a/dhall/src/builtins.rs b/dhall/src/builtins.rs index 67929a0..16d656f 100644 --- a/dhall/src/builtins.rs +++ b/dhall/src/builtins.rs @@ -42,8 +42,6 @@ pub enum Builtin { ListLast, ListIndexed, ListReverse, - OptionalFold, - OptionalBuild, TextShow, } @@ -79,8 +77,6 @@ impl Builtin { "List/last" => Some(ListLast), "List/indexed" => Some(ListIndexed), "List/reverse" => Some(ListReverse), - "Optional/fold" => Some(OptionalFold), - "Optional/build" => Some(OptionalBuild), "Text/show" => Some(TextShow), _ => None, } @@ -245,22 +241,6 @@ pub fn type_of_builtin(b: Builtin) -> Hir { forall (a: Type) -> (List a) -> List a ), - OptionalBuild => make_type!( - forall (a: Type) -> - (forall (optional: Type) -> - forall (just: a -> optional) -> - forall (nothing: optional) -> - optional) -> - Optional a - ), - OptionalFold => make_type!( - forall (a: Type) -> - (Optional a) -> - forall (optional: Type) -> - forall (just: a -> optional) -> - forall (nothing: optional) -> - optional - ), OptionalNone => make_type!( forall (A: Type) -> Optional A ), @@ -510,27 +490,6 @@ fn apply_builtin(b: Builtin, args: Vec, env: NzEnv) -> NirKind { } _ => Ret::DoneAsIs, }, - (Builtin::OptionalBuild, [t, f]) => { - let optional_t = - Nir::from_builtin(Builtin::Optional).app(t.clone()); - Ret::Nir( - f.app(optional_t) - .app( - make_closure(make_closure!( - λ(T : Type) -> - λ(a : var(T)) -> - Some(var(a)) - )) - .app(t.clone()), - ) - .app(EmptyOptionalLit(t.clone()).into_nir()), - ) - } - (Builtin::OptionalFold, [_, v, _, just, nothing]) => match &*v.kind() { - EmptyOptionalLit(_) => Ret::Nir(nothing.clone()), - NEOptionalLit(x) => Ret::Nir(just.app(x.clone())), - _ => Ret::DoneAsIs, - }, (Builtin::NaturalBuild, [f]) => Ret::Nir( f.app(Nir::from_builtin(Builtin::Natural)) .app(make_closure(make_closure!( @@ -600,8 +559,6 @@ impl std::fmt::Display for Builtin { ListLast => "List/last", ListIndexed => "List/indexed", ListReverse => "List/reverse", - OptionalFold => "Optional/fold", - OptionalBuild => "Optional/build", TextShow => "Text/show", }) } diff --git a/dhall/src/syntax/text/dhall.abnf b/dhall/src/syntax/text/dhall.abnf index 173209c..37ec43b 100644 --- a/dhall/src/syntax/text/dhall.abnf +++ b/dhall/src/syntax/text/dhall.abnf @@ -387,6 +387,9 @@ keyword = / forall-keyword / with +; Note that there is a corresponding parser test in +; `tests/parser/success/builtinsA.dhall`. Please update it when +; you modify this `builtin` rule. builtin = Natural-fold / Natural-build @@ -408,8 +411,6 @@ builtin = / List-last / List-indexed / List-reverse - / Optional-fold - / Optional-build / Text-show / Bool / True @@ -462,8 +463,6 @@ List-head = %x4c.69.73.74.2f.68.65.61.64 List-last = %x4c.69.73.74.2f.6c.61.73.74 List-indexed = %x4c.69.73.74.2f.69.6e.64.65.78.65.64 List-reverse = %x4c.69.73.74.2f.72.65.76.65.72.73.65 -Optional-fold = %x4f.70.74.69.6f.6e.61.6c.2f.66.6f.6c.64 -Optional-build = %x4f.70.74.69.6f.6e.61.6c.2f.62.75.69.6c.64 Text-show = %x54.65.78.74.2f.73.68.6f.77 ; Operators diff --git a/dhall/tests/parser/success/builtinsB.txt b/dhall/tests/parser/success/builtinsB.txt index 4e3ed79..1005949 100644 --- a/dhall/tests/parser/success/builtinsB.txt +++ b/dhall/tests/parser/success/builtinsB.txt @@ -1 +1 @@ -λ(x : { field0 : Bool, field1 : Optional (Optional Bool), field2 : Natural, field3 : Integer, field4 : Double, field5 : Text, field6 : List (List Bool) }) → { field00 = Natural/fold, field01 = Natural/build, field02 = Natural/isZero, field03 = Natural/even, field04 = Natural/odd, field05 = Natural/toInteger, field06 = Natural/show, field07 = Integer/show, field08 = Double/show, field09 = List/build, field10 = List/fold, field11 = List/length, field12 = List/head, field13 = List/last, field14 = List/indexed, field15 = List/reverse, field16 = Optional/fold, field17 = Optional/build, field18 = True, field19 = False, field20 = None } +[Natural/fold, Natural/build, Natural/isZero, Natural/even, Natural/odd, Natural/toInteger, Natural/show, Integer/toDouble, Integer/show, Integer/negate, Integer/clamp, Natural/subtract, Double/show, List/build, List/fold, List/length, List/head, List/last, List/indexed, List/reverse, Text/show, Bool, True, False, Optional, None, Natural, Integer, Double, Text, List, Type, Kind, Sort] diff --git a/dhall/tests/type-inference/failure/unit/LetWithNonterminatingAnnotation.txt b/dhall/tests/type-inference/failure/unit/LetWithNonterminatingAnnotation.txt new file mode 100644 index 0000000..6e360da --- /dev/null +++ b/dhall/tests/type-inference/failure/unit/LetWithNonterminatingAnnotation.txt @@ -0,0 +1,12 @@ +Type error: error: expected function, found `Natural` + --> :6:25 + | + 1 | -- When you check if an inferred type is equivalent to an annotation, + 2 | -- you must alpha-beta-normalize both sides first. But it is not safe + 3 | -- to beta-normalise an expression which hasn't first been + 4 | -- typechecked. +... +10 | let a +11 | : (λ(x : Natural) → x x) (λ(x : Natural) → x x) + | ^ function application requires a function + | diff --git a/dhall/tests/type-inference/failure/unit/RemovedBuiltinOptionalBuild.txt b/dhall/tests/type-inference/failure/unit/RemovedBuiltinOptionalBuild.txt new file mode 100644 index 0000000..e4e285c --- /dev/null +++ b/dhall/tests/type-inference/failure/unit/RemovedBuiltinOptionalBuild.txt @@ -0,0 +1,6 @@ +Type error: error: unbound variable ``Optional/build`` + --> :1:1 + | +1 | Optional/build + | ^^^^^^^^^^^^^^ not found in this scope + | diff --git a/dhall/tests/type-inference/failure/unit/RemovedBuiltinOptionalFold.txt b/dhall/tests/type-inference/failure/unit/RemovedBuiltinOptionalFold.txt new file mode 100644 index 0000000..3d6c6aa --- /dev/null +++ b/dhall/tests/type-inference/failure/unit/RemovedBuiltinOptionalFold.txt @@ -0,0 +1,6 @@ +Type error: error: unbound variable ``Optional/fold`` + --> :1:1 + | +1 | Optional/fold + | ^^^^^^^^^^^^^ not found in this scope + | -- cgit v1.3.1